val-a11y
Version:
Cypress plugin to perform configurable accessibility tests using AXE. It provides a list of violations and detailed information in the Cypress log, and generates an HTML document that includes screenshots of each violation on the page. The plugin leverage
25 lines (19 loc) • 945 B
JavaScript
// Import Accessibility Plugin
import '../../src/accessibility-commands.js'
it('Check accessibility google.com web site', { defaultCommandTimeout: 15000 }, () => {
cy.visit('https://www.google.com')
cy.wait(2000) // Using cy.wait(TIME) is a very bad practice, but it is used for simplicity in this example
cy.checkAccessibility(null, { skipFailures: true })
})
it('Example of passing test in the second attempt', () => {
if (Cypress.currentRetry === 1) {
expect(true).to.be.true
} else {
expect(true).to.be.false
}
})
it('Check accessibility Parabank web site', { defaultCommandTimeout: 15000 }, () => {
cy.visit('https://parabank.parasoft.com/parabank/index.htm')
cy.wait(2000) // Using cy.wait(TIME) is a very bad practice, but it is used for simplicity in this example
cy.checkAccessibility(null, { includedImpacts: ['critical', 'serious', 'moderate', 'minor'], skipFailures: true })
})