-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
132 changed files
with
11,721 additions
and
11,479 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import 'cypress-axe' | ||
|
||
context('Statistics Dashboard Accessibility', () => { | ||
|
||
const checkZone = (selector: string): void => { | ||
cy.get(selector).should('have.length', 1); | ||
cy.checkA11y(selector); | ||
}; | ||
|
||
const injectAxe = (): void => { | ||
// cy.injectAxe(); | ||
// cy.injectAxe is currently broken. https://github.com/component-driven/cypress-axe/issues/82 | ||
// (so use custom injection logic) | ||
|
||
cy.readFile('node_modules/axe-core/axe.min.js').then((source) => { | ||
return cy.window({ log: false }).then((window) => { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
(window as any).eval(source); | ||
}); | ||
}); | ||
}; | ||
|
||
beforeEach(() => { | ||
cy.server(); | ||
}); | ||
|
||
describe('Landing Page', () => { | ||
|
||
beforeEach(() => { | ||
cy.visit('/'); | ||
injectAxe(); | ||
}); | ||
|
||
it('Has an accessible header', () => { | ||
checkZone('header'); | ||
}); | ||
|
||
it('Has an accessible footer', () => { | ||
checkZone('footer'); | ||
}); | ||
|
||
it('Has an accessible main', () => { | ||
checkZone('main'); | ||
}); | ||
|
||
it('Has no detectable a11y violations ()', () => { | ||
cy.checkA11y(); | ||
}) | ||
}); | ||
|
||
describe('Data Page', () => { | ||
|
||
beforeEach(() => { | ||
cy.visit(`/data/contentTier`); | ||
injectAxe(); | ||
}); | ||
|
||
it('Has an accessible header', () => { | ||
checkZone('header'); | ||
}); | ||
|
||
it('Has an accessible footer', () => { | ||
checkZone('footer'); | ||
}); | ||
|
||
it('Has an accessible main', () => { | ||
checkZone('main'); | ||
}); | ||
|
||
it('Has no detectable a11y violations', () => { | ||
cy.checkA11y(); | ||
}) | ||
|
||
}); | ||
}); |
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,88 @@ | ||
context('Statistics Dashboard', () => { | ||
describe('App Routes', () => { | ||
const selCTZero = '#ctZero'; | ||
const selLinkDataContentTier = '[data-e2e=link-entry-ct]'; | ||
const selLinkHeader = '[data-e2e=link-home-header]'; | ||
const urlContentTier = '/data/contentTier'; | ||
const urlParamCTZero = 'content-tier-zero='; | ||
const urlParamCTZeroTrue = `?${urlParamCTZero}true`; | ||
|
||
const checkCTZeroChangesUrl = (): void => { | ||
cy.get(selCTZero).should('have.length', 1); | ||
cy.get(selCTZero).should('not.be.checked'); | ||
cy.url().should('not.contain', urlParamCTZero); | ||
|
||
cy.get(selCTZero).click({force: true}); | ||
cy.get(selCTZero).should('be.checked'); | ||
cy.url().should('contain', urlParamCTZero); | ||
}; | ||
|
||
it('the url should reflect content-tier-zero visibility (landing page)', () => { | ||
cy.visit('/'); | ||
checkCTZeroChangesUrl(); | ||
}); | ||
|
||
it('the url should reflect content-tier-zero visibility (data page)', () => { | ||
cy.visit(urlContentTier); | ||
checkCTZeroChangesUrl(); | ||
}); | ||
|
||
it('the content-tier-zero should be remembered between pages (click test)', () => { | ||
cy.visit('/'); | ||
cy.get(selCTZero).click({force: true}); | ||
cy.get(selCTZero).should('be.checked'); | ||
cy.url().should('contain', urlParamCTZero); | ||
|
||
const goBackAndForth = () => { | ||
cy.url().should('not.contain', '/data'); | ||
cy.get(selLinkDataContentTier).click({force: true}); | ||
|
||
cy.get(selCTZero).should('be.checked'); | ||
cy.url().should('contain', urlParamCTZero); | ||
|
||
cy.get(selLinkHeader).click({force: true}); | ||
|
||
cy.get(selCTZero).should('be.checked'); | ||
cy.url().should('contain', urlParamCTZero); | ||
}; | ||
goBackAndForth(); | ||
goBackAndForth(); | ||
}); | ||
|
||
it('the content-tier-zero should be remembered between pages (history test)', () => { | ||
|
||
const host = 'http://localhost:4280'; | ||
cy.visit('/') | ||
const expectedHistory = ['/', `/${urlParamCTZeroTrue}`, `${urlContentTier}${urlParamCTZeroTrue}`, `${urlContentTier}`, '/']; | ||
|
||
cy.location('search').should('equal', ''); | ||
cy.location('pathname').should('equal', '/'); | ||
cy.location('href').should('equal', `${host}${expectedHistory[0]}`); | ||
|
||
cy.get(selCTZero).click({force: true}); | ||
cy.location('href').should('equal', `${host}${expectedHistory[1]}`); | ||
|
||
cy.get(selLinkDataContentTier).click({force: true}); | ||
cy.location('href').should('equal', `${host}${expectedHistory[2]}`); | ||
|
||
cy.get(selCTZero).click({force: true}); | ||
cy.location('href').should('equal', `${host}${expectedHistory[3]}`); | ||
|
||
cy.get(selLinkHeader).click({force: true}); | ||
cy.location('href').should('equal', `${host}${expectedHistory[4]}`); | ||
|
||
// browser back | ||
for(let i = 0; i < expectedHistory.length -1; i++) { | ||
const historyIndex = expectedHistory.length - (i + 1); | ||
cy.location('href').should('equal', `${host}${expectedHistory[historyIndex]}`); | ||
cy.go('back'); | ||
} | ||
|
||
// browser forward | ||
for(let i = 0; i < expectedHistory.length -1; i++) { | ||
cy.location('href').should('equal', `${host}${expectedHistory[i]}`); | ||
cy.go('forward'); | ||
} | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.