@axe-core/watcher 3.7.0 → 3.8.0-next.066c5223
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 +13 -2
- package/dist/Controller.js +69 -86
- package/dist/Controller.js.map +1 -1
- package/dist/EventForwarder.js +3 -12
- package/dist/EventForwarder.js.map +1 -1
- package/dist/cypress.js +16 -28
- package/dist/cypress.js.map +1 -1
- package/dist/cypressCommands.d.ts +32 -2
- package/dist/cypressCommands.js +30 -12
- package/dist/cypressCommands.js.map +1 -1
- package/dist/playwright.js +10 -28
- package/dist/playwright.js.map +1 -1
- package/dist/playwrightTest.js +15 -35
- package/dist/playwrightTest.js.map +1 -1
- package/dist/playwrightWrapping.js +89 -98
- package/dist/playwrightWrapping.js.map +1 -1
- package/dist/puppeteer.d.ts +1 -1
- package/dist/puppeteer.js +19 -30
- package/dist/puppeteer.js.map +1 -1
- package/dist/puppeteerWrapping.js +97 -95
- package/dist/puppeteerWrapping.js.map +1 -1
- package/dist/sendResultsToServer.js +12 -17
- package/dist/sendResultsToServer.js.map +1 -1
- package/dist/util.d.ts +2 -1
- package/dist/util.js +28 -16
- package/dist/util.js.map +1 -1
- package/dist/wdio.js +26 -40
- package/dist/wdio.js.map +1 -1
- package/dist/webdriver.js +4 -15
- package/dist/webdriver.js.map +1 -1
- package/dist/webdriverWrapping.js +32 -41
- package/dist/webdriverWrapping.js.map +1 -1
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/extension/content.js.LICENSE.txt +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
# @axe-core/watcher
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Watcher automatically:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
1. Adds accessibility scans to your end-to-end tests. Change a few lines of configuration code and you're ready to go.
|
|
6
|
+
2. Sends results to [axe Developer Hub](https://docs.deque.com/developer-hub).
|
|
7
|
+
|
|
8
|
+
From axe Developer Hub, software teams can get actionable reports. The reports are amazing because:
|
|
9
|
+
|
|
10
|
+
1. Accessibility issues are deduplicated!
|
|
11
|
+
2. Reports are "git aware", making it easy to spot new issues caused by your code changes. No more wading through technical debt.
|
|
12
|
+
3. Issues are prioritized by impact, helping you focus on the most important issues first.
|
|
13
|
+
|
|
14
|
+
Cypress, Playwright, Puppeteer, and Webdriver frameworks are all supported. Test results can be integrated with [GitHub Actions](https://docs.deque.com/developer-hub/2/en/dh-github-action) and a REST endpoint is provided so that other CI/CD systems are easy to setup.
|
|
15
|
+
|
|
16
|
+
Deque Systems has a [free and paid plan](https://www.deque.com/axe/developer-hub/) available, making axe Developer Hub suitable for all types of projects - open-source to enterprise.
|
|
6
17
|
|
|
7
18
|
For support on axe-core, watcher, and accessibility in general, please join the [axe community Slack](https://accessibility.deque.com/axe-community).
|
package/dist/Controller.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -18,94 +9,86 @@ class Controller {
|
|
|
18
9
|
constructor() {
|
|
19
10
|
this.isStopped = false;
|
|
20
11
|
}
|
|
21
|
-
start() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
window.dispatchEvent(event);
|
|
37
|
-
});
|
|
12
|
+
async start() {
|
|
13
|
+
(0, util_1.updateAutoAnalyze)(true);
|
|
14
|
+
this.isStopped = false;
|
|
15
|
+
await this.executeScript(() => {
|
|
16
|
+
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) {
|
|
17
|
+
return Promise.resolve();
|
|
18
|
+
}
|
|
19
|
+
return new Promise(resolve => {
|
|
20
|
+
const fn = () => {
|
|
21
|
+
window.removeEventListener('axe:start-auto-mode-done', fn);
|
|
22
|
+
resolve();
|
|
23
|
+
};
|
|
24
|
+
window.addEventListener('axe:start-auto-mode-done', fn);
|
|
25
|
+
const event = new CustomEvent('axe:start-auto-mode');
|
|
26
|
+
window.dispatchEvent(event);
|
|
38
27
|
});
|
|
39
28
|
});
|
|
40
29
|
}
|
|
41
|
-
stop() {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
window.dispatchEvent(event);
|
|
57
|
-
});
|
|
30
|
+
async stop() {
|
|
31
|
+
(0, util_1.updateAutoAnalyze)(false);
|
|
32
|
+
this.isStopped = true;
|
|
33
|
+
await this.executeScript(() => {
|
|
34
|
+
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) {
|
|
35
|
+
return Promise.resolve();
|
|
36
|
+
}
|
|
37
|
+
return new Promise(resolve => {
|
|
38
|
+
const fn = () => {
|
|
39
|
+
window.removeEventListener('axe:stop-auto-mode-done', fn);
|
|
40
|
+
resolve();
|
|
41
|
+
};
|
|
42
|
+
window.addEventListener('axe:stop-auto-mode-done', fn);
|
|
43
|
+
const event = new CustomEvent('axe:stop-auto-mode');
|
|
44
|
+
window.dispatchEvent(event);
|
|
58
45
|
});
|
|
59
46
|
});
|
|
60
47
|
}
|
|
61
|
-
analyze({ __UserRequestedAnalyze = true } = {}) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
async analyze({ __UserRequestedAnalyze = true } = {}) {
|
|
49
|
+
// If the user didn't request an analyze, and we're in manual mode, don't do anything.
|
|
50
|
+
if (this.isStopped && !__UserRequestedAnalyze) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
await this.executeScript((userRequestedAnalyze) => {
|
|
54
|
+
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) {
|
|
55
|
+
return Promise.resolve();
|
|
66
56
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
};
|
|
76
|
-
window.addEventListener('axe:manual-mode-analyze-done', fn);
|
|
77
|
-
const event = new CustomEvent('axe:manual-mode-analyze', {
|
|
78
|
-
detail: { userRequestedAnalyze }
|
|
79
|
-
});
|
|
80
|
-
window.dispatchEvent(event);
|
|
57
|
+
return new Promise(resolve => {
|
|
58
|
+
const fn = () => {
|
|
59
|
+
window.removeEventListener('axe:manual-mode-analyze-done', fn);
|
|
60
|
+
resolve();
|
|
61
|
+
};
|
|
62
|
+
window.addEventListener('axe:manual-mode-analyze-done', fn);
|
|
63
|
+
const event = new CustomEvent('axe:manual-mode-analyze', {
|
|
64
|
+
detail: { userRequestedAnalyze }
|
|
81
65
|
});
|
|
82
|
-
|
|
83
|
-
|
|
66
|
+
window.dispatchEvent(event);
|
|
67
|
+
});
|
|
68
|
+
}, __UserRequestedAnalyze);
|
|
84
69
|
}
|
|
85
|
-
flush() {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
window.dispatchEvent(event);
|
|
105
|
-
});
|
|
70
|
+
async flush() {
|
|
71
|
+
const results = await this.executeScript(() => {
|
|
72
|
+
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) {
|
|
73
|
+
return Promise.resolve([]);
|
|
74
|
+
}
|
|
75
|
+
return new Promise(resolve => {
|
|
76
|
+
const receivedResults = [];
|
|
77
|
+
const onFlushEnd = () => {
|
|
78
|
+
window.removeEventListener('axe:flush-end', onFlushEnd);
|
|
79
|
+
window.removeEventListener('axe:result', onAxeResult);
|
|
80
|
+
resolve(receivedResults);
|
|
81
|
+
};
|
|
82
|
+
const onAxeResult = (e) => {
|
|
83
|
+
receivedResults.push(...e.detail);
|
|
84
|
+
};
|
|
85
|
+
window.addEventListener('axe:result', onAxeResult);
|
|
86
|
+
window.addEventListener('axe:flush-end', onFlushEnd);
|
|
87
|
+
const event = new CustomEvent('axe:flush-start');
|
|
88
|
+
window.dispatchEvent(event);
|
|
106
89
|
});
|
|
107
|
-
yield (0, sendResultsToServer_1.default)(results);
|
|
108
90
|
});
|
|
91
|
+
await (0, sendResultsToServer_1.default)(results);
|
|
109
92
|
}
|
|
110
93
|
}
|
|
111
94
|
exports.default = Controller;
|
package/dist/Controller.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Controller.js","sourceRoot":"","sources":["../src/Controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Controller.js","sourceRoot":"","sources":["../src/Controller.ts"],"names":[],"mappings":";;;;;AAAA,iCAA0C;AAC1C,gFAAwE;AAExE,MAAe,UAAU;IAAzB;QAMY,cAAS,GAAG,KAAK,CAAA;IAkG7B,CAAC;IAh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this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -44,11 +35,11 @@ class EventForwarder {
|
|
|
44
35
|
}
|
|
45
36
|
else {
|
|
46
37
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
47
|
-
on(event, (...args) =>
|
|
38
|
+
on(event, async (...args) => {
|
|
48
39
|
for (const listener of this.emitter.listeners(event)) {
|
|
49
|
-
|
|
40
|
+
await listener(...args);
|
|
50
41
|
}
|
|
51
|
-
})
|
|
42
|
+
});
|
|
52
43
|
}
|
|
53
44
|
}
|
|
54
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventForwarder.js","sourceRoot":"","sources":["../src/EventForwarder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EventForwarder.js","sourceRoot":"","sources":["../src/EventForwarder.ts"],"names":[],"mappings":";;;;;AAYA,kEAAwC;AAExC,MAAM,cAAc;IAKlB;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,uBAAY,EAAE,CAAA;QACjC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;QACf,IAAI,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,EAAQ,EAAE;YAC7B,IAAI,MAAM,KAAK,MAAM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 -1,24 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
@@ -34,10 +14,12 @@ const EventForwarder_1 = __importDefault(require("./EventForwarder"));
|
|
|
34
14
|
* @param config Cypress config to extend
|
|
35
15
|
*/
|
|
36
16
|
const cypressConfig = (config) => {
|
|
37
|
-
const { axe
|
|
38
|
-
(0, util_1.writeVariables)(
|
|
17
|
+
const { axe, ...userConfig } = config;
|
|
18
|
+
(0, util_1.writeVariables)({
|
|
19
|
+
...axe,
|
|
39
20
|
// Let the extension know to check for Cypress frames.
|
|
40
|
-
cypress: true
|
|
21
|
+
cypress: true
|
|
22
|
+
});
|
|
41
23
|
(0, util_1.writeManifest)({
|
|
42
24
|
all_frames: true,
|
|
43
25
|
exclude_globs: [
|
|
@@ -47,7 +29,11 @@ const cypressConfig = (config) => {
|
|
|
47
29
|
'*/__cypress/iframes/*'
|
|
48
30
|
]
|
|
49
31
|
});
|
|
50
|
-
return
|
|
32
|
+
return {
|
|
33
|
+
...userConfig,
|
|
34
|
+
e2e: {
|
|
35
|
+
...userConfig.e2e,
|
|
36
|
+
setupNodeEvents(cypressOn, ...args) {
|
|
51
37
|
var _a, _b;
|
|
52
38
|
/**
|
|
53
39
|
* If the user supplies `setupNodeEvents` config and registers events using `on` handler
|
|
@@ -89,7 +75,7 @@ const cypressConfig = (config) => {
|
|
|
89
75
|
return launchOptions;
|
|
90
76
|
});
|
|
91
77
|
// Read the results sent from the extension, then forward to the server.
|
|
92
|
-
on('after:run', () =>
|
|
78
|
+
on('after:run', async () => {
|
|
93
79
|
let results;
|
|
94
80
|
try {
|
|
95
81
|
results = fs_1.default
|
|
@@ -107,16 +93,18 @@ const cypressConfig = (config) => {
|
|
|
107
93
|
for (const result of results) {
|
|
108
94
|
const data = fs_1.default.readFileSync(`cypress/axe-watcher/${result}`, 'utf8');
|
|
109
95
|
const parsed = JSON.parse(data);
|
|
110
|
-
|
|
96
|
+
await (0, sendResultsToServer_1.default)(parsed);
|
|
111
97
|
fs_1.default.unlinkSync(`cypress/axe-watcher/${result}`);
|
|
112
98
|
}
|
|
113
|
-
})
|
|
99
|
+
});
|
|
114
100
|
/**
|
|
115
101
|
* Forward the accumulated events to cypress.
|
|
116
102
|
* For more information, see commnet on #44
|
|
117
103
|
*/
|
|
118
104
|
eventForwarder.forward(cypressOn);
|
|
119
|
-
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
120
108
|
};
|
|
121
109
|
exports.cypressConfig = cypressConfig;
|
|
122
110
|
//# sourceMappingURL=cypress.js.map
|
package/dist/cypress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress.js","sourceRoot":"","sources":["../src/cypress.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cypress.js","sourceRoot":"","sources":["../src/cypress.ts"],"names":[],"mappings":";;;;;;AACA,4CAAmB;AACnB,iCAMe;AACf,gFAAuD;AACvD,sEAA6C;AAE7C;;;;GAIG;AAEI,MAAM,aAAa,GAAG,CAC3B,MAA6C,EACtB,EAAE;IACzB,MAAM,EAAE,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAErC,IAAA,qBAAc,EAAC;QACb,GAAG,GAAG;QACN,sDAAsD;QACtD,OAAO,EAAE,IAAI;KACd,CAAC,CAAA;IACF,IAAA,oBAAa,EAAC;QACZ,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE;YACb,0BAA0B;YAC1B,4BAA4B;YAC5B,4BAA4B;YAC5B,uBAAuB;SACxB;KACF,CAAC,CAAA;IAEF,OAAO;QACL,GAAG,UAAU;QACb,GAAG,EAAE;YACH,GAAG,UAAU,CAAC,GAAG;YACjB,eAAe,CAAC,SAAS,EAAE,GAAG,IAAI;;gBAChC;;;;;;;;;;mBAUG;gBACH,MAAM,cAAc,GAAG,IAAI,wBAAc,EAAE,CAAA;gBAC3C,MAAM,EAAE,GAAG,cAAc,CAAC,EAAE,CAAA;gBAE5B,MAAA,MAAA,UAAU,CAAC,GAAG,0CAAE,eAAe,mDAAG,EAAE,EAAE,GAAG,IAAI,CAAC,CAAA;gBAE9C,EAAE,CAAC,uBAAuB,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE;oBACrD,0BAA0B;oBAC1B,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;wBAC9B,IACE,OAAO,CAAC,UAAU;4BAClB,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EACzC,CAAC;4BACD,MAA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rC,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,+DAA+D;wBAC/D,4BAA4B;wBAC5B,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;4BACvD,OAAM;wBACR,CAAC;wBACD,MAAM,KAAK,CAAA;oBACb,CAAC;oBAED,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;wBAC7B,MAAM,IAAI,GAAG,YAAE,CAAC,YAAY,CAC1B,uBAAuB,MAAM,EAAE,EAC/B,MAAM,CACP,CAAA;wBACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;wBAC/B,MAAM,IAAA,6BAAmB,EAAC,MAAM,CAAC,CAAA;wBACjC,YAAE,CAAC,UAAU,CAAC,uBAAuB,MAAM,EAAE,CAAC,CAAA;oBAChD,CAAC;gBACH,CAAC,CAAC,CAAA;gBAEF;;;mBAGG;gBACH,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;YACnC,CAAC;SACF;KACF,CAAA;AACH,CAAC,CAAA;AAlHY,QAAA,aAAa,iBAkHzB"}
|
|
@@ -3,14 +3,44 @@ declare global {
|
|
|
3
3
|
namespace Cypress {
|
|
4
4
|
interface Chainable {
|
|
5
5
|
/** Flush the axe-core result queue by sending results to the server. */
|
|
6
|
+
axeWatcherFlush(): Chainable<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Flush the axe-core result queue by sending results to the server.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated Use cy.axeWatcherFlush() instead
|
|
11
|
+
*/
|
|
6
12
|
axeFlush(): Chainable<void>;
|
|
7
13
|
/** Perform an axe-core analysis. */
|
|
14
|
+
axeWatcherAnalyze(params?: {
|
|
15
|
+
__UserRequestedAnalyze?: boolean;
|
|
16
|
+
}): Chainable<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Perform an axe-core analysis.
|
|
19
|
+
*
|
|
20
|
+
* @Deprecated Use cy.axeWatcherAnalyze() instead
|
|
21
|
+
*/
|
|
8
22
|
axeAnalyze(params?: {
|
|
9
23
|
__UserRequestedAnalyze?: boolean;
|
|
10
24
|
}): Chainable<void>;
|
|
11
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Start automatic analysis mode.
|
|
27
|
+
*/
|
|
28
|
+
axeWatcherStart(): Chainable<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Start automatic analysis mode.
|
|
31
|
+
*
|
|
32
|
+
* @Deprecated Use cy.axeWatcherStart() instead
|
|
33
|
+
*/
|
|
12
34
|
axeStart(): Chainable<void>;
|
|
13
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Stop automatic analysis mode.
|
|
37
|
+
*/
|
|
38
|
+
axeWatcherStop(): Chainable<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Stop automatic analysis mode.
|
|
41
|
+
*
|
|
42
|
+
* @Deprecated Use cy.axeWatcherStop() instead
|
|
43
|
+
*/
|
|
14
44
|
axeStop(): Chainable<void>;
|
|
15
45
|
/** Access Cypress internal state */
|
|
16
46
|
state(state: any): any;
|
package/dist/cypressCommands.js
CHANGED
|
@@ -63,7 +63,7 @@ exports.WRAPPED_COMMANDS.forEach(method => Cypress.Commands.overwrite(method, (o
|
|
|
63
63
|
win.__AXE_WATCHER_HAS_VISITED = true;
|
|
64
64
|
}
|
|
65
65
|
})
|
|
66
|
-
.
|
|
66
|
+
.axeWatcherAnalyze({ __UserRequestedAnalyze: false })
|
|
67
67
|
// Set the subject back to the previous subject
|
|
68
68
|
.then(() => subject)
|
|
69
69
|
.then(() => originalFn(...args));
|
|
@@ -78,7 +78,7 @@ exports.WRAPPED_COMMANDS.forEach(method => Cypress.Commands.overwrite(method, (o
|
|
|
78
78
|
Cypress.Commands.overwrite('visit', (originalFn, ...args) => {
|
|
79
79
|
// We use `cy.wrap(null)` here just to get into the Cypress command queue.
|
|
80
80
|
cy.wrap(null)
|
|
81
|
-
.
|
|
81
|
+
.axeWatcherAnalyze({ __UserRequestedAnalyze: false })
|
|
82
82
|
.then(() => originalFn(...args))
|
|
83
83
|
.then(visitResult => {
|
|
84
84
|
cy.window()
|
|
@@ -97,7 +97,7 @@ Cypress.Commands.overwrite('visit', (originalFn, ...args) => {
|
|
|
97
97
|
.then(() => visitResult);
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
|
-
|
|
100
|
+
function axeWatcherFlushCommand() {
|
|
101
101
|
cy.window().then(win => {
|
|
102
102
|
if (!shouldAnalyzeLocation(win.location)) {
|
|
103
103
|
return Promise.resolve();
|
|
@@ -130,10 +130,12 @@ Cypress.Commands.add('axeFlush', () => {
|
|
|
130
130
|
cy.writeFile(filename, JSON.stringify(results, null, 2));
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
}
|
|
134
|
+
const doesCypressCommandExist = (commandName) => {
|
|
135
|
+
//@ts-expect-error - Property 'cy' does not exist on type 'Cypress & CyEventEmitter'.ts(2339)
|
|
136
|
+
return !!Cypress.cy[commandName];
|
|
137
|
+
};
|
|
138
|
+
function axeWatcherAnalyzeCommand({ __UserRequestedAnalyze = true } = {}) {
|
|
137
139
|
const userRequestedAnalyze = __UserRequestedAnalyze;
|
|
138
140
|
cy.window().then(win => {
|
|
139
141
|
if (!shouldAnalyzeLocation(win.location)) {
|
|
@@ -155,8 +157,8 @@ Cypress.Commands.add('axeAnalyze',
|
|
|
155
157
|
win.dispatchEvent(event);
|
|
156
158
|
});
|
|
157
159
|
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
+
}
|
|
161
|
+
function axeWatcherStartCommand() {
|
|
160
162
|
cy.window().then(win => {
|
|
161
163
|
if (!shouldAnalyzeLocation(win.location)) {
|
|
162
164
|
return Promise.resolve();
|
|
@@ -173,8 +175,8 @@ Cypress.Commands.add('axeStart', () => {
|
|
|
173
175
|
isStopped = false;
|
|
174
176
|
});
|
|
175
177
|
});
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
+
}
|
|
179
|
+
function axeWatcherStopCommand() {
|
|
178
180
|
cy.window().then(win => {
|
|
179
181
|
if (!shouldAnalyzeLocation(win.location)) {
|
|
180
182
|
return Promise.resolve();
|
|
@@ -191,5 +193,21 @@ Cypress.Commands.add('axeStop', () => {
|
|
|
191
193
|
isStopped = true;
|
|
192
194
|
});
|
|
193
195
|
});
|
|
194
|
-
}
|
|
196
|
+
}
|
|
197
|
+
// Deprecated name; conflicts with @axe-devtools/cypress, should only be
|
|
198
|
+
// added if we don't see the other one already. Cypress uses the last-registered
|
|
199
|
+
// command, so this means that devtools will "win" the conflict.
|
|
200
|
+
if (!doesCypressCommandExist('axeAnalyze')) {
|
|
201
|
+
Cypress.Commands.add('axeAnalyze', axeWatcherAnalyzeCommand);
|
|
202
|
+
}
|
|
203
|
+
/** Deprecated: Replaced with `axeWatcherFlush` */
|
|
204
|
+
Cypress.Commands.add('axeFlush', axeWatcherFlushCommand);
|
|
205
|
+
/** Deprecated: Replaced with `axeWatcherStop` */
|
|
206
|
+
Cypress.Commands.add('axeStop', axeWatcherStopCommand);
|
|
207
|
+
/** Deprecated: Replaced with `axeWatcherStart` */
|
|
208
|
+
Cypress.Commands.add('axeStart', axeWatcherStartCommand);
|
|
209
|
+
Cypress.Commands.add('axeWatcherAnalyze', axeWatcherAnalyzeCommand);
|
|
210
|
+
Cypress.Commands.add('axeWatcherStart', axeWatcherStartCommand);
|
|
211
|
+
Cypress.Commands.add('axeWatcherStop', axeWatcherStopCommand);
|
|
212
|
+
Cypress.Commands.add('axeWatcherFlush', axeWatcherFlushCommand);
|
|
195
213
|
//# sourceMappingURL=cypressCommands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";;;AAqEA;;;;;;;GAO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AAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,wEAAwE;AACxE,gFAAgF;AAChF,gEAAgE;AAChE,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,EAAE,CAAC;IAC3C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,EAAE,wBAAwB,CAAC,CAAA;AAC9D,CAAC;AAED,kDAAkD;AAClD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAA;AACxD,iDAAiD;AACjD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAA;AACtD,kDAAkD;AAClD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAA;AAExD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,mBAAmB,EAAE,wBAAwB,CAAC,CAAA;AACnE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAA;AAC/D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAA;AAC7D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAA"}
|
package/dist/playwright.js
CHANGED
|
@@ -1,24 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
@@ -32,14 +12,18 @@ const Controller_1 = __importDefault(require("./Controller"));
|
|
|
32
12
|
* @param opts Playwright config to extend
|
|
33
13
|
*/
|
|
34
14
|
function playwrightConfig(opts) {
|
|
35
|
-
const { axe
|
|
15
|
+
const { axe, ...config } = opts;
|
|
36
16
|
let { args = [] } = config;
|
|
37
17
|
(0, util_1.writeVariables)(axe);
|
|
38
18
|
if (config.headless) {
|
|
39
19
|
throw new util_1.HeadlessNotSupportedError('In Playwright, include "--headless=new" in the "args" property of your options instead of using "headless: true"');
|
|
40
20
|
}
|
|
41
21
|
args = args.concat(util_1.extensionArgs);
|
|
42
|
-
return
|
|
22
|
+
return {
|
|
23
|
+
...config,
|
|
24
|
+
headless: false,
|
|
25
|
+
args
|
|
26
|
+
};
|
|
43
27
|
}
|
|
44
28
|
exports.playwrightConfig = playwrightConfig;
|
|
45
29
|
class PlaywrightController extends Controller_1.default {
|
|
@@ -47,12 +31,10 @@ class PlaywrightController extends Controller_1.default {
|
|
|
47
31
|
super();
|
|
48
32
|
this.driver = driver;
|
|
49
33
|
}
|
|
50
|
-
executeScript(fn, ...args) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return result;
|
|
55
|
-
});
|
|
34
|
+
async executeScript(fn, ...args) {
|
|
35
|
+
const [arg] = args || [];
|
|
36
|
+
const result = await this.driver.evaluate(fn, arg);
|
|
37
|
+
return result;
|
|
56
38
|
}
|
|
57
39
|
}
|
|
58
40
|
exports.PlaywrightController = PlaywrightController;
|
package/dist/playwright.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.js","sourceRoot":"","sources":["../src/playwright.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playwright.js","sourceRoot":"","sources":["../src/playwright.ts"],"names":[],"mappings":";;;;;;AACA,iCAKe;AACf,8DAAqC;AAKrC;;;;GAIG;AAEH,SAAgB,gBAAgB,CAAC,IAAa;IAC5C,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;IAC/B,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,MAAM,CAAA;IAE1B,IAAA,qBAAc,EAAC,GAAG,CAAC,CAAA;IAEnB,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,MAAM,IAAI,gCAAyB,CACjC,kHAAkH,CACnH,CAAA;IACH,CAAC;IAED,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAa,CAAC,CAAA;IAEjC,OAAO;QACL,GAAG,MAAM;QACT,QAAQ,EAAE,KAAK;QACf,IAAI;KACL,CAAA;AACH,CAAC;AAnBD,4CAmBC;AAED,MAAa,oBAAqB,SAAQ,oBAAU;IAGlD,YAAY,MAAY;QACtB,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAES,KAAK,CAAC,aAAa,CAC3B,EAA+B,EAC/B,GAAG,IAAe;QAElB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,EAA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