component-driven / cypress-axe

Test accessibility with axe-core in Cypress
MIT License
622 stars 86 forks source link

TypeError: Cannot read property 'run' of undefined at Context.eval #154

Open afcbpeter1 opened 1 year ago

afcbpeter1 commented 1 year ago

Hi Im following the documentation and I want a test that runs wcag2a and 2aa issue only but im getting a read property error im not sure why.

`// Define at the top of the spec file or just import it
function terminalLog(violations) {
    cy.task(
      'log',
      `${violations.length} accessibility violation${
        violations.length === 1 ? '' : 's'
      } ${violations.length === 1 ? 'was' : 'were'} detected`
    )
    // pluck specific keys to keep the table readable
    const violationData = violations.map(
      ({ id, impact, description, nodes }) => ({
        id,
        impact,
        description,
        nodes: nodes.length
      })
    )

    cy.task('table', violationData)
  }

describe('Womens T20 Cricket Test',() => {
    it('Has no detectable a11y violations on load (with custom parameters)', () => {
        cy.visit('https://www.skysports.com');
        cy.iframe('#sp_message_iframe_758392').find('.sp_message-accept-button').should('be.visible').click()
        cy.checkA11y(null, null, terminalLog, {
          runOnly: {
            type: 'tag',
            values: ['wcag2a', 'wcag2aa', 'wcag2aaa']
          }
        })
      })
    });`