Skip to content

Commit a2d56c9

Browse files
committed
e2e: Add a11y test for namespace and add aria label to create resource button
Signed-off-by: Vincent T <[email protected]>
1 parent 855c100 commit a2d56c9

File tree

4 files changed

+51
-4
lines changed

4 files changed

+51
-4
lines changed

e2e-tests/package-lock.json

Lines changed: 36 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e-tests/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@types/node": "^20.12.2"
1313
},
1414
"dependencies": {
15+
"@axe-core/playwright": "^4.10.1",
1516
"yaml": "^2.3.4"
1617
}
1718
}

e2e-tests/tests/namespaces.spec.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { test } from '@playwright/test';
1+
import { AxeBuilder } from '@axe-core/playwright';
2+
import { expect, test } from '@playwright/test';
23
import { HeadlampPage } from './headlampPage';
34
import { NamespacesPage } from './namespacesPage';
45

@@ -15,6 +16,17 @@ test('create a namespace with the minimal editor then delete it', async ({ page
1516

1617
const namespacesPage = new NamespacesPage(page);
1718
await namespacesPage.navigateToNamespaces();
19+
20+
const axeBuilder = new AxeBuilder({ page });
21+
22+
const accessibilityResults = await axeBuilder.analyze();
23+
24+
expect(accessibilityResults.violations.length).toBe(0);
25+
1826
await namespacesPage.createNamespace(name);
27+
const postCreationScanResults = await axeBuilder.analyze();
28+
29+
expect(postCreationScanResults.violations.length).toBe(0);
30+
1931
await namespacesPage.deleteNamespace(name);
2032
});

frontend/src/components/common/CreateResourceButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export function CreateResourceButton(props: CreateResourceButtonProps) {
3636
errorMessage={errorMessage}
3737
onEditorChanged={() => setErrorMessage('')}
3838
title={t('translation|Create {{ name }}', { name })}
39+
aria-label={t('translation|Create {{ name }}', { name })}
3940
/>
4041
</AuthVisible>
4142
);

0 commit comments

Comments
 (0)