Skip to content

Commit

Permalink
Merge branch 'main' into refactor-group-config-files
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranzke committed Jul 26, 2024
2 parents fe7c95f + 108c46b commit 9effc51
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .config/.lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default {
'*.md': 'markdownlint -c .config/.markdown-lint.yml',
'*.{css,scss}': 'stylelint --fix --allow-empty-input',
'*.{js,ts,tsx,jsx,mjs,cjs}': ['xo --fix']
'*.{js,ts,tsx,jsx,mjs,cjs}': 'xo --fix'
};
47 changes: 24 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"tslib": "^2.6.3",
"tsx": "^4.16.2",
"typescript": "^5.4.5",
"validate-branch-name": "^1.3.0",
"validate-branch-name": "^1.3.1",
"xo": "^0.59.2"
},
"validate-branch-name": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["unknown. dialog. document. clickable, Close Button, button. dialog. button, Close Button","Functional"]
["button. dialog. document. clickable, Close Button, button. dialog. button, Close Button","Functional"]
7 changes: 6 additions & 1 deletion showcases/screen-reader/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ const cleanSpeakInstructions = (phraseLog: string[]): string[] =>

export const generateSnapshot = async (
screenReader?: VoiceOverPlaywright | NVDAPlaywright,
retry?: number
retry?: number,
phraseLogConvertFn?: (phraseLog: string[]) => string[]
) => {
if (!screenReader) return;

Expand All @@ -61,6 +62,10 @@ export const generateSnapshot = async (

phraseLog = cleanSpeakInstructions(phraseLog);

if (phraseLogConvertFn) {
phraseLog = phraseLogConvertFn(phraseLog);
}

let snapshot = JSON.stringify(phraseLog);

for (const [key, values] of Object.entries(translations)) {
Expand Down
19 changes: 18 additions & 1 deletion showcases/screen-reader/tests/drawer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getTest, testDefault } from '../default';
import { generateSnapshot, getTest, testDefault } from '../default';

const test = getTest();

Expand All @@ -11,6 +11,23 @@ test.describe('DBDrawer', () => {
const screenReader = voiceOver ?? nvda;
await screenReader?.act();
await screenReader?.next();
},
async postTestFn(voiceOver, nvda, retry) {
if (nvda) {
/*
* There is a timing issue for windows which results in different outputs in CICD.
* We avoid this by replacing the generated log files
*/
await generateSnapshot(nvda, retry, (phraseLog) =>
phraseLog.map((log) =>
log
.replace('Showcase, document. unknown', 'button')
.replace('unknown', 'button')
)
);
} else if (voiceOver) {
await generateSnapshot(voiceOver, retry);
}
}
});
});

0 comments on commit 9effc51

Please sign in to comment.