component-driven / component-driven/cypress-axe

how to config checkA11y for all tests

Open
#156 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
641
Forks
90
Avg merge
6h 8m
Merged PRs (30d)
1

Description

I have a series of specs for different sections and modules of my app. I would like to configure checkA11y in one location for all specs.

This works within each test

cy.checkA11y(null, {
    rules: {
		'color-contrast': { enabled: false },
		'frame-title': { enabled: false },
		},
});

I tried to set the configuration in support/index.js but I get an error

beforeEach(function () {
	// runs before each test in the block
	cy.visit('/')
	cy.injectAxe()
	cy.configureAxe({
		rules: {
			'color-contrast': { enabled: false },
			'frame-title': { enabled: false },
		},
	})
});

I am unsure where to set this up correctly.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the support/index.js setup shown in the issue and compare it with the per-test cy.checkA11y, cy.injectAxe, and cy.configureAxe calls. Document the correct shared configuration location and verify that the disabled color-contrast and frame-title rules apply across the specs.

Written by the indexing model from the issue text.

Assessment

Tech stack
cypress, typescript
Domain
testing-qa
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.