From 93bc54b3fc93e5b6d899f81f68fc9b7fcbef6e70 Mon Sep 17 00:00:00 2001 From: Nicolas Van Labeke Date: Wed, 17 Jul 2024 19:24:33 +0100 Subject: [PATCH] chore(24363): refactor violation callback --- .../cypress/support/commands/checkAccessibility.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hivemq-edge/src/frontend/cypress/support/commands/checkAccessibility.ts b/hivemq-edge/src/frontend/cypress/support/commands/checkAccessibility.ts index b78c2a292e..ca4766779e 100755 --- a/hivemq-edge/src/frontend/cypress/support/commands/checkAccessibility.ts +++ b/hivemq-edge/src/frontend/cypress/support/commands/checkAccessibility.ts @@ -2,10 +2,17 @@ import { ignoreGlobalRules } from '../a11y.ts' import * as axe from 'axe-core' import { Options } from 'cypress-axe' +const violationCallback = (violations: axe.Result[]) => { + for (const violation of violations) { + for (const node of violation.nodes) { + cy.log(violation.id, node.target, node.html) + } + } +} + export const checkAccessibility = ( context?: string | Node | axe.ContextObject | undefined, options?: Options | undefined, - violationCallback?: ((violations: axe.Result[]) => void) | undefined, skipFailures?: boolean ): void => { const { rules, ...rest } = options || {}