Skip to content

Commit

Permalink
Bug 1897008: Cypress: reenable check for 'aria-hidden-focus' rule & c…
Browse files Browse the repository at this point in the history
…heckA11y test for modals
  • Loading branch information
dtaylor113 committed Dec 1, 2020
1 parent 7dbefdf commit 6163bec
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
7 changes: 3 additions & 4 deletions frontend/packages/integration-tests-cypress/support/a11y.ts
Expand Up @@ -6,7 +6,7 @@ declare global {
namespace Cypress {
interface Chainable<Subject> {
logA11yViolations(violations: Result[], target: string): Chainable<Element>;
testA11y(target: string): Chainable<Element>;
testA11y(target: string, selector?: string): Chainable<Element>;
}
}
}
Expand Down Expand Up @@ -34,19 +34,18 @@ Cypress.Commands.add('logA11yViolations', (violations: Result[], target: string)
cy.task('logTable', violationData);
});

Cypress.Commands.add('testA11y', (target: string) => {
Cypress.Commands.add('testA11y', (target: string, selector?: string) => {
cy.injectAxe();
cy.configureAxe({
rules: [
{ id: 'color-contrast', enabled: false }, // seem to be somewhat inaccurate and has difficulty always picking up the correct colors, tons of open issues for it on axe-core
{ id: 'focusable-content', enabled: false }, // recently updated and need to give the PF team time to fix issues before enabling
{ id: 'scrollable-region-focusable', enabled: false }, // recently updated and need to give the PF team time to fix issues before enabling
{ id: 'aria-hidden-focus', enabled: false }, // disabling until we implement correct handling of Modals, see https://dequeuniversity.com/rules/axe/3.4/aria-hidden-focus?application=axeAPI
],
});
a11yTestResults.numberChecks += 1;
cy.checkA11y(
null,
selector || null,
{
includedImpacts: ['serious', 'critical'],
},
Expand Down
Expand Up @@ -22,8 +22,7 @@ Cypress.Commands.add('createProject', (name: string, devConsole: boolean = false
listPage.clickCreateYAMLbutton();
modal.shouldBeOpened();
cy.byTestID('input-name').type(name);
// TODO: uncomment once https://bugzilla.redhat.com/show_bug.cgi?id=1897008 is fixed
// cy.testA11y('Create Project modal');
cy.testA11y('Create Project modal', '#modal-container');
modal.submit();
modal.shouldBeClosed();
// TODO, switch to 'listPage.titleShouldHaveText(name)', when we switch to new test id
Expand All @@ -40,8 +39,7 @@ Cypress.Commands.add('deleteProject', (name: string) => {
modal.submitShouldBeDisabled();
cy.byTestID('project-name-input').type(name);
modal.submitShouldBeEnabled();
// TODO: uncomment once https://bugzilla.redhat.com/show_bug.cgi?id=1897008 is fixed
// cy.testA11y('Delete Project modal');
cy.testA11y('Delete Project modal', '#modal-container');
modal.submit();
modal.shouldBeClosed();
listPage.titleShouldHaveText('Projects');
Expand Down
Expand Up @@ -31,7 +31,7 @@ describe('Namespace', () => {
listPage.clickCreateYAMLbutton();
modal.shouldBeOpened();
cy.byTestID('input-name').type(newName);
cy.testA11y('Create Namespace modal');
cy.testA11y('Create Namespace modal', '#modal-container');
modal.submit();
modal.shouldBeClosed();
cy.url().should('include', `/k8s/cluster/namespaces/${newName}`);
Expand All @@ -43,7 +43,7 @@ describe('Namespace', () => {
listPage.rows.clickKebabAction(newName, 'Delete Namespace');
modal.shouldBeOpened();
cy.byTestID('project-name-input').type(newName);
cy.testA11y('Delete Namespace modal');
cy.testA11y('Delete Namespace modal', '#modal-container');
modal.submit();
modal.shouldBeClosed();
cy.resourceShouldBeDeleted(testName, 'namespaces', newName);
Expand Down
Expand Up @@ -148,7 +148,7 @@ xdescribe('Monitoring: Alerts', () => {
cy.log('expires the Silence');
detailsPage.clickPageActionFromDropdown('Expire Silence');
modal.shouldBeOpened();
cy.testA11y('Expire Silence modal');
cy.testA11y('Expire Silence modal', '#modal-container');
modal.submit();
modal.shouldBeClosed();
cy.get(errorMessage).should('not.exist');
Expand Down

0 comments on commit 6163bec

Please sign in to comment.