@netsells/cypress-commands
v2.0.3
Published
Common CypressIO commands in Netsells projects
Downloads
3
Keywords
Readme
Cypress Commands
Useful commands for testing accessibility issues in Cypress
Installation
yarn add --dev @netsells/cypress-commands
Setup
In support/commands.js
:
const { loadAccessibilityCommands } = require('@netsells/cypress-commands');
loadAccessibilityCommands();
In plugins/index.js
:
const { loadAccessibilityPlugins } = require('@netsells/cypress-commands');
module.exports = (on, config) => {
loadAccessibilityPlugins(on, config);
}
Usage
checkAccessibility
Assert a pages HTML is accessible using the PayPal AATT
// visit a page
cy.visit('/page');
// assert the page has finished loading
cy.contains('Page Title').should('be.visible');
// assert its accessibility
cy.checkAccessibility();
field
Get a field by via its label
cy.field('Password', field => field.type('Password'));
createAccessiblityTests
Use this to easily generate lots of accessibility tests for multiple URLs.
import { createAccessiblityTests } from '@netsells/cypress-commands';
createAccessiblityTests('/', 'gift-cards', 'login');