You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This assertion is based on the [`jest-puppeteer-axe`](https://github.com/WordPress/gutenberg/tree/3b2eccc289cfc90bd99252b12fc4c6e470ce4c04/packages/jest-puppeteer-axe) package. (That package already works with Pleasantest, our new feature just formats error messages a little differently)
8
+
9
+
It allows you to pass a page to be checked with the [axe accessibility linter](https://github.com/dequelabs/axe-core).
@@ -830,6 +831,33 @@ Disabling these options can be used to reduce the output or to exclude text that
830
831
831
832
The returned `Promise` wraps an `AccessibilityTreeSnapshot`, which can be passed directly as the `expect` first parameter in `expect(___).toMatchInlineSnapshot()`. The returned object can also be converted to a string using `String(accessibilityTreeSnapshot)`.
This assertion, based on [`jest-puppeteer-axe`](https://github.com/WordPress/gutenberg/tree/3b2eccc289cfc90bd99252b12fc4c6e470ce4c04/packages/jest-puppeteer-axe), allows you to check a page using the [axe accessibility linter](https://github.com/dequelabs/axe-core).
837
+
838
+
To use this assertion, you **must install `@axe-core/puppeteer` and `axe-core`**. They are optional peer dependencies for Pleasantest, but are needed for the `toPassAxeTests` assertion.
839
+
840
+
```js
841
+
test(
842
+
'Axe tests',
843
+
withBrowser(async ({ utils, page }) => {
844
+
awaitutils.injectHTML(`
845
+
<h1>Some html</h1>
846
+
`);
847
+
848
+
awaitexpect(page).toPassAxeTests();
849
+
}),
850
+
);
851
+
```
852
+
853
+
`ToPassAxeTestsOpts` (all properties are optional):
854
+
855
+
-`include`: `string | string[]`: CSS selector(s) to add to the list of elements to include in analysis.
856
+
-`exclude`: `string | string[]`: CSS selector(s) to add to the list of elements to exclude from analysis.
857
+
-`disabledRules`: `string | string[]`: The list of [Axe rules](https://github.com/dequelabs/axe-core/tree/v4.4.2/lib/rules) to skip from verification.
858
+
-`options`: [`axe.RunOptions`](https://github.com/dequelabs/axe-core/blob/v4.4.2/axe.d.ts#L89): A flexible way to [configure how Axe run operates](https://github.com/dequelabs/axe-core/blob/HEAD/doc/API.md#options-parameter).
Pleasantest uses [Puppeteer](https://github.com/puppeteer/puppeteer) under the hood. You don't need to know how to use Puppeteer in order to use Pleasantest, but a little bit of Puppeteer knowledge might come in handy. Here are the parts of Puppeteer that are most helpful and relevant for Pleasantest:
0 commit comments