@axe-core/watcher 3.14.2-next.ffe74e2a → 3.14.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Controller.js +1 -0
- package/dist/Controller.js.map +1 -1
- package/dist/EventForwarder.js +7 -0
- package/dist/EventForwarder.js.map +1 -1
- package/dist/createDebugger.js +15 -0
- package/dist/createDebugger.js.map +1 -1
- package/dist/cypress.js +45 -0
- package/dist/cypress.js.map +1 -1
- package/dist/cypressCommands.js +68 -2
- package/dist/cypressCommands.js.map +1 -1
- package/dist/git.js +16 -0
- package/dist/git.js.map +1 -1
- package/dist/playwright.js +13 -1
- package/dist/playwright.js.map +1 -1
- package/dist/playwrightTest.js +15 -0
- package/dist/playwrightTest.js.map +1 -1
- package/dist/playwrightWrapping.js +11 -0
- package/dist/playwrightWrapping.js.map +1 -1
- package/dist/puppeteer.js +13 -1
- package/dist/puppeteer.js.map +1 -1
- package/dist/puppeteerWrapping.js +13 -2
- package/dist/puppeteerWrapping.js.map +1 -1
- package/dist/sendResultsToServer.js +15 -0
- package/dist/sendResultsToServer.js.map +1 -1
- package/dist/utils/constants.js +3 -0
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/initializeSession.js +7 -0
- package/dist/utils/initializeSession.js.map +1 -1
- package/dist/utils/initializeSession.test.js +6 -0
- package/dist/utils/initializeSession.test.js.map +1 -1
- package/dist/utils/mergeChromeArgs.js +40 -0
- package/dist/utils/mergeChromeArgs.js.map +1 -1
- package/dist/utils/mergeChromeArgs.test.js +3 -0
- package/dist/utils/mergeChromeArgs.test.js.map +1 -1
- package/dist/utils/proxyHandlers.js +19 -0
- package/dist/utils/proxyHandlers.js.map +1 -1
- package/dist/utils/proxyHandlers.test.js +1 -0
- package/dist/utils/proxyHandlers.test.js.map +1 -1
- package/dist/utils/readVariables.js +4 -0
- package/dist/utils/readVariables.js.map +1 -1
- package/dist/utils/updateAutoAnalyze.js +5 -0
- package/dist/utils/updateAutoAnalyze.js.map +1 -1
- package/dist/utils/validateAxeRunContext.js +16 -0
- package/dist/utils/validateAxeRunContext.js.map +1 -1
- package/dist/utils/validateAxeRunContext.test.js +3 -0
- package/dist/utils/validateAxeRunContext.test.js.map +1 -1
- package/dist/utils/validateAxeRunOptions.js +51 -0
- package/dist/utils/validateAxeRunOptions.js.map +1 -1
- package/dist/utils/validateAxeRunOptions.test.js +15 -0
- package/dist/utils/validateAxeRunOptions.test.js.map +1 -1
- package/dist/utils/writeExtensionManifest.js +1 -0
- package/dist/utils/writeExtensionManifest.js.map +1 -1
- package/dist/utils/writeVariables.js +14 -1
- package/dist/utils/writeVariables.js.map +1 -1
- package/dist/utils/writeVariables.test.js +1 -0
- package/dist/utils/writeVariables.test.js.map +1 -1
- package/dist/wdio.d.ts +3 -5
- package/dist/wdio.js +20 -0
- package/dist/wdio.js.map +1 -1
- package/dist/webdriver.js +12 -1
- package/dist/webdriver.js.map +1 -1
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/package.json +5 -5
package/dist/Controller.js
CHANGED
@@ -49,6 +49,7 @@ class Controller {
|
|
49
49
|
}
|
50
50
|
async analyze({ __Method, __UserRequestedAnalyze = true } = {}) {
|
51
51
|
this.debugLogger(`Analyze: Invoked${__Method ? ` - ${__Method}` : ''}`);
|
52
|
+
// If the user didn't request an analyze, and we're in manual mode, don't do anything.
|
52
53
|
if (this.isStopped && !__UserRequestedAnalyze) {
|
53
54
|
this.debugLogger('Analyze: Skipped', {
|
54
55
|
isStopped: this.isStopped,
|
package/dist/Controller.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Controller.js","sourceRoot":"","sources":["../src/Controller.ts"],"names":[],"mappings":";;;;;AAAA,kFAAyD;AACzD,gFAAwE;AACxE,sEAA6C;AAQ7C,MAAe,UAAU;IASvB,YAAY,EAAE,eAAe,EAAoB;QAHvC,cAAS,GAAG,KAAK,CAAA;QAIzB,IAAI,CAAC,WAAW,GAAG,IAAA,wBAAc,EAAC,eAAe,CAAC,CAAA;IACpD,CAAC;IAEM,KAAK,CA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E,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
@@ -17,11 +17,17 @@ class EventForwarder {
|
|
17
17
|
}
|
18
18
|
};
|
19
19
|
}
|
20
|
+
/**
|
21
|
+
* Forwards all the events registered so far to cypress
|
22
|
+
*/
|
20
23
|
forward(on) {
|
21
24
|
if (Object.keys(this.tasks).length > 0) {
|
22
25
|
on('task', this.tasks);
|
23
26
|
}
|
24
27
|
for (const event of this.emitter.eventNames()) {
|
28
|
+
// We handle `before:browser:launch` event differently than others because
|
29
|
+
// this handler is expected to return launchOptions while other handlers
|
30
|
+
// do not return value.
|
25
31
|
if (event === 'before:browser:launch') {
|
26
32
|
on('before:browser:launch', (browser, launchOptions) => this.emitter
|
27
33
|
.listeners(event)
|
@@ -29,6 +35,7 @@ class EventForwarder {
|
|
29
35
|
}
|
30
36
|
else {
|
31
37
|
for (const listener of this.emitter.listeners(event)) {
|
38
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
32
39
|
on(event, listener);
|
33
40
|
}
|
34
41
|
}
|
@@ -1 +1 @@
|
|
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,EAAE,CAAC;gBACtB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;YAC/B,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,OA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,EACpD,aAAa,CACd,CACN,CAAA;YACH,CAAC;iBAAM,CAAC;gBACN,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,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"}
|
package/dist/createDebugger.js
CHANGED
@@ -4,7 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
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
|
+
*/
|
7
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
|
+
*/
|
8
23
|
function createDebugger(namespace) {
|
9
24
|
return (0, debug_1.default)(`${NAMESPACE_PREFIX}:${namespace}`);
|
10
25
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createDebugger.js","sourceRoot":"","sources":["../src/createDebugger.ts"],"names":[],"mappings":";;;;;AAAA,kDAAyB;
|
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
@@ -13,6 +13,11 @@ const mergeChromeArgs_1 = __importDefault(require("./utils/mergeChromeArgs"));
|
|
13
13
|
const createDebugger_1 = __importDefault(require("./createDebugger"));
|
14
14
|
const debugLogger = (0, createDebugger_1.default)('CypressController');
|
15
15
|
exports.cypressConfigRunFlag = '__AXE_WATCHER_CYPRESS_CONFIG_RUN';
|
16
|
+
/**
|
17
|
+
* Create a Cypress config that uses the axe Watcher extension.
|
18
|
+
*
|
19
|
+
* @param config Cypress config to extend
|
20
|
+
*/
|
16
21
|
const cypressConfig = (config) => {
|
17
22
|
var _a;
|
18
23
|
const { axe, ...userConfig } = config;
|
@@ -20,12 +25,15 @@ const cypressConfig = (config) => {
|
|
20
25
|
const hasWatcherDebug = DEBUG && DEBUG.includes('axe-watcher');
|
21
26
|
(0, writeVariables_1.default)({
|
22
27
|
...axe,
|
28
|
+
// Let the extension know to check for Cypress frames.
|
23
29
|
cypress: true
|
24
30
|
});
|
25
31
|
(0, writeExtensionManifest_1.default)({
|
26
32
|
all_frames: true,
|
27
33
|
exclude_globs: [
|
34
|
+
// Top-level Cypress page.
|
28
35
|
'*/__/#/specs/runner?file=*',
|
36
|
+
// Cypress-specific iframes.
|
29
37
|
'*/__cypress/iframes/*'
|
30
38
|
]
|
31
39
|
});
|
@@ -39,6 +47,7 @@ const cypressConfig = (config) => {
|
|
39
47
|
[exports.cypressConfigRunFlag]: true
|
40
48
|
});
|
41
49
|
}
|
50
|
+
// TODO: ensure that __AXE_WATCHER_DEBUG is being set in each scenario, including in the e2e.env. See https://github.com/dequelabs/jazzband/pull/1290
|
42
51
|
if (hasWatcherDebug) {
|
43
52
|
userConfig.env = Object.assign({}, userConfig.env, {
|
44
53
|
__AXE_WATCHER_DEBUG: hasWatcherDebug
|
@@ -50,10 +59,37 @@ const cypressConfig = (config) => {
|
|
50
59
|
...userConfig.e2e,
|
51
60
|
async setupNodeEvents(cypressOn, ...args) {
|
52
61
|
var _a, _b;
|
62
|
+
/**
|
63
|
+
* If the user supplies `setupNodeEvents` config and registers events using `on` handler
|
64
|
+
* provided by cypress, the users' custom events are overridden by ours.
|
65
|
+
* @see https://github.com/dequelabs/jazzband/issues/668
|
66
|
+
*
|
67
|
+
* Here instead of registering the same event multiple times either by user or us,
|
68
|
+
* we accumulate the events registered using `EventForwarder` which is proposed by David Sveningsson.
|
69
|
+
* @see https://github.com/cypress-io/cypress/issues/5240#issuecomment-1462214696
|
70
|
+
*
|
71
|
+
* Afterwards, we forward the accumulated events to cypress `on` handler.
|
72
|
+
*/
|
53
73
|
const eventForwarder = new EventForwarder_1.default();
|
54
74
|
const on = eventForwarder.on;
|
75
|
+
/**
|
76
|
+
* If the user supplies their own `setupNodeEvents` config we need to:
|
77
|
+
*
|
78
|
+
* 1. Call the user's `setupNodeEvents` config so that they can register their own events and tasks (if supplied)
|
79
|
+
* 2. Forward the accumulated events to the user's `on` handler.
|
80
|
+
* 3. Store the return value of the user's `setupNodeEvents` config
|
81
|
+
* This is __important__ because the user may have mounted a Cypress plugin that sets
|
82
|
+
* specific `cypress.env` variables that we need to propagate after merging our own events.
|
83
|
+
*
|
84
|
+
* Note: The user __can__ make `setupNodeEvents` async,
|
85
|
+
* ensure we wait for the user's `setupNodeEvents` to resolve.
|
86
|
+
*/
|
55
87
|
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
88
|
if (userNodeEventConfig) {
|
89
|
+
/*
|
90
|
+
The user-provided `setupNodeEvents` returned a new config, which will override the env we set above,
|
91
|
+
so we set it again
|
92
|
+
*/
|
57
93
|
userNodeEventConfig.env = Object.assign({}, userNodeEventConfig.env, {
|
58
94
|
[exports.cypressConfigRunFlag]: true
|
59
95
|
});
|
@@ -61,6 +97,8 @@ const cypressConfig = (config) => {
|
|
61
97
|
on('task', {
|
62
98
|
__uploadAxeWatcherResults: async ({ results, skipped_url }) => {
|
63
99
|
if (!(results === null || results === void 0 ? void 0 : results.length) && !skipped_url) {
|
100
|
+
// Indicates to Cypress that the event has been handled.
|
101
|
+
// @see https://docs.cypress.io/api/commands/task#Usage
|
64
102
|
return null;
|
65
103
|
}
|
66
104
|
await (0, sendResultsToServer_1.default)({
|
@@ -76,6 +114,8 @@ const cypressConfig = (config) => {
|
|
76
114
|
}
|
77
115
|
});
|
78
116
|
on('before:browser:launch', (browser, launchOptions) => {
|
117
|
+
// We only officially support Chrome, but for backcompat we are permissive and accept other
|
118
|
+
// Chromium-based browsers (eg, "chromium", "chrome:beta", "edge").
|
79
119
|
if (browser.name.startsWith('firefox') ||
|
80
120
|
browser.name.startsWith('electron')) {
|
81
121
|
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`);
|
@@ -83,12 +123,17 @@ const cypressConfig = (config) => {
|
|
83
123
|
if (browser.isHeadless && launchOptions.args.includes('--headless')) {
|
84
124
|
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
125
|
}
|
126
|
+
// Load the extension. Merge extension args if provided by the user
|
86
127
|
const existingArgs = launchOptions.args;
|
87
128
|
launchOptions.args = (0, mergeChromeArgs_1.default)(existingArgs, {
|
88
129
|
disableOtherExtensions: false
|
89
130
|
});
|
90
131
|
return launchOptions;
|
91
132
|
});
|
133
|
+
/**
|
134
|
+
* Forward the accumulated events to cypress.
|
135
|
+
* For more information, see comment on #44
|
136
|
+
*/
|
92
137
|
eventForwarder.forward(cypressOn);
|
93
138
|
return userNodeEventConfig;
|
94
139
|
}
|
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;AAE7C,MAAM,WAAW,GAAG,IAAA,wBAAc,EAAC,mBAAmB,CAAC,CAAA;AAE1C,QAAA,oBAAoB,GAAG,kCAAkC,CAAA;
|
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;AAE7C,MAAM,WAAW,GAAG,IAAA,wBAAc,EAAC,mBAAmB,CAAC,CAAA;AAE1C,QAAA,oBAAoB,GAAG,kCAAkC,CAAA;AAEtE;;;;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,wBAAc,EAAC;QACb,GAAG,GAAG;QACN,sDAAsD;QACtD,OAAO,EAAE,IAAI;KACd,CAAC,CAAA;IACF,IAAA,gCAAa,EAAC;QACZ,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE;YACb,0BAA0B;YAC1B,4BAA4B;YAC5B,4BAA4B;YAC5B,uBAAuB;SACxB;KACF,CAAC,CAAA;IAEF,IAAI,MAAA,UAAU,CAAC,GAAG,0CAAE,GAAG,EAAE,CAAC;QACxB,UAAU,CAAC,GAAG,C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gBAEjC,OAAO,mBAAmB,CAAA;YAC5B,CAAC;SACF;KACF,CAAA;AACH,CAAC,CAAA;AAjJY,QAAA,aAAa,iBAiJzB"}
|
package/dist/cypressCommands.js
CHANGED
@@ -2,7 +2,16 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.WRAPPED_COMMANDS = void 0;
|
4
4
|
const cypress_1 = require("./cypress");
|
5
|
+
/**
|
6
|
+
* Has the user stopped automatic mode.
|
7
|
+
*
|
8
|
+
* This code runs in the Cypress browser, so we're unable to
|
9
|
+
* read `variables.json` like we do with other integrations.
|
10
|
+
* As result, we need this top-level state for managing
|
11
|
+
* analyze calls created by "wrapped" methods.
|
12
|
+
*/
|
5
13
|
let isStopped = false;
|
14
|
+
/** Commands we wrap to help us identify new page states. */
|
6
15
|
exports.WRAPPED_COMMANDS = [
|
7
16
|
'blur',
|
8
17
|
'check',
|
@@ -22,38 +31,80 @@ exports.WRAPPED_COMMANDS = [
|
|
22
31
|
'visit',
|
23
32
|
'wait'
|
24
33
|
];
|
34
|
+
/** Helper function to log debug messages */
|
25
35
|
const logDebugAxeWatcher = ({ message }) => {
|
36
|
+
// perf: we only want to log debug messages if the env has been set
|
37
|
+
// so it doesn't enqueue a Cypress command
|
26
38
|
if (Cypress.env('__AXE_WATCHER_DEBUG')) {
|
27
39
|
cy.task('__debugAxeWatcher', message, { log: false });
|
28
40
|
}
|
29
41
|
};
|
30
42
|
const shouldAnalyzeLocation = (location) => ['http:', 'https:', 'file:'].includes(location.protocol);
|
43
|
+
// If cypressConfig was never invoked, fail immediately
|
31
44
|
if (!Cypress.env(cypress_1.cypressConfigRunFlag)) {
|
32
45
|
throw new Error(`Cypress is not configured for axe watcher. Please ensure that axe watcher's cypressConfig() is invoked within Cypress' defineConfig() in your ${Cypress.config('configFile')}. All tests will fail with this error.`);
|
33
46
|
}
|
47
|
+
/**
|
48
|
+
* Wrapped commands queue an axe run before calling the original method. This can seem
|
49
|
+
* a little counter-intuitive, but the reason we do this is so that we make sure we wait
|
50
|
+
* for the existing page state to be analyzed before performing our action.
|
51
|
+
*
|
52
|
+
* We rely on future commands to detect any new page state created by the current command.
|
53
|
+
* The last command that runs relies on the flush to catch the last page state.
|
54
|
+
*/
|
34
55
|
exports.WRAPPED_COMMANDS.forEach(method => Cypress.Commands.overwrite(method, (originalFn, ...args) => {
|
35
56
|
var _a, _b, _c, _d, _e;
|
36
57
|
const currentCommand = cy.state('current');
|
37
58
|
const currentCommandName = currentCommand === null || currentCommand === void 0 ? void 0 : currentCommand.get('name');
|
38
59
|
const currentCommandType = currentCommand === null || currentCommand === void 0 ? void 0 : currentCommand.get('type');
|
60
|
+
// TODO: Remove the feature flag once #1109 is fully resolved.
|
39
61
|
const tryRequerySubject = !!Cypress.env('__AXE_WATCHER_CYPRESS_REQUERY_SUBJECT_AFTER_ANALYZE') &&
|
40
62
|
'getSubjectFromChain' in cy;
|
63
|
+
// Some commands, like "type" call other commands internally, like "click".
|
64
|
+
// We don't want to enqueue a run in these scenarios because it can cause
|
65
|
+
// promises to be returned from commands, which Cypress does not allow.
|
66
|
+
// See: https://github.com/cypress-io/cypress/issues/19086
|
41
67
|
if (currentCommandName && currentCommandName !== method) {
|
42
68
|
return originalFn(...args);
|
43
69
|
}
|
70
|
+
// axeWatcherAnalyze is slow; it's possible for the Cypress subject to become invalidated
|
71
|
+
// while it's running (eg, if the subject is in some sort of remount-loop). To account for
|
72
|
+
// this, we ask Cypress to requery the subject object from the subjectChain before returning
|
73
|
+
// control to the original function.
|
74
|
+
// Note that we don't always have access to an original subjectChain to restore; the API is
|
75
|
+
// only available in Cypress 12+, and even then we might be wrapping a command that doesn't
|
76
|
+
// necessarily operate on a subject.
|
77
|
+
// The "Subject Chain" represents the chain of Cypress selection operations that lead up
|
78
|
+
// to finding the "Subject". cy.getSubjectFromChain() requeries those operations to retrieve
|
79
|
+
// a fresh "Subject" handle.
|
44
80
|
const originalSubject = (_b = (_a = cy).subject) === null || _b === void 0 ? void 0 : _b.call(_a);
|
45
81
|
const originalSubjectChain = (_d = (_c = cy).subjectChain) === null || _d === void 0 ? void 0 : _d.call(_c);
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
46
83
|
let commandChain = cy.window().axeWatcherAnalyze({
|
47
84
|
__Method: method,
|
48
85
|
__UserRequestedAnalyze: false
|
49
86
|
});
|
87
|
+
// This version has issues if the subject is remounting continuously because Cypress
|
88
|
+
// considers the ".then" to be an action (not a query) and so isn't willing to re-run
|
89
|
+
// it if necessary for actionability checks
|
90
|
+
//
|
91
|
+
// commandChain = commandChain.then(() => (cy as CyInternal).getSubjectFromChain!(originalSubjectChain))
|
92
|
+
//
|
50
93
|
if (tryRequerySubject) {
|
51
94
|
const timeout = (_e = args.find(arg => arg === null || arg === void 0 ? void 0 : arg.timeout)) === null || _e === void 0 ? void 0 : _e.timeout;
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
52
96
|
commandChain = commandChain.__axeRestoreSubject(originalSubjectChain, timeout);
|
53
|
-
|
97
|
+
// In all hooked cases, originalFn can have its own timeout.
|
98
|
+
// Setting our own very long timeout here both maintains the original timeout
|
99
|
+
// and correctly attributes an error thrown because of it to the originalFn timing out,
|
100
|
+
// rather than to our wrapper.
|
101
|
+
commandChain.then({ timeout: 999999 }, refreshedSubject => originalFn(
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
103
|
+
...updateSubject(args, currentCommandType, refreshedSubject)));
|
54
104
|
}
|
55
105
|
else {
|
56
106
|
commandChain
|
107
|
+
// Set the subject back to the previous subject
|
57
108
|
.then(() => originalSubject)
|
58
109
|
.then(() => originalFn(...args));
|
59
110
|
}
|
@@ -66,8 +117,15 @@ function updateSubject(args, commandType, refreshedSubject) {
|
|
66
117
|
return [refreshedSubject, ...args.slice(1)];
|
67
118
|
}
|
68
119
|
}
|
69
|
-
Cypress.Commands.addQuery(
|
120
|
+
Cypress.Commands.addQuery(
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
122
|
+
'__axeRestoreSubject',
|
123
|
+
// This must be a regular function because timeouts rely on `this`
|
124
|
+
// https://docs.cypress.io/api/cypress-api/custom-queries#Arguments
|
125
|
+
function (subjectChain, timeout) {
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
70
127
|
this.set('timeout', timeout);
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
71
129
|
this.set('onFail', (err) => {
|
72
130
|
const runner = cy.state('runnable');
|
73
131
|
err.codeFrame = runner.invocationDetails;
|
@@ -101,6 +159,7 @@ function axeWatcherFlushCommand() {
|
|
101
159
|
});
|
102
160
|
}
|
103
161
|
const doesCypressCommandExist = (commandName) => {
|
162
|
+
//@ts-expect-error - Property 'cy' does not exist on type 'Cypress & CyEventEmitter'.ts(2339)
|
104
163
|
return !!Cypress.cy[commandName];
|
105
164
|
};
|
106
165
|
function axeWatcherAnalyzeCommand({ __Method, __UserRequestedAnalyze = true } = {}) {
|
@@ -112,6 +171,7 @@ function axeWatcherAnalyzeCommand({ __Method, __UserRequestedAnalyze = true } =
|
|
112
171
|
if (!shouldAnalyzeLocation(win.location)) {
|
113
172
|
return Promise.resolve({ message: `Skipped - Invalid protocol` });
|
114
173
|
}
|
174
|
+
// If the user didn't request an analyze, and we're in manual mode, don't do anything.
|
115
175
|
if (isStopped && !userRequestedAnalyze) {
|
116
176
|
return Promise.resolve({ message: `Skipped (Manual mode)` });
|
117
177
|
}
|
@@ -166,11 +226,17 @@ function axeWatcherStopCommand() {
|
|
166
226
|
});
|
167
227
|
});
|
168
228
|
}
|
229
|
+
// Deprecated name; conflicts with @axe-devtools/cypress, should only be
|
230
|
+
// added if we don't see the other one already. Cypress uses the last-registered
|
231
|
+
// command, so this means that devtools will "win" the conflict.
|
169
232
|
if (!doesCypressCommandExist('axeAnalyze')) {
|
170
233
|
Cypress.Commands.add('axeAnalyze', axeWatcherAnalyzeCommand);
|
171
234
|
}
|
235
|
+
/** Deprecated: Replaced with `axeWatcherFlush` */
|
172
236
|
Cypress.Commands.add('axeFlush', axeWatcherFlushCommand);
|
237
|
+
/** Deprecated: Replaced with `axeWatcherStop` */
|
173
238
|
Cypress.Commands.add('axeStop', axeWatcherStopCommand);
|
239
|
+
/** Deprecated: Replaced with `axeWatcherStart` */
|
174
240
|
Cypress.Commands.add('axeStart', axeWatcherStartCommand);
|
175
241
|
Cypress.Commands.add('axeWatcherAnalyze', axeWatcherAnalyzeCommand);
|
176
242
|
Cypress.Commands.add('axeWatcherStart', axeWatcherStartCommand);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";;;AACA,uCAAgD;
|
1
|
+
{"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";;;AACA,uCAAgD;AAgGhD;;;;;;;GAOG;AAEH,IAAI,SAAS,GAAG,KAAK,CAAA;AAIrB,4DAA4D;AAC/C,QAAA,gBAAgB,GAAiC;IAC5D,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,UAAU;IACV,OAAO;IACP,IAAI;IACJ,QAAQ;IACR,gBAAgB;IAChB,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,SAAS;IACT,OAAO;IACP,MAAM;CACP,CAAA;AAOD,4CAA4C;AAC5C,MAAM,kBAAkB,GAAG,CAAC,EAAE,OAAO,EAA4B,EAAQ,EAAE;IACzE,mEAAmE;IACnE,0CAA0C;IAC1C,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC;QACvC,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAA;IACvD,CAAC;AACH,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,CAAC,QAAkB,EAAW,EAAE,CAC5D,CAAC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AAE,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/git.js
CHANGED
@@ -2,10 +2,12 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getTag = exports.isDirty = exports.getCommitInfo = exports.getRemoteURL = exports.parseDefaultFromShowRemoteOutput = exports.getDefaultBranchName = exports.getBranchName = exports.isRepository = void 0;
|
4
4
|
const child_process_1 = require("child_process");
|
5
|
+
/** Check if the given `dir` is contained by a Git repository. */
|
5
6
|
const isRepository = (dir = process.cwd()) => {
|
6
7
|
try {
|
7
8
|
(0, child_process_1.execSync)('git rev-parse --is-inside-work-tree', {
|
8
9
|
cwd: dir,
|
10
|
+
// Prevent printing "fatal: not a git repository".
|
9
11
|
stdio: 'ignore'
|
10
12
|
});
|
11
13
|
return true;
|
@@ -15,10 +17,12 @@ const isRepository = (dir = process.cwd()) => {
|
|
15
17
|
}
|
16
18
|
};
|
17
19
|
exports.isRepository = isRepository;
|
20
|
+
/** Get the current branch name. */
|
18
21
|
const getBranchName = (dir = process.cwd()) => {
|
19
22
|
try {
|
20
23
|
return (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', {
|
21
24
|
cwd: dir,
|
25
|
+
// Ignore stderr to prevent printing "fatal: not a git repository" in tests.
|
22
26
|
stdio: ['ignore', 'pipe', 'ignore']
|
23
27
|
})
|
24
28
|
.toString()
|
@@ -29,6 +33,7 @@ const getBranchName = (dir = process.cwd()) => {
|
|
29
33
|
}
|
30
34
|
};
|
31
35
|
exports.getBranchName = getBranchName;
|
36
|
+
/** Get the default branch name. */
|
32
37
|
const getDefaultBranchName = (dir = process.cwd()) => {
|
33
38
|
try {
|
34
39
|
const stdout = (0, child_process_1.execSync)('git symbolic-ref --short refs/remotes/origin/HEAD', {
|
@@ -42,11 +47,17 @@ const getDefaultBranchName = (dir = process.cwd()) => {
|
|
42
47
|
}
|
43
48
|
};
|
44
49
|
exports.getDefaultBranchName = getDefaultBranchName;
|
50
|
+
/**
|
51
|
+
* Parse the default branch name from the output of `git symbolic-ref --short refs/remotes/origin/HEAD`.
|
52
|
+
* @param output The output of the command. e.g. 'origin/develop'.
|
53
|
+
* @private Exported only for testing.
|
54
|
+
*/
|
45
55
|
const parseDefaultFromShowRemoteOutput = (output) => {
|
46
56
|
const match = output.match(/origin\/(.+)/);
|
47
57
|
return match ? match[1] : null;
|
48
58
|
};
|
49
59
|
exports.parseDefaultFromShowRemoteOutput = parseDefaultFromShowRemoteOutput;
|
60
|
+
/** Get the repository's remote URL. */
|
50
61
|
const getRemoteURL = (dir = process.cwd()) => {
|
51
62
|
try {
|
52
63
|
return (0, child_process_1.execSync)('git config --get remote.origin.url', {
|
@@ -61,8 +72,11 @@ const getRemoteURL = (dir = process.cwd()) => {
|
|
61
72
|
}
|
62
73
|
};
|
63
74
|
exports.getRemoteURL = getRemoteURL;
|
75
|
+
/** Get info on the most recent commit. */
|
64
76
|
const getCommitInfo = (dir = process.cwd()) => {
|
65
77
|
try {
|
78
|
+
// %s=subject (message), %H=hash, %an=author name, %ae=author email, %n=newline
|
79
|
+
// See https://git-scm.com/docs/git-show#_pretty_formats
|
66
80
|
const stdout = (0, child_process_1.execSync)('git show --no-patch --format="%s%n%H%n%an%n%ae"', {
|
67
81
|
cwd: dir,
|
68
82
|
stdio: ['ignore', 'pipe', 'ignore']
|
@@ -75,6 +89,7 @@ const getCommitInfo = (dir = process.cwd()) => {
|
|
75
89
|
}
|
76
90
|
};
|
77
91
|
exports.getCommitInfo = getCommitInfo;
|
92
|
+
/** Check if the repository contains unstaged changes. */
|
78
93
|
const isDirty = (dir = process.cwd()) => {
|
79
94
|
try {
|
80
95
|
const stdout = (0, child_process_1.execSync)('git status --short', {
|
@@ -88,6 +103,7 @@ const isDirty = (dir = process.cwd()) => {
|
|
88
103
|
}
|
89
104
|
};
|
90
105
|
exports.isDirty = isDirty;
|
106
|
+
/** Get the tag name. */
|
91
107
|
const getTag = (dir = process.cwd()) => {
|
92
108
|
try {
|
93
109
|
return (0, child_process_1.execSync)('git describe --tags --exact', {
|
package/dist/git.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":";;;AAAA,iDAAwC;
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":";;;AAAA,iDAAwC;AAExC,iEAAiE;AAC1D,MAAM,YAAY,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EAAW,EAAE;IAC3D,IAAI,CAAC;QACH,IAAA,wBAAQ,EAAC,qCAAqC,EAAE;YAC9C,GAAG,EAAE,GAAG;YACR,kDAAkD;YAClD,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAXY,QAAA,YAAY,gBAWxB;AAED,mCAAmC;AAC5B,MAAM,aAAa,GAAG,CAA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,WAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAVY,QAAA,OAAO,WAUnB;AAED,wBAAwB;AACjB,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EAAiB,EAAE;IAC3D,IAAI,CAAC;QACH,OAAO,IAAA,wBAAQ,EAAC,6BAA6B,EAAE;YAC7C,GAAG,EAAE,GAAG;YACR,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC;aACC,QAAQ,EAAE;aACV,IAAI,EAAE,CAAA;IACX,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC,CAAA;AAXY,QAAA,MAAM,UAWlB"}
|
package/dist/playwright.js
CHANGED
@@ -9,6 +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
|
+
/**
|
13
|
+
* Creates a Playwright config that uses axe extension
|
14
|
+
*
|
15
|
+
* @param opts Playwright config to extend
|
16
|
+
*/
|
12
17
|
function playwrightConfig(opts) {
|
13
18
|
const { axe, ...config } = opts;
|
14
19
|
let { args = [] } = config;
|
@@ -36,7 +41,14 @@ class PlaywrightController extends Controller_1.default {
|
|
36
41
|
}
|
37
42
|
}
|
38
43
|
exports.PlaywrightController = PlaywrightController;
|
39
|
-
|
44
|
+
/**
|
45
|
+
* @deprecated `wrapPlaywright` is deprecated and may not work as intended. Please use `wrapPlaywrightPage` instead.
|
46
|
+
*/
|
47
|
+
const wrapPlaywright = (
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
49
|
+
browserContext,
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
51
|
+
playwrightController) => {
|
40
52
|
throw new Error(`
|
41
53
|
\`wrapPlaywright\` is deprecated and may not work as intended. Please use \`wrapPlaywrightPage\` instead. Example:\n
|
42
54
|
let page = await browserContext.newPage()
|
package/dist/playwright.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"playwright.js","sourceRoot":"","sources":["../src/playwright.ts"],"names":[],"mappings":";;;;;;AAeA,4CAoBC;AAlCD,8DAAqC;AACrC,iFAA6E;AAC7E,8EAAqD;AACrD,4EAA2E;
|
1
|
+
{"version":3,"file":"playwright.js","sourceRoot":"","sources":["../src/playwright.ts"],"names":[],"mappings":";;;;;;AAeA,4CAoBC;AAlCD,8DAAqC;AACrC,iFAA6E;AAC7E,8EAAqD;AACrD,4EAA2E;AAK3E;;;;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,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,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC,CAAA;QAElD,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;AAjBD,oDAiBC;AAED;;GAEG;AACI,MAAM,cAAc,GAAG;AAC5B,6DAA6D;AAC7D,cAA8B;AAC9B,6DAA6D;AAC7D,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.js
CHANGED
@@ -6,12 +6,22 @@ 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
|
+
/**
|
10
|
+
* Configure `@playwright/test` for usage with axe Watcher and return wrapped `test` and `expect` functions.
|
11
|
+
*
|
12
|
+
* @param options Options for configuring Playwright and @axe-core/watcher
|
13
|
+
* @see https://playwright.dev/docs/api/class-test#test-call
|
14
|
+
* @see https://playwright.dev/docs/api/class-test#test-expect
|
15
|
+
*/
|
9
16
|
const playwrightTest = (options) => {
|
10
17
|
let controller = null;
|
11
18
|
const { axe, ...config } = options;
|
19
|
+
// We must lazily require the `@playwright/test` package, as
|
20
|
+
// users of other platforms won't have it installed.
|
12
21
|
let base;
|
13
22
|
let chromium;
|
14
23
|
try {
|
24
|
+
// eslint-disable-next-line import/no-extraneous-dependencies, @typescript-eslint/no-require-imports
|
15
25
|
;
|
16
26
|
({ test: base, chromium } = require('@playwright/test'));
|
17
27
|
}
|
@@ -20,6 +30,11 @@ const playwrightTest = (options) => {
|
|
20
30
|
}
|
21
31
|
(0, writeVariables_1.default)(axe);
|
22
32
|
const test = base.extend({
|
33
|
+
// Playwright requires destructing the context object. Removing it yields:
|
34
|
+
//
|
35
|
+
// Error: First argument must use the object destructuring pattern:
|
36
|
+
//
|
37
|
+
// eslint-disable-next-line no-empty-pattern
|
23
38
|
context: async ({}, use) => {
|
24
39
|
const context = await chromium.launchPersistentContext('', {
|
25
40
|
...config,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"playwrightTest.js","sourceRoot":"","sources":["../src/playwrightTest.ts"],"names":[],"mappings":";;;;;AAUA,6CAIqB;AACrB,8EAAqD;AACrD,4EAAmD;
|
1
|
+
{"version":3,"file":"playwrightTest.js","sourceRoot":"","sources":["../src/playwrightTest.ts"],"names":[],"mappings":";;;;;AAUA,6CAIqB;AACrB,8EAAqD;AACrD,4EAAmD;AAYnD;;;;;;GAMG;AAEH,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAe,EAAE;IACvD,IAAI,UAAU,GAAgC,IAAI,CAAA;IAClD,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,CAAA;IAElC,4DAA4D;IAC5D,oDAAoD;IACpD,IAAI,IAAU,CAAA;IACd,IAAI,QAAsC,CAAA;IAC1C,IAAI,CAAC;QACH,oGAAoG;QACpG,CAAC;QAAA,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAA;IAC3D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,mCAAmC,GAAI,KAAe,CAAC,OAAO,CAC/D,CAAA;IACH,CAAC;IAED,IAAA,wBAAc,EAAC,GAAG,CAAC,CAAA;IAEnB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACvB,0EAA0E;QAC1E,EAAE;QACF,mEAAmE;QACnE,EAAE;QACF,4CAA4C;QAC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