Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ test.describe('CustomTheme should be applied', () => {
}, testInfo: TestInfo) => {
const themes = ThemeConstants.getThemes();

await runAccessibilityTests(
page,
testInfo,
'accessibility-scan-results.json',
{ skipViolationsAssert: true },
);
await runAccessibilityTests(page, testInfo);

for (const theme of themes) {
await themeVerifier.setTheme(theme.name);
Expand Down Expand Up @@ -86,15 +81,13 @@ test.describe('CustomTheme should be applied', () => {
page,
testInfo,
`${themeName}-${tab}-accessibility`,
{ skipViolationsAssert: true },
);
for (const subTab of subTabs) {
await page.getByRole('tab', { name: subTab }).click();
await runAccessibilityTests(
page,
testInfo,
`${themeName}-${tab}-${subTab}-accessibility`,
{ skipViolationsAssert: true },
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ export async function runAccessibilityTests(
page: Page,
testInfo: TestInfo,
attachName = 'accessibility-scan-results.json',
options: { skipViolationsAssert?: boolean; attachName?: string } = {
skipViolationsAssert: false,
},
) {
const accessibilityScanResults = await new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
Expand All @@ -33,10 +30,8 @@ export async function runAccessibilityTests(
contentType: 'application/json',
});

if (!options?.skipViolationsAssert) {
expect(
accessibilityScanResults.violations,
'Accessibility violations found',
).toEqual([]);
}
expect(
accessibilityScanResults.violations,
'Accessibility violations found',
).toEqual([]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ test.describe('CustomTheme should be applied', () => {
}, testInfo: TestInfo) => {
const themes = ThemeConstants.getThemes();

await runAccessibilityTests(
page,
testInfo,
'accessibility-scan-results.json',
{ skipViolationsAssert: true },
);
await runAccessibilityTests(page, testInfo);

for (const theme of themes) {
await themeVerifier.setTheme(theme.name);
Expand Down Expand Up @@ -82,15 +77,13 @@ test.describe('CustomTheme should be applied', () => {
page,
testInfo,
`${themeName}-${tab}-accessibility`,
{ skipViolationsAssert: true },
);
for (const subTab of subTabs) {
await page.getByRole('tab', { name: subTab }).click();
await runAccessibilityTests(
page,
testInfo,
`${themeName}-${tab}-${subTab}-accessibility`,
{ skipViolationsAssert: true },
);
}
}
Expand Down
13 changes: 4 additions & 9 deletions workspaces/theme/packages/app/e2e-tests/utils/acessibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ export async function runAccessibilityTests(
page: Page,
testInfo: TestInfo,
attachName = 'accessibility-scan-results.json',
options: { skipViolationsAssert?: boolean; attachName?: string } = {
skipViolationsAssert: false,
},
) {
const accessibilityScanResults = await new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
Expand All @@ -33,10 +30,8 @@ export async function runAccessibilityTests(
contentType: 'application/json',
});

if (!options?.skipViolationsAssert) {
expect(
accessibilityScanResults.violations,
'Accessibility violations found',
).toEqual([]);
}
expect(
accessibilityScanResults.violations,
'Accessibility violations found',
).toEqual([]);
}
Loading