Skip to content

Commit

Permalink
add custom command
Browse files Browse the repository at this point in the history
  • Loading branch information
Tishasoumya-02 committed Jan 22, 2025
1 parent 5c88b0b commit b710a8a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/volto/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -967,3 +967,25 @@ Cypress.Commands.add('queryCounter', (path, steps, number = 1) => {

cy.get('@counterName').its('callCount').should('equal', number);
});

// Print cypress-axe violations to the terminal
function printAccessibilityViolations(violations) {
cy.task(
'table',
violations.map(({ id, impact, description, nodes }) => ({
impact,
description: `${description} (${id})`,
nodes: nodes.length,
})),
);
}

Cypress.Commands.add(
'checkAccessibility',
(subject, { skipFailures = false } = {}) => {
cy.checkA11y(subject, null, printAccessibilityViolations, skipFailures);
},
{
prevSubject: 'optional',
},
);
1 change: 1 addition & 0 deletions packages/volto/news/6606.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat(cypress):Add custom check Accessibility command @Tishasoumya-02

0 comments on commit b710a8a

Please sign in to comment.