@axe-core/watcher 3.16.0 → 3.16.1-next.14350035
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSES-3RD-PARTY.md +720 -0
- package/dist/Controller.d.ts +5 -1
- package/dist/Controller.js +49 -36
- package/dist/Controller.js.map +1 -1
- package/dist/cypress.d.ts +2 -0
- package/dist/cypress.js +11 -5
- package/dist/cypress.js.map +1 -1
- package/dist/cypressCommands.js +62 -39
- package/dist/cypressCommands.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/playwright.js +7 -1
- package/dist/playwright.js.map +1 -1
- package/dist/playwrightTest.d.ts +9 -3
- package/dist/playwrightTest.js +9 -5
- package/dist/playwrightTest.js.map +1 -1
- package/dist/playwrightWrapping.d.ts +1 -0
- package/dist/playwrightWrapping.js +15 -7
- package/dist/playwrightWrapping.js.map +1 -1
- package/dist/puppeteer.js +7 -1
- package/dist/puppeteer.js.map +1 -1
- package/dist/sendResultsToServer.d.ts +2 -1
- package/dist/sendResultsToServer.js.map +1 -1
- package/dist/utils/assertVariablesWereWritten.d.ts +1 -0
- package/dist/utils/assertVariablesWereWritten.js +16 -0
- package/dist/utils/assertVariablesWereWritten.js.map +1 -0
- package/dist/utils/checkUserArgs.d.ts +8 -0
- package/dist/utils/checkUserArgs.js +10 -0
- package/dist/utils/checkUserArgs.js.map +1 -0
- package/dist/utils/proxyHandlers.d.ts +2 -0
- package/dist/utils/proxyHandlers.js +14 -1
- package/dist/utils/proxyHandlers.js.map +1 -1
- package/dist/utils/runOptions.d.ts +16 -0
- package/dist/utils/runOptions.js +3 -0
- package/dist/utils/runOptions.js.map +1 -0
- package/dist/utils/validateAxeRunOptions.d.ts +1 -1
- package/dist/wdio.js +8 -1
- package/dist/wdio.js.map +1 -1
- package/dist/webdriver.js +7 -1
- package/dist/webdriver.js.map +1 -1
- package/extension/axe.js +1 -1
- package/extension/axe.js.LICENSE.txt +1 -1
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/package.json +8 -7
- package/dist/utils/headlessNotSupportedError.test.d.ts +0 -1
- package/dist/utils/headlessNotSupportedError.test.js +0 -21
- package/dist/utils/headlessNotSupportedError.test.js.map +0 -1
- package/dist/utils/initializeSession.test.d.ts +0 -1
- package/dist/utils/initializeSession.test.js +0 -177
- package/dist/utils/initializeSession.test.js.map +0 -1
- package/dist/utils/isValidExcludePattern.test.d.ts +0 -1
- package/dist/utils/isValidExcludePattern.test.js +0 -17
- package/dist/utils/isValidExcludePattern.test.js.map +0 -1
- package/dist/utils/mergeChromeArgs.test.d.ts +0 -1
- package/dist/utils/mergeChromeArgs.test.js +0 -257
- package/dist/utils/mergeChromeArgs.test.js.map +0 -1
- package/dist/utils/proxyHandlers.test.d.ts +0 -1
- package/dist/utils/proxyHandlers.test.js +0 -27
- package/dist/utils/proxyHandlers.test.js.map +0 -1
- package/dist/utils/updateAutoAnalyze.d.ts +0 -7
- package/dist/utils/updateAutoAnalyze.js +0 -15
- package/dist/utils/updateAutoAnalyze.js.map +0 -1
- package/dist/utils/validateAxeRunContext.test.d.ts +0 -1
- package/dist/utils/validateAxeRunContext.test.js +0 -97
- package/dist/utils/validateAxeRunContext.test.js.map +0 -1
- package/dist/utils/validateAxeRunOptions.test.d.ts +0 -1
- package/dist/utils/validateAxeRunOptions.test.js +0 -215
- package/dist/utils/validateAxeRunOptions.test.js.map +0 -1
- package/dist/utils/writeVariables.test.d.ts +0 -1
- package/dist/utils/writeVariables.test.js +0 -200
- package/dist/utils/writeVariables.test.js.map +0 -1
package/dist/Controller.d.ts
CHANGED
@@ -2,12 +2,16 @@ import type { Debugger } from 'debug';
|
|
2
2
|
interface ControllerParams {
|
3
3
|
/** The namespace for the debug logger. */
|
4
4
|
debugLoggerName: string;
|
5
|
+
/** The name of the integration. Used for variables assertion */
|
6
|
+
integrationName?: string;
|
7
|
+
/** Configuration function name. Use for variables assertion */
|
8
|
+
configurationFunction?: string;
|
5
9
|
}
|
6
10
|
declare abstract class Controller {
|
7
11
|
protected abstract executeScript<A = unknown, T = void>(fn: string | ((...args: A[]) => Promise<T>), ...args: unknown[]): Promise<T>;
|
8
12
|
protected isStopped: boolean;
|
9
13
|
protected debugLogger: Debugger;
|
10
|
-
constructor({ debugLoggerName }: ControllerParams);
|
14
|
+
constructor({ debugLoggerName, integrationName, configurationFunction }: ControllerParams);
|
11
15
|
start(): Promise<void>;
|
12
16
|
stop(): Promise<void>;
|
13
17
|
analyze({ __Method, __UserRequestedAnalyze }?: {
|
package/dist/Controller.js
CHANGED
@@ -3,61 +3,66 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const
|
6
|
+
const readVariables_1 = __importDefault(require("./utils/readVariables"));
|
7
7
|
const sendResultsToServer_1 = __importDefault(require("./sendResultsToServer"));
|
8
8
|
const createDebugger_1 = __importDefault(require("./createDebugger"));
|
9
|
+
const assertVariablesWereWritten_1 = require("./utils/assertVariablesWereWritten");
|
9
10
|
class Controller {
|
10
|
-
constructor({ debugLoggerName }) {
|
11
|
-
|
11
|
+
constructor({ debugLoggerName, integrationName, configurationFunction }) {
|
12
|
+
(0, assertVariablesWereWritten_1.assertVariablesWereWritten)(integrationName, configurationFunction);
|
13
|
+
const variables = (0, readVariables_1.default)();
|
14
|
+
this.isStopped = !(variables === null || variables === void 0 ? void 0 : variables.auto_analyze);
|
12
15
|
this.debugLogger = (0, createDebugger_1.default)(debugLoggerName);
|
13
16
|
}
|
14
17
|
async start() {
|
15
|
-
(
|
18
|
+
this.debugLogger(`Start: Invoked`);
|
16
19
|
this.isStopped = false;
|
17
|
-
|
18
|
-
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) {
|
19
|
-
return Promise.resolve();
|
20
|
-
}
|
21
|
-
return new Promise(resolve => {
|
22
|
-
const fn = () => {
|
23
|
-
window.removeEventListener('axe:start-auto-mode-done', fn);
|
24
|
-
resolve();
|
25
|
-
};
|
26
|
-
window.addEventListener('axe:start-auto-mode-done', fn);
|
27
|
-
const event = new CustomEvent('axe:start-auto-mode');
|
28
|
-
window.dispatchEvent(event);
|
29
|
-
});
|
30
|
-
});
|
20
|
+
return Promise.resolve();
|
31
21
|
}
|
32
22
|
async stop() {
|
33
|
-
(
|
34
|
-
this.isStopped
|
35
|
-
|
23
|
+
this.debugLogger(`Stop: Invoked (${this.isStopped ? 'not analyzing' : 'may analyze implicitly'})`);
|
24
|
+
if (this.isStopped) {
|
25
|
+
return Promise.resolve();
|
26
|
+
}
|
27
|
+
const result = await this.executeScript(() => {
|
36
28
|
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) {
|
37
|
-
return Promise.resolve();
|
29
|
+
return Promise.resolve({ message: 'Skipped - Invalid protocol' });
|
38
30
|
}
|
39
31
|
return new Promise(resolve => {
|
40
|
-
const fn = () => {
|
41
|
-
window.removeEventListener('axe:
|
42
|
-
resolve();
|
32
|
+
const fn = (event) => {
|
33
|
+
window.removeEventListener('axe:manual-mode-analyze-done', fn);
|
34
|
+
resolve(event.detail);
|
43
35
|
};
|
44
|
-
window.addEventListener('axe:
|
45
|
-
const event = new CustomEvent('axe:
|
36
|
+
window.addEventListener('axe:manual-mode-analyze-done', fn);
|
37
|
+
const event = new CustomEvent('axe:manual-mode-analyze', {
|
38
|
+
detail: { userRequestedAnalyze: false }
|
39
|
+
});
|
46
40
|
window.dispatchEvent(event);
|
47
41
|
});
|
48
42
|
});
|
43
|
+
this.debugLogger(`Stop: ${result.message}`);
|
44
|
+
this.isStopped = true;
|
49
45
|
}
|
50
46
|
async analyze({ __Method, __UserRequestedAnalyze = true } = {}) {
|
51
|
-
this.debugLogger(`Analyze: Invoked${__Method ? ` - ${__Method}` : ''}
|
47
|
+
this.debugLogger(`Analyze: Invoked${__Method ? ` - ${__Method}` : ''}`, {
|
48
|
+
isStopped: this.isStopped,
|
49
|
+
userRequestedAnalyze: __UserRequestedAnalyze
|
50
|
+
});
|
52
51
|
if (this.isStopped && !__UserRequestedAnalyze) {
|
53
52
|
this.debugLogger('Analyze: Skipped', {
|
54
53
|
isStopped: this.isStopped,
|
55
|
-
__UserRequestedAnalyze
|
54
|
+
userRequestedAnalyze: __UserRequestedAnalyze
|
56
55
|
});
|
57
56
|
return;
|
58
57
|
}
|
59
|
-
const result = await this.executeScript((userRequestedAnalyze) => {
|
58
|
+
const result = await this.executeScript(({ userRequestedAnalyze, isStopped }) => {
|
60
59
|
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) {
|
60
|
+
if (userRequestedAnalyze) {
|
61
|
+
return Promise.resolve({
|
62
|
+
message: `Cannot perform analysis - invalid protocol: ${window.location.protocol}`,
|
63
|
+
error: true
|
64
|
+
});
|
65
|
+
}
|
61
66
|
return Promise.resolve({ message: 'Skipped - Invalid protocol' });
|
62
67
|
}
|
63
68
|
return new Promise(resolve => {
|
@@ -67,16 +72,22 @@ class Controller {
|
|
67
72
|
};
|
68
73
|
window.addEventListener('axe:manual-mode-analyze-done', fn);
|
69
74
|
const event = new CustomEvent('axe:manual-mode-analyze', {
|
70
|
-
detail: { userRequestedAnalyze }
|
75
|
+
detail: { userRequestedAnalyze, isStopped }
|
71
76
|
});
|
72
77
|
window.dispatchEvent(event);
|
73
78
|
});
|
74
|
-
},
|
79
|
+
}, {
|
80
|
+
userRequestedAnalyze: __UserRequestedAnalyze,
|
81
|
+
isStopped: this.isStopped
|
82
|
+
});
|
75
83
|
this.debugLogger(`Analyze: ${result.message}`);
|
84
|
+
if (result.error) {
|
85
|
+
throw new Error(result.message);
|
86
|
+
}
|
76
87
|
}
|
77
88
|
async flush() {
|
78
|
-
this.debugLogger(
|
79
|
-
const results = await this.executeScript(() => {
|
89
|
+
this.debugLogger(`Flush: Invoked (${this.isStopped ? 'auto-analysis stopped' : 'may analyze implicitly'})`);
|
90
|
+
const results = await this.executeScript((isStopped) => {
|
80
91
|
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) {
|
81
92
|
return Promise.resolve([]);
|
82
93
|
}
|
@@ -92,10 +103,12 @@ class Controller {
|
|
92
103
|
};
|
93
104
|
window.addEventListener('axe:result', onAxeResult);
|
94
105
|
window.addEventListener('axe:flush-end', onFlushEnd);
|
95
|
-
const event = new CustomEvent('axe:flush-start'
|
106
|
+
const event = new CustomEvent('axe:flush-start', {
|
107
|
+
detail: { isStopped }
|
108
|
+
});
|
96
109
|
window.dispatchEvent(event);
|
97
110
|
});
|
98
|
-
});
|
111
|
+
}, this.isStopped);
|
99
112
|
this.debugLogger(`Flush: Received ${results.length} results`);
|
100
113
|
await (0, sendResultsToServer_1.default)({
|
101
114
|
results,
|
package/dist/Controller.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Controller.js","sourceRoot":"","sources":["../src/Controller.ts"],"names":[],"mappings":";;;;;AAAA,
|
1
|
+
{"version":3,"file":"Controller.js","sourceRoot":"","sources":["../src/Controller.ts"],"names":[],"mappings":";;;;;AAAA,0EAAiD;AACjD,gFAAwE;AACxE,sEAA6C;AAE7C,mFAA+E;AAW/E,MAAe,UAAU;IASvB,YAAY,EACV,eAAe,EACf,eAAe,EACf,qBAAqB,EACJ;QACjB,IAAA,uDAA0B,EAAC,eAAe,EAAE,qBAAqB,CAAC,CAAA;QAClE,MAAM,SAAS,GAAG,IAAA,uBAAa,GAAE,CAAA;QACjC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,YAAY,CAAA,CAAA;QACzC,IAAI,CAAC,WAAW,GAAG,IAAA,wBAAc,EAAC,eAAe,CAAC,CAAA;IACpD,CAAC;IAGM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAA;QAClC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;QACtB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,IAAI,CAAC,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gBAC1B,CAAC,CAAA;gBAED,MAAM,WAAW,GAAG,CAAC,CAAwB,EAAQ,EAAE;oBACrD,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;gBACnC,CAAC,CAAA;gBAED,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,WAAyB,CAAC,CAAA;gBAChE,MAAM,CAAC,gBAAgB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;gBAEpD,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,iBAAiB,EAAE;oBAC/C,MAAM,EAAE,EAAE,SAAS,EAAE;iBACtB,CAAC,CAAA;gBACF,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;YAC7B,CAAC,CAAC,CAAA;QACJ,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QAElB,IAAI,CAAC,WAAW,CAAC,mBAAmB,OAAO,CAAC,MAAM,UAAU,CAAC,CAAA;QAC7D,MAAM,IAAA,6BAAmB,EAAC;YACxB,OAAO;YACP,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC,CAAA;QACF,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAA;IACrC,CAAC;CACF;AAED,kBAAe,UAAU,CAAA"}
|
package/dist/cypress.d.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
import { type Configuration } from './utils/writeVariables';
|
2
|
+
export declare const cypressConfigRunFlag = "__AXE_WATCHER_CYPRESS_CONFIG_RUN";
|
3
|
+
export declare const cypressConfigAutoAnalyzeFlag = "__AXE_WATCHER_AUTO_ANALYZE";
|
2
4
|
/**
|
3
5
|
* Create a Cypress config that uses the axe Watcher extension.
|
4
6
|
*
|
package/dist/cypress.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.cypressConfig = void 0;
|
6
|
+
exports.cypressConfig = exports.cypressConfigAutoAnalyzeFlag = exports.cypressConfigRunFlag = void 0;
|
7
7
|
const sendResultsToServer_1 = __importDefault(require("./sendResultsToServer"));
|
8
8
|
const EventForwarder_1 = __importDefault(require("./EventForwarder"));
|
9
9
|
const writeVariables_1 = __importDefault(require("./utils/writeVariables"));
|
@@ -11,8 +11,10 @@ const writeExtensionManifest_1 = __importDefault(require("./utils/writeExtension
|
|
11
11
|
const headlessNotSupportedError_1 = require("./utils/headlessNotSupportedError");
|
12
12
|
const mergeChromeArgs_1 = __importDefault(require("./utils/mergeChromeArgs"));
|
13
13
|
const createDebugger_1 = __importDefault(require("./createDebugger"));
|
14
|
+
const checkUserArgs_1 = require("./utils/checkUserArgs");
|
14
15
|
const debugLogger = (0, createDebugger_1.default)('CypressController');
|
15
|
-
|
16
|
+
exports.cypressConfigRunFlag = '__AXE_WATCHER_CYPRESS_CONFIG_RUN';
|
17
|
+
exports.cypressConfigAutoAnalyzeFlag = '__AXE_WATCHER_AUTO_ANALYZE';
|
16
18
|
const cypressConfig = (config) => {
|
17
19
|
var _a;
|
18
20
|
const { axe, ...userConfig } = config;
|
@@ -31,12 +33,12 @@ const cypressConfig = (config) => {
|
|
31
33
|
});
|
32
34
|
if ((_a = userConfig.e2e) === null || _a === void 0 ? void 0 : _a.env) {
|
33
35
|
userConfig.e2e.env = Object.assign({}, userConfig.e2e.env, {
|
34
|
-
[cypressConfigRunFlag]: true
|
36
|
+
[exports.cypressConfigRunFlag]: true
|
35
37
|
});
|
36
38
|
}
|
37
39
|
else {
|
38
40
|
userConfig.env = Object.assign({}, userConfig.env, {
|
39
|
-
[cypressConfigRunFlag]: true
|
41
|
+
[exports.cypressConfigRunFlag]: true
|
40
42
|
});
|
41
43
|
}
|
42
44
|
if (hasWatcherDebug) {
|
@@ -44,6 +46,9 @@ const cypressConfig = (config) => {
|
|
44
46
|
__AXE_WATCHER_DEBUG: hasWatcherDebug
|
45
47
|
});
|
46
48
|
}
|
49
|
+
userConfig.env = Object.assign({}, userConfig.env, {
|
50
|
+
[exports.cypressConfigAutoAnalyzeFlag]: axe.autoAnalyze === undefined ? true : axe.autoAnalyze
|
51
|
+
});
|
47
52
|
return {
|
48
53
|
...userConfig,
|
49
54
|
e2e: {
|
@@ -55,7 +60,7 @@ const cypressConfig = (config) => {
|
|
55
60
|
const userNodeEventConfig = await ((_b = (_a = userConfig.e2e) === null || _a === void 0 ? void 0 : _a.setupNodeEvents) === null || _b === void 0 ? void 0 : _b.call(_a, on, ...args));
|
56
61
|
if (userNodeEventConfig) {
|
57
62
|
userNodeEventConfig.env = Object.assign({}, userNodeEventConfig.env, {
|
58
|
-
[cypressConfigRunFlag]: true
|
63
|
+
[exports.cypressConfigRunFlag]: true
|
59
64
|
});
|
60
65
|
}
|
61
66
|
on('task', {
|
@@ -84,6 +89,7 @@ const cypressConfig = (config) => {
|
|
84
89
|
throw new headlessNotSupportedError_1.HeadlessNotSupportedError('In Cypress, "--headless=new" became the default headless mode in Cypress version 12.15.0. Ensure your Cypress version is up to date and that you are not using a "before:browser:launch" configuration that adds "--headless" to launchOptions.args.');
|
85
90
|
}
|
86
91
|
const existingArgs = launchOptions.args;
|
92
|
+
(0, checkUserArgs_1.checkUserArgs)(existingArgs);
|
87
93
|
launchOptions.args = (0, mergeChromeArgs_1.default)(existingArgs, {
|
88
94
|
disableOtherExtensions: false
|
89
95
|
});
|
package/dist/cypress.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cypress.js","sourceRoot":"","sources":["../src/cypress.ts"],"names":[],"mappings":";;;;;;AACA,gFAAuD;AACvD,sEAA6C;AAC7C,4EAA2E;AAC3E,4FAA0D;AAC1D,iFAA6E;AAC7E,8EAAqD;AACrD,sEAA6C;
|
1
|
+
{"version":3,"file":"cypress.js","sourceRoot":"","sources":["../src/cypress.ts"],"names":[],"mappings":";;;;;;AACA,gFAAuD;AACvD,sEAA6C;AAC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BACD,iBAAiB,EAAE,CAAC,OAAe,EAAE,EAAE;wBACrC,WAAW,CAAC,OAAO,CAAC,CAAA;wBACpB,OAAO,IAAI,CAAA;oBACb,CAAC;iBACF,CAAC,CAAA;gBAEF,EAAE,CAAC,uBAAuB,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE;oBAGrD,IACE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;wBAClC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EACnC,CAAC;wBACD,MAAM,IAAI,KAAK,CACb,0GAA0G,OAAO,CAAC,IAAI,mIAAmI,CAC1P,CAAA;oBACH,CAAC;oBAED,IAAI,OAAO,CAAC,UAAU,IAAI,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;wBACpE,MAAM,IAAI,qDAAyB,CACjC,sPAAsP,CACvP,CAAA;oBACH,CAAC;oBAGD,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,CAAA;oBACvC,IAAA,6BAAa,EAAC,YAAY,CAAC,CAAA;oBAC3B,aAAa,CAAC,IAAI,GAAG,IAAA,yBAAe,EAAC,YAAY,EAAE;wBACjD,sBAAsB,EAAE,KAAK;qBAC9B,CAAC,CAAA;oBAEF,OAAO,aAAa,CAAA;gBACtB,CAAC,CAAC,CAAA;gBAMF,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;gBAEjC,OAAO,mBAAmB,CAAA;YAC5B,CAAC;SACF;KACF,CAAA;AACH,CAAC,CAAA;AAvJY,QAAA,aAAa,iBAuJzB"}
|
package/dist/cypressCommands.js
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.WRAPPED_COMMANDS = void 0;
|
4
4
|
const cypressConfigRunFlag = '__AXE_WATCHER_CYPRESS_CONFIG_RUN';
|
5
|
-
|
5
|
+
const cypressConfigAutoAnalyzeFlag = '__AXE_WATCHER_AUTO_ANALYZE';
|
6
|
+
let isStopped = !Cypress.env(cypressConfigAutoAnalyzeFlag);
|
6
7
|
exports.WRAPPED_COMMANDS = [
|
7
8
|
'blur',
|
8
9
|
'check',
|
@@ -75,7 +76,9 @@ Cypress.Commands.addQuery('__axeRestoreSubject', function (subjectChain, timeout
|
|
75
76
|
return () => cy.getSubjectFromChain(subjectChain);
|
76
77
|
});
|
77
78
|
function axeWatcherFlushCommand() {
|
78
|
-
logDebugAxeWatcher({
|
79
|
+
logDebugAxeWatcher({
|
80
|
+
message: `Flush: Invoked (${isStopped ? 'will not' : 'may'} analyze implicitly)`
|
81
|
+
});
|
79
82
|
cy.window().then(win => {
|
80
83
|
if (!shouldAnalyzeLocation(win.location)) {
|
81
84
|
return Promise.resolve();
|
@@ -92,7 +95,9 @@ function axeWatcherFlushCommand() {
|
|
92
95
|
};
|
93
96
|
win.addEventListener('axe:flush-end', onFlushEnd);
|
94
97
|
win.addEventListener('axe:result', onAxeResult);
|
95
|
-
const event = new CustomEvent('axe:flush-start'
|
98
|
+
const event = new CustomEvent('axe:flush-start', {
|
99
|
+
detail: { isStopped }
|
100
|
+
});
|
96
101
|
win.dispatchEvent(event);
|
97
102
|
}).then(results => {
|
98
103
|
cy.task('__uploadAxeWatcherResults', { results }, { log: false });
|
@@ -103,22 +108,37 @@ function axeWatcherFlushCommand() {
|
|
103
108
|
const doesCypressCommandExist = (commandName) => {
|
104
109
|
return !!Cypress.cy[commandName];
|
105
110
|
};
|
106
|
-
function axeWatcherAnalyzeCommand({ __Method, __UserRequestedAnalyze = true } = {}) {
|
111
|
+
function axeWatcherAnalyzeCommand(subject, { __Method, __UserRequestedAnalyze = true } = {}) {
|
112
|
+
const userRequestedAnalyze = __UserRequestedAnalyze;
|
113
|
+
const message = userRequestedAnalyze
|
114
|
+
? 'User requested analysis'
|
115
|
+
: `Invoked${__Method ? ` - ${__Method}` : ''}`;
|
107
116
|
logDebugAxeWatcher({
|
108
|
-
message: `Analyze:
|
117
|
+
message: `Analyze: ${message}`
|
109
118
|
});
|
110
|
-
const userRequestedAnalyze = __UserRequestedAnalyze;
|
111
119
|
cy.window().then(win => {
|
112
120
|
if (!shouldAnalyzeLocation(win.location)) {
|
113
|
-
|
121
|
+
logDebugAxeWatcher({
|
122
|
+
message: `Analyze: Skipped - invalid protocol`
|
123
|
+
});
|
124
|
+
if (userRequestedAnalyze) {
|
125
|
+
return Promise.reject(new Error(`Cannot perform manual analysis - invalid protocol: ${win.location.protocol}`));
|
126
|
+
}
|
127
|
+
return Promise.resolve({
|
128
|
+
message: `Skipped - Invalid protocol`,
|
129
|
+
subject
|
130
|
+
});
|
114
131
|
}
|
115
132
|
if (isStopped && !userRequestedAnalyze) {
|
116
|
-
|
133
|
+
logDebugAxeWatcher({
|
134
|
+
message: `Analyze: Skipped - manual mode`
|
135
|
+
});
|
136
|
+
return Promise.resolve({ message: `Skipped (Manual mode)`, subject });
|
117
137
|
}
|
118
138
|
return new Promise(resolve => {
|
119
139
|
const fn = (event) => {
|
120
140
|
win.removeEventListener('axe:manual-mode-analyze-done', fn);
|
121
|
-
resolve(event.detail);
|
141
|
+
resolve({ message: event.detail.message, subject });
|
122
142
|
};
|
123
143
|
win.addEventListener('axe:manual-mode-analyze-done', fn);
|
124
144
|
const event = new CustomEvent('axe:manual-mode-analyze', {
|
@@ -127,53 +147,56 @@ function axeWatcherAnalyzeCommand({ __Method, __UserRequestedAnalyze = true } =
|
|
127
147
|
win.dispatchEvent(event);
|
128
148
|
}).then(result => {
|
129
149
|
logDebugAxeWatcher({ message: `Analyze: ${result === null || result === void 0 ? void 0 : result.message}` });
|
150
|
+
if (result === null || result === void 0 ? void 0 : result.subject) {
|
151
|
+
return result.subject;
|
152
|
+
}
|
130
153
|
});
|
131
154
|
});
|
132
155
|
}
|
133
|
-
function axeWatcherStartCommand() {
|
134
|
-
cy.window().then(
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
return new Promise(resolve => {
|
139
|
-
const fn = () => {
|
140
|
-
win.removeEventListener('axe:start-auto-mode-done', fn);
|
141
|
-
resolve();
|
142
|
-
};
|
143
|
-
win.addEventListener('axe:start-auto-mode-done', fn);
|
144
|
-
const event = new CustomEvent('axe:start-auto-mode');
|
145
|
-
win.dispatchEvent(event);
|
146
|
-
}).then(() => {
|
147
|
-
isStopped = false;
|
148
|
-
});
|
156
|
+
function axeWatcherStartCommand(subject) {
|
157
|
+
cy.window().then(() => {
|
158
|
+
logDebugAxeWatcher({ message: `Start: Invoked` });
|
159
|
+
isStopped = false;
|
160
|
+
return Promise.resolve(subject);
|
149
161
|
});
|
150
162
|
}
|
151
|
-
function axeWatcherStopCommand() {
|
163
|
+
function axeWatcherStopCommand(subject) {
|
164
|
+
logDebugAxeWatcher({ message: `Stop: Invoked` });
|
152
165
|
cy.window().then(win => {
|
153
166
|
if (!shouldAnalyzeLocation(win.location)) {
|
154
|
-
|
167
|
+
logDebugAxeWatcher({
|
168
|
+
message: `Stop: Skipped - invalid protocol`
|
169
|
+
});
|
170
|
+
return Promise.resolve({
|
171
|
+
message: `Skipped - Invalid protocol`,
|
172
|
+
subject
|
173
|
+
});
|
155
174
|
}
|
156
175
|
return new Promise(resolve => {
|
157
|
-
const fn = () => {
|
158
|
-
win.removeEventListener('axe:
|
159
|
-
resolve();
|
176
|
+
const fn = (event) => {
|
177
|
+
win.removeEventListener('axe:manual-mode-analyze-done', fn);
|
178
|
+
resolve({ message: event.detail.message, subject });
|
160
179
|
};
|
161
|
-
win.addEventListener('axe:
|
162
|
-
const event = new CustomEvent('axe:
|
180
|
+
win.addEventListener('axe:manual-mode-analyze-done', fn);
|
181
|
+
const event = new CustomEvent('axe:manual-mode-analyze');
|
163
182
|
win.dispatchEvent(event);
|
164
|
-
}).then(
|
183
|
+
}).then(result => {
|
184
|
+
logDebugAxeWatcher({ message: `Stop: ${result === null || result === void 0 ? void 0 : result.message}` });
|
165
185
|
isStopped = true;
|
186
|
+
if (result === null || result === void 0 ? void 0 : result.subject) {
|
187
|
+
return result.subject;
|
188
|
+
}
|
166
189
|
});
|
167
190
|
});
|
168
191
|
}
|
169
192
|
if (!doesCypressCommandExist('axeAnalyze')) {
|
170
|
-
Cypress.Commands.add('
|
193
|
+
Cypress.Commands.add('axeWatcherAnalyze', { prevSubject: 'optional' }, axeWatcherAnalyzeCommand);
|
171
194
|
}
|
172
195
|
Cypress.Commands.add('axeFlush', axeWatcherFlushCommand);
|
173
|
-
Cypress.Commands.add('axeStop', axeWatcherStopCommand);
|
174
|
-
Cypress.Commands.add('axeStart', axeWatcherStartCommand);
|
175
|
-
Cypress.Commands.add('axeWatcherAnalyze', axeWatcherAnalyzeCommand);
|
176
|
-
Cypress.Commands.add('axeWatcherStart', axeWatcherStartCommand);
|
177
|
-
Cypress.Commands.add('axeWatcherStop', axeWatcherStopCommand);
|
196
|
+
Cypress.Commands.add('axeStop', { prevSubject: 'optional' }, axeWatcherStopCommand);
|
197
|
+
Cypress.Commands.add('axeStart', { prevSubject: 'optional' }, axeWatcherStartCommand);
|
198
|
+
Cypress.Commands.add('axeWatcherAnalyze', { prevSubject: 'optional' }, axeWatcherAnalyzeCommand);
|
199
|
+
Cypress.Commands.add('axeWatcherStart', { prevSubject: 'optional' }, axeWatcherStartCommand);
|
200
|
+
Cypress.Commands.add('axeWatcherStop', { prevSubject: 'optional' }, axeWatcherStopCommand);
|
178
201
|
Cypress.Commands.add('axeWatcherFlush', axeWatcherFlushCommand);
|
179
202
|
//# sourceMappingURL=cypressCommands.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";;;AAYA,MAAM,oBAAoB,GAAG,kCAAkC,CAAA;
|
1
|
+
{"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";;;AAYA,MAAM,oBAAoB,GAAG,kCAAkC,CAAA;AAC/D,MAAM,4BAA4B,GAAG,4BAA4B,CAAA;AAy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EACnB,EAAE,WAAW,EAAE,UAAU,EAAE,EAC3B,wBAAwB,CACzB,CAAA;AACD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,iBAAiB,EACjB,EAAE,WAAW,EAAE,UAAU,EAAE,EAC3B,sBAAsB,CACvB,CAAA;AACD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,gBAAgB,EAChB,EAAE,WAAW,EAAE,UAAU,EAAE,EAC3B,qBAAqB,CACtB,CAAA;AACD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
@@ -3,5 +3,5 @@ export { puppeteerConfig, PuppeteerController, wrapPuppeteer, wrapPuppeteerPage
|
|
3
3
|
export { wdioConfig, wdioTestRunner, WdioController, wrapWdio } from './wdio';
|
4
4
|
export { webdriverConfig, WebdriverController, wrapWebdriver } from './webdriver';
|
5
5
|
export { playwrightConfig, PlaywrightController, wrapPlaywright, wrapPlaywrightPage } from './playwright';
|
6
|
-
export { default as playwrightTest } from './playwrightTest';
|
6
|
+
export { default as playwrightTest, type PageWithAxeWatcher as PlaywrightTestPageWithAxeWatcher } from './playwrightTest';
|
7
7
|
export { cypressConfig } from './cypress';
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;;;;AAEpD,yCAKoB;AAJlB,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AACb,8GAAA,iBAAiB,OAAA;AAEnB,+BAA6E;AAApE,kGAAA,UAAU,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAC7D,yCAIoB;AAHlB,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AAEf,2CAKqB;AAJnB,8GAAA,gBAAgB,OAAA;AAChB,kHAAA,oBAAoB,OAAA;AACpB,4GAAA,cAAc,OAAA;AACd,gHAAA,kBAAkB,OAAA;AAEpB,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;;;;AAEpD,yCAKoB;AAJlB,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AACb,8GAAA,iBAAiB,OAAA;AAEnB,+BAA6E;AAApE,kGAAA,UAAU,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAC7D,yCAIoB;AAHlB,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,0GAAA,aAAa,OAAA;AAEf,2CAKqB;AAJnB,8GAAA,gBAAgB,OAAA;AAChB,kHAAA,oBAAoB,OAAA;AACpB,4GAAA,cAAc,OAAA;AACd,gHAAA,kBAAkB,OAAA;AAEpB,mDAGyB;AAFvB,iIAAA,OAAO,OAAkB;AAG3B,qCAAyC;AAAhC,wGAAA,aAAa,OAAA"}
|
package/dist/playwright.js
CHANGED
@@ -9,9 +9,11 @@ const Controller_1 = __importDefault(require("./Controller"));
|
|
9
9
|
const headlessNotSupportedError_1 = require("./utils/headlessNotSupportedError");
|
10
10
|
const mergeChromeArgs_1 = __importDefault(require("./utils/mergeChromeArgs"));
|
11
11
|
const writeVariables_1 = __importDefault(require("./utils/writeVariables"));
|
12
|
+
const checkUserArgs_1 = require("./utils/checkUserArgs");
|
12
13
|
function playwrightConfig(opts) {
|
13
14
|
const { axe, ...config } = opts;
|
14
15
|
let { args = [] } = config;
|
16
|
+
(0, checkUserArgs_1.checkUserArgs)(args);
|
15
17
|
(0, writeVariables_1.default)(axe);
|
16
18
|
if (config.headless) {
|
17
19
|
throw new headlessNotSupportedError_1.HeadlessNotSupportedError('In Playwright, include "--headless=new" in the "args" property of your options instead of using "headless: true"');
|
@@ -26,7 +28,11 @@ function playwrightConfig(opts) {
|
|
26
28
|
}
|
27
29
|
class PlaywrightController extends Controller_1.default {
|
28
30
|
constructor(driver) {
|
29
|
-
super({
|
31
|
+
super({
|
32
|
+
debugLoggerName: 'PlaywrightController',
|
33
|
+
integrationName: 'Playwright',
|
34
|
+
configurationFunction: 'playwrightConfig()'
|
35
|
+
});
|
30
36
|
this.driver = driver;
|
31
37
|
}
|
32
38
|
async executeScript(fn, ...args) {
|
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":";;;;;;AAgBA,4CAqBC;AApCD,8DAAqC;AACrC,iFAA6E;AAC7E,8EAAqD;AACrD,4EAA2E;AAC3E,yDAAqD;AAWrD,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,6BAAa,EAAC,IAAI,CAAC,CAAA;IACnB,IAAA,wBAAc,EAAC,GAAG,CAAC,CAAA;IAEnB,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,MAAM,IAAI,qDAAyB,CACjC,kHAAkH,CACnH,CAAA;IACH,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,CAAA;IACzB,IAAI,GAAG,IAAA,yBAAe,EAAC,YAAY,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAA;IAEtE,OAAO;QACL,GAAG,MAAM;QACT,QAAQ,EAAE,KAAK;QACf,IAAI;KACL,CAAA;AACH,CAAC;AAED,MAAa,oBAAqB,SAAQ,oBAAU;IAGlD,YAAY,MAAY;QACtB,KAAK,CAAC;YACJ,eAAe,EAAE,sBAAsB;YACvC,eAAe,EAAE,YAAY;YAC7B,qBAAqB,EAAE,oBAAoB;SAC5C,CAAC,CAAA;QAEF,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,EAAE,CAAA;QACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAI,EAAE,EAAE,GAAG,CAAC,CAAA;QACrD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AArBD,oDAqBC;AAKM,MAAM,cAAc,GAAG,CAE5B,cAA8B,EAE9B,oBAA0C,EAC1B,EAAE;IAClB,MAAM,IAAI,KAAK,CAAC;;;;;;GAMf,CAAC,CAAA;AACJ,CAAC,CAAA;AAbY,QAAA,cAAc,kBAa1B;AAED,2DAAqE;AAA5D,wHAAA,QAAQ,OAAsB"}
|
package/dist/playwrightTest.d.ts
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
-
import type { TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Expect } from '@playwright/test';
|
2
|
-
import { type Options } from './playwright';
|
3
|
-
type
|
1
|
+
import type { TestType, Page, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Expect } from '@playwright/test';
|
2
|
+
import { PlaywrightController, type Options } from './playwright';
|
3
|
+
export type PageWithAxeWatcher = Page & {
|
4
|
+
axeWatcher: PlaywrightController;
|
5
|
+
};
|
6
|
+
type Test = TestType<PlaywrightTestArgs & PlaywrightTestOptions & Fixtures, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
7
|
+
type Fixtures = {
|
8
|
+
page: PageWithAxeWatcher;
|
9
|
+
};
|
4
10
|
interface ReturnValue {
|
5
11
|
test: Test;
|
6
12
|
expect: Expect;
|
package/dist/playwrightTest.js
CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const playwright_1 = require("./playwright");
|
7
7
|
const mergeChromeArgs_1 = __importDefault(require("./utils/mergeChromeArgs"));
|
8
8
|
const writeVariables_1 = __importDefault(require("./utils/writeVariables"));
|
9
|
+
const checkUserArgs_1 = require("./utils/checkUserArgs");
|
9
10
|
const playwrightTest = (options) => {
|
10
11
|
let controller = null;
|
11
12
|
const { axe, ...config } = options;
|
@@ -18,6 +19,7 @@ const playwrightTest = (options) => {
|
|
18
19
|
catch (error) {
|
19
20
|
throw new Error('Unable to load @playwright/test: ' + error.message);
|
20
21
|
}
|
22
|
+
(0, checkUserArgs_1.checkUserArgs)(config.args || []);
|
21
23
|
(0, writeVariables_1.default)(axe);
|
22
24
|
const test = base.extend({
|
23
25
|
context: async ({}, use) => {
|
@@ -31,14 +33,16 @@ const playwrightTest = (options) => {
|
|
31
33
|
await context.close();
|
32
34
|
},
|
33
35
|
page: async ({ page }, use) => {
|
34
|
-
controller =
|
35
|
-
|
36
|
+
controller = page.axeWatcher;
|
37
|
+
if (!controller) {
|
38
|
+
controller = new playwright_1.PlaywrightController(page);
|
39
|
+
page.axeWatcher = controller;
|
40
|
+
page = (0, playwright_1.wrapPlaywrightPage)(page, controller);
|
41
|
+
}
|
36
42
|
await use(page);
|
43
|
+
await controller.flush();
|
37
44
|
}
|
38
45
|
});
|
39
|
-
test.afterEach(async () => {
|
40
|
-
await (controller === null || controller === void 0 ? void 0 : controller.flush());
|
41
|
-
});
|
42
46
|
const expect = test.expect;
|
43
47
|
return { test, expect };
|
44
48
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"playwrightTest.js","sourceRoot":"","sources":["../src/playwrightTest.ts"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"file":"playwrightTest.js","sourceRoot":"","sources":["../src/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E,CAAC;gBAChB,UAAU,GAAG,IAAI,iCAAoB,CAAC,IAAI,CAAC,CAAA;gBAC3C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;gBAC5B,IAAI,GAAG,IAAA,+BAAkB,EAAC,IAAI,EAAE,UAAU,CAAuB,CAAA;YACnE,CAAC;YAED,MAAM,GAAG,CAAC,IAAI,CAAC,CAAA;YAEf,MAAM,UAAU,CAAC,KAAK,EAAE,CAAA;QAC1B,CAAC;KACF,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;AACzB,CAAC,CAAA;AAED,kBAAe,cAAc,CAAA"}
|
@@ -9,6 +9,7 @@ export declare const wrapFrame: (frame: PossiblyWrapped<Frame>, controller: Play
|
|
9
9
|
export declare const wrapFrameLocator: (frameLocator: PossiblyWrapped<FrameLocator>, controller: PlaywrightController) => FrameLocator;
|
10
10
|
export declare const wrapLocator: (locator: PossiblyWrapped<Locator>, controller: PlaywrightController) => Locator;
|
11
11
|
export declare const wrapJSHandle: (jsHandle: PossiblyWrapped<JSHandle>, controller: PlaywrightController) => JSHandle;
|
12
|
+
export declare const wrapSmartHandle: (smartHandle: PossiblyWrapped<JSHandle | ElementHandle>, controller: PlaywrightController) => JSHandle | ElementHandle;
|
12
13
|
export declare const wrapKeyboard: (keyboard: PossiblyWrapped<Keyboard>, controller: PlaywrightController) => Keyboard;
|
13
14
|
export declare const wrapMouse: (mouse: PossiblyWrapped<Mouse>, controller: PlaywrightController) => Mouse;
|
14
15
|
export declare const wrapTouchscreen: (touchscreen: PossiblyWrapped<Touchscreen>, controller: PlaywrightController) => Touchscreen;
|