6.24.0 • Published 13 days ago

@wordpress/jest-puppeteer-axe v6.24.0

Weekly downloads
58,279
License
GPL-2.0-or-later
Repository
github
Last release
13 days ago

Jest Puppeteer Axe

Axe (the Accessibility Engine) API integration with Jest and Puppeteer.

Defines Jest async matcher to check whether a given Puppeteer's page instance passes Axe accessibility tests.

Installation

Install the module

npm install @wordpress/jest-puppeteer-axe --save-dev

Note: This package requires Node.js 14.0.0 or later. It is not compatible with older versions.

Setup

The simplest setup is to use Jest's setupFilesAfterEnv config option:

"jest": {
  "setupFilesAfterEnv": [
    "@wordpress/jest-puppeteer-axe"
  ]
},

Usage

In your Jest test suite add the following code to the test's body:

test( 'checks the test page with Axe', async () => {
	// First, run some code which loads the content of the page.
	loadTestPage();

	await expect( page ).toPassAxeTests();
} );

It is also possible to pass optional params which allow Axe API to perform customized checks:

  • include - CSS selector(s) to add the list of elements to include in analysis.
  • exclude - CSS selector(s) to add the list of elements to exclude from analysis.
  • disabledRules - the list of Axe rules to skip from verification.
  • options - a flexible way to configure how Axe run operates. See axe-core API documentation for information on the object structure.
  • config - Axe configuration object. See axe-core API documentation for documentation on the object structure.
test( 'checks the test component with Axe excluding some button', async () => {
	// First, run some code which loads the content of the page.
	loadPageWithTestComponent();

	await expect( page ).toPassAxeTests( {
		include: '.test-component',
		exclude: '.some-button',
		disabledRules: [ 'aria-allowed-role' ],
		options: { iframes: false },
		config: { reporter: 'raw' },
	} );
} );

Contributing to this package

This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to npm and used by WordPress as well as other software projects.

To find out more about contributing to this package or Gutenberg as a whole, please read the project's main contributor guide.

6.24.0

13 days ago

6.23.0

26 days ago

6.22.1

28 days ago

6.22.0

1 month ago

6.21.0

2 months ago

6.20.0

2 months ago

6.19.0

3 months ago

6.13.13

4 months ago

6.13.11

5 months ago

6.13.12

4 months ago

6.13.10

5 months ago

6.13.7

5 months ago

6.13.6

5 months ago

6.17.0

4 months ago

6.13.5

5 months ago

6.13.4

5 months ago

6.13.9

5 months ago

6.13.8

5 months ago

6.11.1

7 months ago

6.11.0

7 months ago

6.13.3

6 months ago

6.15.0

5 months ago

6.13.2

6 months ago

6.13.1

6 months ago

6.13.0

6 months ago

6.6.2

5 months ago

6.8.0

9 months ago

6.18.0

4 months ago

6.12.0

7 months ago

6.10.0

7 months ago

6.16.0

5 months ago

6.14.0

6 months ago

6.9.0

8 months ago

5.9.2

5 months ago

6.5.0

10 months ago

6.6.1

9 months ago

6.6.0

10 months ago

6.4.0

10 months ago

6.7.0

9 months ago

6.1.0

12 months ago

6.3.0

11 months ago

5.11.0

1 year ago

6.0.0

1 year ago

6.2.0

11 months ago

5.5.0

1 year ago

5.3.0

1 year ago

5.1.0

1 year ago

4.0.3

2 years ago

4.0.2

2 years ago

5.8.0

1 year ago

5.6.0

1 year ago

5.4.0

1 year ago

5.2.0

1 year ago

5.0.1

1 year ago

5.0.0

2 years ago

5.10.0

1 year ago

4.1.0

2 years ago

5.9.1

1 year ago

5.9.0

1 year ago

5.7.0

1 year ago

3.1.1

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

3.1.0

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

3.0.0-next.0

3 years ago

2.0.0

3 years ago

1.10.0

3 years ago

1.9.0

4 years ago

1.8.1-rc.0

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago