Skip to content

Commit

Permalink
Build out more tests to cover a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
nwmac committed Jan 10, 2025
1 parent b7a1746 commit 6f98296
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 25 deletions.
4 changes: 4 additions & 0 deletions cypress/e2e/po/pages/account-api-keys.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export default class AccountPagePo extends PagePo {
return this.applyButton().click();
}

cancel(): Cypress.Chainable {
return this.self().get('button[type="reset"]').click();
}

currentPassword(): PasswordPo {
return new PasswordPo('[data-testid="account__current_password"]');
}
Expand Down
25 changes: 0 additions & 25 deletions cypress/e2e/tests/accessibility/login.spec.ts

This file was deleted.

95 changes: 95 additions & 0 deletions cypress/e2e/tests/accessibility/shell.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { LoginPagePo } from '@/cypress/e2e/po/pages/login-page.po';
import HomePagePo from '@/cypress/e2e/po/pages/home.po';
import AboutPagePo from '@/cypress/e2e/po/pages/about.po';
import PreferencesPagePo from '@/cypress/e2e/po/pages/preferences.po';
import UserMenuPo from '@/cypress/e2e/po/side-bars/user-menu.po';
import AccountPagePo from '@/cypress/e2e/po/pages/account-api-keys.po';
import CreateKeyPagePo from '@/cypress/e2e/po/pages/account-api-keys-create_key.po';

describe('Shell a11y testing', { tags: ['@adminUser', '@accessibility'] }, () => {
it('login page', () => {
const loginPage = new LoginPagePo();

loginPage.goTo();
loginPage.waitForPage();
cy.injectAxe();
loginPage.username().set('test user');

cy.checkPageAccessibility();
});

it('locale selector', () => {
const loginPage = new LoginPagePo();

loginPage.goTo();
loginPage.waitForPage();
cy.injectAxe();
cy.get('[data-testid="locale-selector"]').click();
cy.checkPageAccessibility();
});

describe('Logged in', { testIsolation: 'off' }, () => {
const aboutPage = new AboutPagePo();
const prefPage = new PreferencesPagePo();
const userMenu = new UserMenuPo();

before(() => {
cy.login();
});

it('home page', () => {
HomePagePo.goToAndWaitForGet();
cy.injectAxe();

cy.checkPageAccessibility();
});

it('about page', () => {
AboutPagePo.navTo();
aboutPage.waitForPage();

cy.checkPageAccessibility();
});

it('preferences page', () => {
userMenu.clickMenuItem('Preferences');
userMenu.isClosed();
prefPage.waitForPage();
prefPage.checkIsCurrentPage();
prefPage.title();
cy.injectAxe();

cy.checkPageAccessibility();
});

describe('account', () => {
const accountPage = new AccountPagePo();
const createKeyPage = new CreateKeyPagePo();

it('account page', () => {
userMenu.clickMenuItem('Account & API Keys');
accountPage.waitForPage();
cy.injectAxe();
accountPage.checkIsCurrentPage();

cy.checkPageAccessibility();
});

it('change password dialog', () => {
accountPage.changePassword();

cy.checkElementAccessibility('.change-password-modal');

accountPage.cancel();
});

it('create API key', () => {
accountPage.create();
createKeyPage.waitForPage();
createKeyPage.isCurrentPage();

cy.checkPageAccessibility();
});
});
});
});

0 comments on commit 6f98296

Please sign in to comment.