@axe-core/watcher 3.10.0 → 3.11.0-next.0f67f781
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/dist/Controller.d.ts +9 -1
- package/dist/Controller.js +21 -7
- package/dist/Controller.js.map +1 -1
- package/dist/EventForwarder.js +4 -6
- package/dist/EventForwarder.js.map +1 -1
- package/dist/createDebugger.d.ts +9 -0
- package/dist/createDebugger.js +27 -0
- package/dist/createDebugger.js.map +1 -0
- package/dist/cypress.js +39 -43
- package/dist/cypress.js.map +1 -1
- package/dist/cypressCommands.d.ts +2 -3
- package/dist/cypressCommands.js +69 -65
- package/dist/cypressCommands.js.map +1 -1
- package/dist/playwright.js +3 -2
- package/dist/playwright.js.map +1 -1
- package/dist/playwrightTest.js +4 -1
- package/dist/playwrightTest.js.map +1 -1
- package/dist/puppeteer.js +3 -2
- package/dist/puppeteer.js.map +1 -1
- package/dist/sendResultsToServer.d.ts +6 -1
- package/dist/sendResultsToServer.js +26 -4
- package/dist/sendResultsToServer.js.map +1 -1
- package/dist/util.d.ts +11 -1
- package/dist/util.js +78 -7
- package/dist/util.js.map +1 -1
- package/dist/wdio.js +3 -3
- package/dist/wdio.js.map +1 -1
- package/dist/webdriver.js +8 -3
- package/dist/webdriver.js.map +1 -1
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/package.json +7 -6
package/dist/Controller.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import type { Debugger } from 'debug';
|
|
2
|
+
interface ControllerParams {
|
|
3
|
+
/** The namespace for the debug logger. */
|
|
4
|
+
debugLoggerName: string;
|
|
5
|
+
}
|
|
1
6
|
declare abstract class Controller {
|
|
2
7
|
protected abstract executeScript<A = unknown, T = void>(fn: string | ((...args: A[]) => Promise<T>), ...args: unknown[]): Promise<T>;
|
|
3
8
|
protected isStopped: boolean;
|
|
9
|
+
protected debugLogger: Debugger;
|
|
10
|
+
constructor({ debugLoggerName }: ControllerParams);
|
|
4
11
|
start(): Promise<void>;
|
|
5
12
|
stop(): Promise<void>;
|
|
6
|
-
analyze({ __UserRequestedAnalyze }?: {
|
|
13
|
+
analyze({ __Method, __UserRequestedAnalyze }?: {
|
|
14
|
+
__Method?: string;
|
|
7
15
|
__UserRequestedAnalyze?: boolean;
|
|
8
16
|
}): Promise<void>;
|
|
9
17
|
flush(): Promise<void>;
|
package/dist/Controller.js
CHANGED
|
@@ -5,9 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const util_1 = require("./util");
|
|
7
7
|
const sendResultsToServer_1 = __importDefault(require("./sendResultsToServer"));
|
|
8
|
+
const createDebugger_1 = __importDefault(require("./createDebugger"));
|
|
8
9
|
class Controller {
|
|
9
|
-
constructor() {
|
|
10
|
+
constructor({ debugLoggerName }) {
|
|
10
11
|
this.isStopped = false;
|
|
12
|
+
this.debugLogger = (0, createDebugger_1.default)(debugLoggerName);
|
|
11
13
|
}
|
|
12
14
|
async start() {
|
|
13
15
|
(0, util_1.updateAutoAnalyze)(true);
|
|
@@ -45,19 +47,24 @@ class Controller {
|
|
|
45
47
|
});
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
|
-
async analyze({ __UserRequestedAnalyze = true } = {}) {
|
|
50
|
+
async analyze({ __Method, __UserRequestedAnalyze = true } = {}) {
|
|
51
|
+
this.debugLogger(`Analyze: Invoked${__Method ? ` - ${__Method}` : ''}`);
|
|
49
52
|
// If the user didn't request an analyze, and we're in manual mode, don't do anything.
|
|
50
53
|
if (this.isStopped && !__UserRequestedAnalyze) {
|
|
54
|
+
this.debugLogger('Analyze: Skipped', {
|
|
55
|
+
isStopped: this.isStopped,
|
|
56
|
+
__UserRequestedAnalyze
|
|
57
|
+
});
|
|
51
58
|
return;
|
|
52
59
|
}
|
|
53
|
-
await this.executeScript((userRequestedAnalyze) => {
|
|
60
|
+
const result = await this.executeScript((userRequestedAnalyze) => {
|
|
54
61
|
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) {
|
|
55
|
-
return Promise.resolve();
|
|
62
|
+
return Promise.resolve({ message: 'Skipped - Invalid protocol' });
|
|
56
63
|
}
|
|
57
64
|
return new Promise(resolve => {
|
|
58
|
-
const fn = () => {
|
|
65
|
+
const fn = (event) => {
|
|
59
66
|
window.removeEventListener('axe:manual-mode-analyze-done', fn);
|
|
60
|
-
resolve();
|
|
67
|
+
resolve(event.detail);
|
|
61
68
|
};
|
|
62
69
|
window.addEventListener('axe:manual-mode-analyze-done', fn);
|
|
63
70
|
const event = new CustomEvent('axe:manual-mode-analyze', {
|
|
@@ -66,8 +73,10 @@ class Controller {
|
|
|
66
73
|
window.dispatchEvent(event);
|
|
67
74
|
});
|
|
68
75
|
}, __UserRequestedAnalyze);
|
|
76
|
+
this.debugLogger(`Analyze: ${result.message}`);
|
|
69
77
|
}
|
|
70
78
|
async flush() {
|
|
79
|
+
this.debugLogger('Flush: Invoked (may analyze implicitly)');
|
|
71
80
|
const results = await this.executeScript(() => {
|
|
72
81
|
if (!['http:', 'https:', 'file:'].includes(window.location.protocol)) {
|
|
73
82
|
return Promise.resolve([]);
|
|
@@ -88,7 +97,12 @@ class Controller {
|
|
|
88
97
|
window.dispatchEvent(event);
|
|
89
98
|
});
|
|
90
99
|
});
|
|
91
|
-
|
|
100
|
+
this.debugLogger(`Flush: Received ${results.length} results`);
|
|
101
|
+
await (0, sendResultsToServer_1.default)({
|
|
102
|
+
results,
|
|
103
|
+
debugLogger: this.debugLogger
|
|
104
|
+
});
|
|
105
|
+
this.debugLogger('Flush: Complete');
|
|
92
106
|
}
|
|
93
107
|
}
|
|
94
108
|
exports.default = Controller;
|
package/dist/Controller.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Controller.js","sourceRoot":"","sources":["../src/Controller.ts"],"names":[],"mappings":";;;;;AAAA,iCAA0C;AAC1C,gFAAwE;
|
|
1
|
+
{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,CAAC,CAAA;oBACvD,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,WAAyB,CAAC,CAAA;oBACnE,OAAO,CAAC,eAAe,CAAC,CAAA;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;gBACpD,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,iBAAiB,CAAC,CAAA;gBAChD,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;YAC7B,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,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/EventForwarder.js
CHANGED
|
@@ -34,12 +34,10 @@ class EventForwarder {
|
|
|
34
34
|
.reduce((prevLaunchOptions, listener) => listener(browser, prevLaunchOptions), launchOptions));
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
});
|
|
37
|
+
for (const listener of this.emitter.listeners(event)) {
|
|
38
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
39
|
+
on(event, listener);
|
|
40
|
+
}
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
}
|
|
@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,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;oBACrD,iEAAiE;oBACjE,EAAE,CAAC,KAAY,EAAE,QAAQ,CAAC,CAAA;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED,kBAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import debug from 'debug';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a debug logger with the given namespace
|
|
4
|
+
*
|
|
5
|
+
* @param namespace The namespace for the debug logger for example: `PlaywrightController` or `PlaywrightWrapping`.
|
|
6
|
+
* @returns debug instance
|
|
7
|
+
*/
|
|
8
|
+
declare function createDebugger(namespace: string): debug.Debugger;
|
|
9
|
+
export default createDebugger;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const debug_1 = __importDefault(require("debug"));
|
|
7
|
+
/**
|
|
8
|
+
* The prefix for the debug logger allows users to filter logs by the prefix
|
|
9
|
+
* using the debug package.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```bash
|
|
13
|
+
* DEBUG=axe-watcher:* yarn test
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
const NAMESPACE_PREFIX = 'axe-watcher';
|
|
17
|
+
/**
|
|
18
|
+
* Creates a debug logger with the given namespace
|
|
19
|
+
*
|
|
20
|
+
* @param namespace The namespace for the debug logger for example: `PlaywrightController` or `PlaywrightWrapping`.
|
|
21
|
+
* @returns debug instance
|
|
22
|
+
*/
|
|
23
|
+
function createDebugger(namespace) {
|
|
24
|
+
return (0, debug_1.default)(`${NAMESPACE_PREFIX}:${namespace}`);
|
|
25
|
+
}
|
|
26
|
+
exports.default = createDebugger;
|
|
27
|
+
//# sourceMappingURL=createDebugger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDebugger.js","sourceRoot":"","sources":["../src/createDebugger.ts"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAEzB;;;;;;;;GAQG;AACH,MAAM,gBAAgB,GAAG,aAAa,CAAA;AAEtC;;;;;GAKG;AAEH,SAAS,cAAc,CAAC,SAAiB;IACvC,OAAO,IAAA,eAAK,EAAC,GAAG,gBAAgB,IAAI,SAAS,EAAE,CAAC,CAAA;AAClD,CAAC;AAED,kBAAe,cAAc,CAAA"}
|
package/dist/cypress.js
CHANGED
|
@@ -4,10 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.cypressConfig = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
7
|
const util_1 = require("./util");
|
|
9
8
|
const sendResultsToServer_1 = __importDefault(require("./sendResultsToServer"));
|
|
10
9
|
const EventForwarder_1 = __importDefault(require("./EventForwarder"));
|
|
10
|
+
const createDebugger_1 = __importDefault(require("./createDebugger"));
|
|
11
|
+
const debugLogger = (0, createDebugger_1.default)('CypressController');
|
|
11
12
|
/**
|
|
12
13
|
* Create a Cypress config that uses the axe Watcher extension.
|
|
13
14
|
*
|
|
@@ -15,6 +16,8 @@ const EventForwarder_1 = __importDefault(require("./EventForwarder"));
|
|
|
15
16
|
*/
|
|
16
17
|
const cypressConfig = (config) => {
|
|
17
18
|
const { axe, ...userConfig } = config;
|
|
19
|
+
const { DEBUG } = process.env;
|
|
20
|
+
const hasWatcherDebug = DEBUG && DEBUG.includes('axe-watcher');
|
|
18
21
|
(0, util_1.writeVariables)({
|
|
19
22
|
...axe,
|
|
20
23
|
// Let the extension know to check for Cypress frames.
|
|
@@ -30,6 +33,12 @@ const cypressConfig = (config) => {
|
|
|
30
33
|
]
|
|
31
34
|
});
|
|
32
35
|
return {
|
|
36
|
+
...(hasWatcherDebug && {
|
|
37
|
+
env: {
|
|
38
|
+
...config.env,
|
|
39
|
+
__AXE_WATCHER_DEBUG: hasWatcherDebug
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
33
42
|
...userConfig,
|
|
34
43
|
e2e: {
|
|
35
44
|
...userConfig.e2e,
|
|
@@ -61,53 +70,40 @@ const cypressConfig = (config) => {
|
|
|
61
70
|
* ensure we wait for the user's `setupNodeEvents` to resolve.
|
|
62
71
|
*/
|
|
63
72
|
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));
|
|
64
|
-
on('
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
on('task', {
|
|
74
|
+
__uploadAxeWatcherResults: async (results) => {
|
|
75
|
+
if (!results.length) {
|
|
76
|
+
// Indicates to Cypress that the event has been handled.
|
|
77
|
+
// @see https://docs.cypress.io/api/commands/task#Usage
|
|
78
|
+
return null;
|
|
70
79
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (value) {
|
|
81
|
-
prev[key].push(value);
|
|
82
|
-
}
|
|
83
|
-
return prev;
|
|
84
|
-
}, {});
|
|
85
|
-
launchOptions.args = Object.entries(launchOptionsArgs).map(([key, value]) => value.length > 0 ? [key, value.join(',')].join('=') : key);
|
|
80
|
+
await (0, sendResultsToServer_1.default)({
|
|
81
|
+
results,
|
|
82
|
+
debugLogger
|
|
83
|
+
});
|
|
84
|
+
return null;
|
|
85
|
+
},
|
|
86
|
+
__debugAxeWatcher: (message) => {
|
|
87
|
+
debugLogger(message);
|
|
88
|
+
return null;
|
|
86
89
|
}
|
|
87
|
-
return launchOptions;
|
|
88
90
|
});
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
.filter(f => f.endsWith('.json'));
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
// this is a non-error; the test suite likely just failed early
|
|
99
|
-
// without running any scans
|
|
100
|
-
if (error.code === 'ENOENT') {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
throw error;
|
|
91
|
+
on('before:browser:launch', (browser, launchOptions) => {
|
|
92
|
+
// We only officially support Chrome, but for backcompat we are permissive and accept other
|
|
93
|
+
// Chromium-based browsers (eg, "chromium", "chrome:beta", "edge").
|
|
94
|
+
if (browser.name.startsWith('firefox') ||
|
|
95
|
+
browser.name.startsWith('electron')) {
|
|
96
|
+
throw new Error(`The @axe-core/watcher package only supports running in Chrome, but Cypress is configured with browser "${browser.name}". Please refer to our System Requirements for more information: https://docs.deque.com/developer-hub/2/en/dh-system-requirements`);
|
|
104
97
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const parsed = JSON.parse(data);
|
|
108
|
-
await (0, sendResultsToServer_1.default)(parsed);
|
|
109
|
-
fs_1.default.unlinkSync(`cypress/axe-watcher/${result}`);
|
|
98
|
+
if (browser.isHeadless && launchOptions.args.includes('--headless')) {
|
|
99
|
+
throw new util_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.');
|
|
110
100
|
}
|
|
101
|
+
// Load the extension. Merge extension args if provided by the user
|
|
102
|
+
const existingArgs = launchOptions.args;
|
|
103
|
+
launchOptions.args = (0, util_1.mergeChromeArgs)(existingArgs, {
|
|
104
|
+
disableOtherExtensions: false
|
|
105
|
+
});
|
|
106
|
+
return launchOptions;
|
|
111
107
|
});
|
|
112
108
|
/**
|
|
113
109
|
* Forward the accumulated events to cypress.
|
package/dist/cypress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress.js","sourceRoot":"","sources":["../src/cypress.ts"],"names":[],"mappings":";;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"cypress.js","sourceRoot":"","sources":["../src/cypress.ts"],"names":[],"mappings":";;;;;;AACA,iCAMe;AACf,gFAAwE;AACxE,sEAA6C;AAC7C,sEAA6C;AAE7C,MAAM,WAAW,GAAG,IAAA,wBAAc,EAAC,mBAAmB,CAAC,CAAA;AAEvD;;;;GAIG;AAEI,MAAM,aAAa,GAAG,CAC3B,MAA6C,EACtB,EAAE;IACzB,MAAM,EAAE,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IACrC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,GAAG,CAAA;IAC7B,MAAM,eAAe,GAAG,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;IAE9D,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,CAAC,eAAe,IAAI;YACrB,GAAG,EAAE;gBACH,GAAG,MAAM,CAAC,GAAG;gBACb,mBAAmB,EAAE,eAAe;aACrC;SACF,CAAC;QACF,GAAG,UAAU;QACb,GAAG,EAAE;YACH,GAAG,UAAU,CAAC,GAAG;YACjB,KAAK,CAAC,eAAe,CACnB,SAAS,EACT,GAAG,IAAI;;gBAEP;;;;;;;;;;mBAUG;gBACH,MAAM,cAAc,GAAG,IAAI,wBAAc,EAAE,CAAA;gBAC3C,MAAM,EAAE,GAAG,cAAc,CAAC,EAAE,CAAA;gBAE5B;;;;;;;;;;;mBAWG;gBACH,MAAM,mBAAmB,G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a,CAAA;gBACtB,CAAC,CAAC,CAAA;gBAEF;;;mBAGG;gBACH,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;gBAEjC,OAAO,mBAAmB,CAAA;YAC5B,CAAC;SACF;KACF,CAAA;AACH,CAAC,CAAA;AA3HY,QAAA,aAAa,iBA2HzB"}
|
|
@@ -12,6 +12,7 @@ declare global {
|
|
|
12
12
|
axeFlush(): Chainable<void>;
|
|
13
13
|
/** Perform an axe-core analysis. */
|
|
14
14
|
axeWatcherAnalyze(params?: {
|
|
15
|
+
__Method?: string;
|
|
15
16
|
__UserRequestedAnalyze?: boolean;
|
|
16
17
|
}): Chainable<void>;
|
|
17
18
|
/**
|
|
@@ -20,6 +21,7 @@ declare global {
|
|
|
20
21
|
* @Deprecated Use cy.axeWatcherAnalyze() instead
|
|
21
22
|
*/
|
|
22
23
|
axeAnalyze(params?: {
|
|
24
|
+
__Method?: string;
|
|
23
25
|
__UserRequestedAnalyze?: boolean;
|
|
24
26
|
}): Chainable<void>;
|
|
25
27
|
/**
|
|
@@ -42,9 +44,6 @@ declare global {
|
|
|
42
44
|
* @Deprecated Use cy.axeWatcherStop() instead
|
|
43
45
|
*/
|
|
44
46
|
axeStop(): Chainable<void>;
|
|
45
|
-
/** Access Cypress internal state */
|
|
46
|
-
state(state: any): any;
|
|
47
|
-
subject?: () => any;
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
}
|
package/dist/cypressCommands.js
CHANGED
|
@@ -27,8 +27,17 @@ exports.WRAPPED_COMMANDS = [
|
|
|
27
27
|
'trigger',
|
|
28
28
|
'type',
|
|
29
29
|
'uncheck',
|
|
30
|
+
'visit',
|
|
30
31
|
'wait'
|
|
31
32
|
];
|
|
33
|
+
/** Helper function to log debug messages */
|
|
34
|
+
const logDebugAxeWatcher = ({ message }) => {
|
|
35
|
+
// perf: we only want to log debug messages if the env has been set
|
|
36
|
+
// so it doesn't enqueue a Cypress command
|
|
37
|
+
if (Cypress.env('__AXE_WATCHER_DEBUG')) {
|
|
38
|
+
cy.task('__debugAxeWatcher', message, { log: false });
|
|
39
|
+
}
|
|
40
|
+
};
|
|
32
41
|
const shouldAnalyzeLocation = (location) => ['http:', 'https:', 'file:'].includes(location.protocol);
|
|
33
42
|
/**
|
|
34
43
|
* Wrapped commands queue an axe run before calling the original method. This can seem
|
|
@@ -39,8 +48,11 @@ const shouldAnalyzeLocation = (location) => ['http:', 'https:', 'file:'].include
|
|
|
39
48
|
* The last command that runs relies on the flush to catch the last page state.
|
|
40
49
|
*/
|
|
41
50
|
exports.WRAPPED_COMMANDS.forEach(method => Cypress.Commands.overwrite(method, (originalFn, ...args) => {
|
|
42
|
-
var _a, _b, _c;
|
|
51
|
+
var _a, _b, _c, _d, _e, _f;
|
|
43
52
|
const currentCommand = (_b = (_a = cy.state('current')) === null || _a === void 0 ? void 0 : _a.attributes) === null || _b === void 0 ? void 0 : _b.name;
|
|
53
|
+
// TODO: Remove the feature flag once #1109 is fully resolved.
|
|
54
|
+
const tryRequerySubject = !!Cypress.env('__AXE_WATCHER_CYPRESS_REQUERY_SUBJECT_AFTER_ANALYZE') &&
|
|
55
|
+
'getSubjectFromChain' in cy;
|
|
44
56
|
// Some commands, like "type" call other commands internally, like "click".
|
|
45
57
|
// We don't want to enqueue a run in these scenarios because it can cause
|
|
46
58
|
// promises to be returned from commands, which Cypress does not allow.
|
|
@@ -48,65 +60,56 @@ exports.WRAPPED_COMMANDS.forEach(method => Cypress.Commands.overwrite(method, (o
|
|
|
48
60
|
if (currentCommand && currentCommand !== method) {
|
|
49
61
|
return originalFn(...args);
|
|
50
62
|
}
|
|
51
|
-
//
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*/
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
-
;
|
|
63
|
-
win.__AXE_WATCHER_HAS_VISITED = true;
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
.axeWatcherAnalyze({ __UserRequestedAnalyze: false })
|
|
67
|
-
// Set the subject back to the previous subject
|
|
68
|
-
.then(() => subject)
|
|
69
|
-
.then(() => originalFn(...args));
|
|
70
|
-
}));
|
|
71
|
-
/**
|
|
72
|
-
* The `visit` command is wrapped differently than the other commands. This is because
|
|
73
|
-
* we need to actually visit and load the page before we can run axe.
|
|
74
|
-
*
|
|
75
|
-
* We queue an axe run, run the original visit command, and then mark
|
|
76
|
-
* the page visited before returning visit result.
|
|
77
|
-
*/
|
|
78
|
-
Cypress.Commands.overwrite('visit', (originalFn, ...args) => {
|
|
79
|
-
// We use `cy.wrap(null)` here just to get into the Cypress command queue.
|
|
80
|
-
cy.wrap(null)
|
|
81
|
-
.axeWatcherAnalyze({ __UserRequestedAnalyze: false })
|
|
82
|
-
.then(() => originalFn(...args))
|
|
83
|
-
.then(visitResult => {
|
|
84
|
-
cy.window()
|
|
85
|
-
.then(win => {
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
-
if (win && !win.__AXE_WATCHER_HAS_VISITED) {
|
|
88
|
-
/**
|
|
89
|
-
* Set a flag on the Window to indicate that a wrapped method has been called.
|
|
90
|
-
* This is used to determine whether we should call `axeFlush` after the test.
|
|
91
|
-
*/
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
-
;
|
|
94
|
-
win.__AXE_WATCHER_HAS_VISITED = true;
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
.then(() => visitResult);
|
|
63
|
+
// The "Subject" is a handle to the current DOM element(s) that the command is acting on.
|
|
64
|
+
const originalSubject = (_d = (_c = cy).subject) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
65
|
+
// The "Subject Chain" represents the chain of Cypress selection operations that lead up
|
|
66
|
+
// to finding the "Subject". cy.getSubjectFromChain() requeries those operations to retrieve
|
|
67
|
+
// a fresh "Subject" handle.
|
|
68
|
+
const originalSubjectChain = (_f = (_e = cy).subjectChain) === null || _f === void 0 ? void 0 : _f.call(_e);
|
|
69
|
+
const commandChain = cy.window().axeWatcherAnalyze({
|
|
70
|
+
__Method: method,
|
|
71
|
+
__UserRequestedAnalyze: false
|
|
98
72
|
});
|
|
99
|
-
|
|
73
|
+
if (tryRequerySubject) {
|
|
74
|
+
commandChain
|
|
75
|
+
// axeWatcherAnalyze is slow; it's possible for the Cypress subject to become invalidated
|
|
76
|
+
// while it's running (eg, if the subject is in some sort of remount-loop). To account for
|
|
77
|
+
// this, we ask Cypress to requery the subject object from the subjectChain before returning
|
|
78
|
+
// control to the original function.
|
|
79
|
+
//
|
|
80
|
+
// Note that we don't always have access to an original subjectChain to restore; the API is
|
|
81
|
+
// only available in Cypress 12+, and even then we might be wrapping a command that doesn't
|
|
82
|
+
// necessarily operate on a subject.
|
|
83
|
+
.then(() => {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
// Some Cypress commands pick up the subject from cy.subject(), and some pick it up from a
|
|
86
|
+
// subject parameter that's passed to the command. Returning the updated subject from this
|
|
87
|
+
// .then() sets cy.subject() to handle the former...
|
|
88
|
+
return originalSubjectChain &&
|
|
89
|
+
((_b = (_a = cy).getSubjectFromChain) === null || _b === void 0 ? void 0 : _b.call(_a, originalSubjectChain));
|
|
90
|
+
})
|
|
91
|
+
.then(updatedSubject => {
|
|
92
|
+
// ...and this map handles the latter.
|
|
93
|
+
const argsWithRefreshedSubject = args.map(arg => originalSubject && arg === originalSubject ? updatedSubject : arg);
|
|
94
|
+
// originalFn might return a Promise that Cypress needs to be able to track, so it's important
|
|
95
|
+
// to propagate its return value even though we're not chaining any further cypress commands
|
|
96
|
+
// ourselves.
|
|
97
|
+
return originalFn(...argsWithRefreshedSubject);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
commandChain
|
|
102
|
+
// Set the subject back to the previous subject
|
|
103
|
+
.then(() => originalSubject)
|
|
104
|
+
.then(() => originalFn(...args));
|
|
105
|
+
}
|
|
106
|
+
}));
|
|
100
107
|
function axeWatcherFlushCommand() {
|
|
108
|
+
logDebugAxeWatcher({ message: 'Flush: Invoked (may analyze implicitly)' });
|
|
101
109
|
cy.window().then(win => {
|
|
102
110
|
if (!shouldAnalyzeLocation(win.location)) {
|
|
103
111
|
return Promise.resolve();
|
|
104
112
|
}
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
|
-
const hasVisited = win.__AXE_WATCHER_HAS_VISITED;
|
|
107
|
-
if (!hasVisited) {
|
|
108
|
-
return Promise.resolve();
|
|
109
|
-
}
|
|
110
113
|
return new Promise(resolve => {
|
|
111
114
|
const results = [];
|
|
112
115
|
const onAxeResult = (event) => {
|
|
@@ -115,7 +118,6 @@ function axeWatcherFlushCommand() {
|
|
|
115
118
|
const onFlushEnd = () => {
|
|
116
119
|
win.removeEventListener('axe:flush-end', onFlushEnd);
|
|
117
120
|
win.removeEventListener('axe:result', onAxeResult);
|
|
118
|
-
win.__AXE_WATCHER_HAS_VISITED = false;
|
|
119
121
|
resolve(results);
|
|
120
122
|
};
|
|
121
123
|
win.addEventListener('axe:flush-end', onFlushEnd);
|
|
@@ -123,11 +125,8 @@ function axeWatcherFlushCommand() {
|
|
|
123
125
|
const event = new CustomEvent('axe:flush-start');
|
|
124
126
|
win.dispatchEvent(event);
|
|
125
127
|
}).then(results => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const rnd = Math.random().toString(36).slice(2);
|
|
129
|
-
const filename = `cypress/axe-watcher/${time}-${rnd}.json`;
|
|
130
|
-
cy.writeFile(filename, JSON.stringify(results, null, 2));
|
|
128
|
+
cy.task('__uploadAxeWatcherResults', results, { log: false });
|
|
129
|
+
logDebugAxeWatcher({ message: 'Flush: complete' });
|
|
131
130
|
});
|
|
132
131
|
});
|
|
133
132
|
}
|
|
@@ -135,26 +134,31 @@ const doesCypressCommandExist = (commandName) => {
|
|
|
135
134
|
//@ts-expect-error - Property 'cy' does not exist on type 'Cypress & CyEventEmitter'.ts(2339)
|
|
136
135
|
return !!Cypress.cy[commandName];
|
|
137
136
|
};
|
|
138
|
-
function axeWatcherAnalyzeCommand({ __UserRequestedAnalyze = true } = {}) {
|
|
137
|
+
function axeWatcherAnalyzeCommand({ __Method, __UserRequestedAnalyze = true } = {}) {
|
|
138
|
+
logDebugAxeWatcher({
|
|
139
|
+
message: `Analyze: Invoked${__Method ? ` - ${__Method}` : ''}`
|
|
140
|
+
});
|
|
139
141
|
const userRequestedAnalyze = __UserRequestedAnalyze;
|
|
140
142
|
cy.window().then(win => {
|
|
141
143
|
if (!shouldAnalyzeLocation(win.location)) {
|
|
142
|
-
return Promise.resolve();
|
|
144
|
+
return Promise.resolve({ message: `Skipped - Invalid protocol` });
|
|
143
145
|
}
|
|
144
146
|
// If the user didn't request an analyze, and we're in manual mode, don't do anything.
|
|
145
147
|
if (isStopped && !userRequestedAnalyze) {
|
|
146
|
-
return Promise.resolve();
|
|
148
|
+
return Promise.resolve({ message: `Skipped (Manual mode)` });
|
|
147
149
|
}
|
|
148
150
|
return new Promise(resolve => {
|
|
149
|
-
const fn = () => {
|
|
151
|
+
const fn = (event) => {
|
|
150
152
|
win.removeEventListener('axe:manual-mode-analyze-done', fn);
|
|
151
|
-
resolve();
|
|
153
|
+
resolve(event.detail);
|
|
152
154
|
};
|
|
153
155
|
win.addEventListener('axe:manual-mode-analyze-done', fn);
|
|
154
156
|
const event = new CustomEvent('axe:manual-mode-analyze', {
|
|
155
157
|
detail: { userRequestedAnalyze }
|
|
156
158
|
});
|
|
157
159
|
win.dispatchEvent(event);
|
|
160
|
+
}).then(result => {
|
|
161
|
+
logDebugAxeWatcher({ message: `Analyze: ${result === null || result === void 0 ? void 0 : result.message}` });
|
|
158
162
|
});
|
|
159
163
|
});
|
|
160
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[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BAAiB,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
|
@@ -18,7 +18,8 @@ function playwrightConfig(opts) {
|
|
|
18
18
|
if (config.headless) {
|
|
19
19
|
throw new util_1.HeadlessNotSupportedError('In Playwright, include "--headless=new" in the "args" property of your options instead of using "headless: true"');
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
const existingArgs = args;
|
|
22
|
+
args = (0, util_1.mergeChromeArgs)(existingArgs, { disableOtherExtensions: true });
|
|
22
23
|
return {
|
|
23
24
|
...config,
|
|
24
25
|
headless: false,
|
|
@@ -28,7 +29,7 @@ function playwrightConfig(opts) {
|
|
|
28
29
|
exports.playwrightConfig = playwrightConfig;
|
|
29
30
|
class PlaywrightController extends Controller_1.default {
|
|
30
31
|
constructor(driver) {
|
|
31
|
-
super();
|
|
32
|
+
super({ debugLoggerName: 'PlaywrightController' });
|
|
32
33
|
this.driver = driver;
|
|
33
34
|
}
|
|
34
35
|
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":";;;;;;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,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BAA0C,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.js
CHANGED
|
@@ -17,6 +17,7 @@ const playwrightTest = (options) => {
|
|
|
17
17
|
let base;
|
|
18
18
|
let chromium;
|
|
19
19
|
try {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
20
21
|
;
|
|
21
22
|
({ test: base, chromium } = require('@playwright/test'));
|
|
22
23
|
}
|
|
@@ -33,7 +34,9 @@ const playwrightTest = (options) => {
|
|
|
33
34
|
context: async ({}, use) => {
|
|
34
35
|
const context = await chromium.launchPersistentContext('', {
|
|
35
36
|
...config,
|
|
36
|
-
args:
|
|
37
|
+
args: (0, util_1.mergeChromeArgs)(config.args || [], {
|
|
38
|
+
disableOtherExtensions: true
|
|
39
|
+
})
|
|
37
40
|
});
|
|
38
41
|
await use(context);
|
|
39
42
|
await context.close();
|