axe-playwright 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/index.js +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
# Axe-Playwright
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+

|
|
6
|
+

|
|
6
7
|
[](https://www.npmjs.com/package/axe-playwright)
|
|
7
8
|
[](https://www.npmjs.com/package/axe-playwright)
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Axe-core® is a powerful accessibility testing engine provided by Deque Systems that powers this package. Axe-Playwright provides simple commands to integrate the axe-core® library with your [Playwright](https://www.npmjs.com/package/playwright) tests. This integration functions seamlessly across all Playwright browsers: Chromium, Firefox, and WebKit.
|
|
11
|
+
|
|
12
|
+
Axe-core® is a trademark of [Deque Systems, Inc.](https://www.deque.com/) in the US and other countries. This project is not formally affiliated with Deque, but we are big fans! Axe-core® is used here with permission.
|
|
10
13
|
|
|
11
14
|
## Install and configure
|
|
12
15
|
|
|
@@ -22,7 +25,7 @@ npm i -D axe-playwright
|
|
|
22
25
|
npm i -D playwright
|
|
23
26
|
```
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
NOTE: axe-core® is now bundled and doesn't need to be installed separately.
|
|
26
29
|
|
|
27
30
|
### Add Typings
|
|
28
31
|
|
|
@@ -39,7 +42,7 @@ npm i -D playwright
|
|
|
39
42
|
|
|
40
43
|
### injectAxe
|
|
41
44
|
|
|
42
|
-
This will inject the
|
|
45
|
+
This will inject the axe-core® runtime into the page under test. You must run this after a call to page.goto() and before you run the checkA11y command.
|
|
43
46
|
|
|
44
47
|
You run this command with `injectAxe()` either in your test, or in a `beforeEach`, as long as the `visit` comes first.
|
|
45
48
|
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,9 @@ const path = __importStar(require("path"));
|
|
|
49
49
|
* @param page
|
|
50
50
|
*/
|
|
51
51
|
const injectAxe = (page) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
-
const axe = fs.readFileSync(require.resolve('axe-core/axe.min.js'),
|
|
52
|
+
const axe = fs.readFileSync(require.resolve('axe-core/axe.min.js'), {
|
|
53
|
+
encoding: 'utf8',
|
|
54
|
+
});
|
|
53
55
|
yield page.evaluate((axe) => window.eval(axe), axe);
|
|
54
56
|
});
|
|
55
57
|
exports.injectAxe = injectAxe;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "axe-playwright",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Custom Playwright commands to inject axe-core and test for a11y",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"jest": "^28.1.3",
|
|
35
35
|
"jest-each": "^28.1.3",
|
|
36
36
|
"jest-playwright-preset": "^2.0.0",
|
|
37
|
-
"playwright": "^1.
|
|
37
|
+
"playwright": "^1.45.0",
|
|
38
38
|
"prettier": "^2.7.1",
|
|
39
39
|
"ts-jest": "^28.0.8",
|
|
40
40
|
"typescript": "^4.8.4"
|