-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enterprise Search] Set up cypress-axe tests (#108465)
* Set up cypress-axe @see https://github.com/component-driven/cypress-axe * DRY out Kibana axe rules into constants that Cypress can use * Create shared & configured checkA11y command + fix string union type error + remove unnecessary tsconfig exclude * Add Overview plugin a11y tests * Add AS & WS placeholder a11y checks - Mostly just re-exporting the shared command and checking for failures, I only ran this after the shared axe config settings and found no failures * Configure our axe settings further to catch best practices - notably heading level issues (thanks Byron for catching this!) - however I now also need to set an ignore on a duplicate landmark violation caused by the global header (not sure why it's showing up - shouldn't it be out of context? bah) - remove option to pass args into checkA11y - I figure it's not super likely we'll need to override axe settings per-page (vs not running it), but we can pass it custom configs or args later if needed Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
04103e9
commit b27fb56
Showing
12 changed files
with
113 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { ReporterVersion } from 'axe-core'; | ||
|
||
export const AXE_CONFIG = { | ||
rules: [ | ||
{ | ||
id: 'scrollable-region-focusable', | ||
selector: '[data-skip-axe="scrollable-region-focusable"]', | ||
}, | ||
{ | ||
id: 'aria-required-children', | ||
selector: '[data-skip-axe="aria-required-children"] > *', | ||
}, | ||
{ | ||
id: 'label', | ||
selector: '[data-test-subj="comboBoxSearchInput"] *', | ||
}, | ||
{ | ||
id: 'aria-roles', | ||
selector: '[data-test-subj="comboBoxSearchInput"] *', | ||
}, | ||
{ | ||
// EUI bug: https://github.com/elastic/eui/issues/4474 | ||
id: 'aria-required-parent', | ||
selector: '[class=*"euiDataGridRowCell"][role="gridcell"]', | ||
}, | ||
{ | ||
// 3rd-party library; button has aria-describedby | ||
id: 'button-name', | ||
selector: '[data-rbd-drag-handle-draggable-id]', | ||
}, | ||
{ | ||
// EUI bug: https://github.com/elastic/eui/issues/4536 | ||
id: 'duplicate-id', | ||
selector: '.euiSuperDatePicker *', | ||
}, | ||
], | ||
}; | ||
|
||
export const AXE_OPTIONS = { | ||
reporter: 'v2' as ReporterVersion, | ||
runOnly: ['wcag2a', 'wcag2aa'], | ||
rules: { | ||
'color-contrast': { | ||
enabled: false, // disabled because we have too many failures | ||
}, | ||
bypass: { | ||
enabled: false, // disabled because it's too flaky | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
x-pack/plugins/enterprise_search/public/applications/shared/cypress/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
{ | ||
"extends": "../../../../../../../tsconfig.base.json", | ||
"references": [{ "path": "../../../../../../../test/tsconfig.json" }], | ||
"include": ["./**/*"], | ||
"compilerOptions": { | ||
"outDir": "../../../../target/cypress/types/shared", | ||
"types": ["cypress", "node"] | ||
"types": ["cypress", "cypress-axe", "node"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters