I am using cypress-io and cypress-axe to run browser tests and check if a page has accessibility violations.
I have this task:
function reportA11yViolations(violations: Result[]) {
const errors: string[] = [];
violations.forEach((v: Result) => v.nodes.forEach((node: NodeResult) => {
errors.push(node.failureSummary);
}));
cy.log(errors.join("\n"));
}
Cypress.Commands.add("checkA11yAndReportViolations", (context, options) => {
cy.checkA11y(context, options, reportA11yViolations);
});
I can see all the browser log messages when running through the nice browser app.
But what about when I am running in headless in the ci environment?
Is there anyway I can display these errors anywhere or write them to a file?