* Add cypress e2e accessibility tests
* Log accessibility violations to console for quick debugging
* Disable retries to avoid duplicate logs
Signed-off-by: nsedrickm <nsedrick101@gmail.com>
(cherry picked from commit
05c1b776c29795af6d015dd14aae2aa1f5d1b912)
Conflicts:
src/pybind/mgr/dashboard/frontend/cypress/support/commands.ts
- Keep only the accessibility change there and remove the ceph2Login
--- /dev/null
+import { NavigationPageHelper } from '../ui/navigation.po';
+
+describe('Navigation accessibility', { retries: 0 }, () => {
+ const shared = new NavigationPageHelper();
+
+ beforeEach(() => {
+ cy.login();
+ Cypress.Cookies.preserveOnce('token');
+ shared.navigateTo();
+ });
+
+ it('top-nav should have no accessibility violations', () => {
+ cy.injectAxe();
+ cy.checkAccessibility('.cd-navbar-top');
+ });
+
+ it('sidebar should have no accessibility violations', () => {
+ cy.injectAxe();
+ cy.checkAccessibility('nav[id=sidebar]');
+ });
+});
login(): void;
logToConsole(message: string, optional?: any): void;
text(): Chainable<string>;
+ checkAccessibility(subject: any, axeOptions?: any, skip?: boolean): void;
}
}
}
/* tslint:disable*/
import { CdHelperClass } from '../../src/app/shared/classes/cd-helper.class';
import { Permissions } from '../../src/app/shared/models/permissions';
+import { table } from 'table';
/* tslint:enable*/
let auth: any;
Cypress.Commands.add('logToConsole', (message: string, optional?: any) => {
cy.task('log', { message: `(${new Date().toISOString()}) ${message}`, optional });
});
+
+// Print cypress-axe violations to the terminal
+function a11yErrorLogger(violations: any) {
+ const violationData = violations.flatMap(({ id, impact, description, nodes }: any) => {
+ return nodes.flatMap(({ html }: any) => {
+ return [
+ ['Test', Cypress.currentTest.title],
+ ['Error', id],
+ ['Impact', impact],
+ ['Description', description],
+ ['Element', html],
+ ['', '']
+ ];
+ });
+ });
+
+ cy.task('log', {
+ message: table(violationData, {
+ header: {
+ alignment: 'left',
+ content: Cypress.spec.relative
+ }
+ })
+ });
+}
+
+Cypress.Commands.add('checkAccessibility', (subject: any, axeOptions?: any, skip?: boolean) => {
+ cy.checkA11y(subject, axeOptions, a11yErrorLogger, skip);
+});
"dev": true
},
"axe-core": {
- "version": "4.4.2",
- "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.4.2.tgz",
- "integrity": "sha512-LVAaGp/wkkgYJcjmHsoKx4juT1aQvJyPcW09MLCjVTh3V2cc6PnyempiLMNH5iMdfIX/zdbjUx2KDjMLCTdPeA==",
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.4.3.tgz",
+ "integrity": "sha512-32+ub6kkdhhWick/UjvEwRchgoetXqTK14INLqbGm5U2TzBkBNF3nQtLYm8ovxSkQWArjEQvftCKryjZaATu3w==",
"dev": true
},
"axios": {
"@types/node": "12.12.62",
"@types/simplebar": "5.1.1",
"@types/swagger-ui": "3.52.0",
- "axe-core": "4.4.2",
+ "axe-core": "4.4.3",
"codelyzer": "6.0.2",
"cypress": "9.7.0",
"cypress-axe": "0.14.0",
"stylelint": "13.13.1",
"stylelint-config-sass-guidelines": "7.1.0",
"stylelint-declaration-use-variable": "1.7.3",
+ "table": "6.8.0",
"transifex-i18ntool": "1.1.0",
"ts-node": "9.0.0",
"tslint": "6.1.3",
blockHealthColor() {
if (this.summaryData && this.summaryData.rbd_mirroring) {
if (this.summaryData.rbd_mirroring.errors > 0) {
- return { color: '#d9534f' };
+ return { color: '#f4926c' };
} else if (this.summaryData.rbd_mirroring.warnings > 0) {
return { color: '#f0ad4e' };
}
name: Auth
- description: Cephfs Management API
name: Cephfs
-- description: Get Cluster Details
+- description: Get Ceph Users
name: Cluster
- description: Manage Cluster Configurations
name: ClusterConfiguration