@axe-core/watcher 3.8.0-next.9536d847 → 3.8.0-next.ab0a1f46
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.
|
@@ -3,14 +3,44 @@ declare global {
|
|
|
3
3
|
namespace Cypress {
|
|
4
4
|
interface Chainable {
|
|
5
5
|
/** Flush the axe-core result queue by sending results to the server. */
|
|
6
|
+
axeWatcherFlush(): Chainable<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Flush the axe-core result queue by sending results to the server.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated Use cy.axeWatcherFlush() instead
|
|
11
|
+
*/
|
|
6
12
|
axeFlush(): Chainable<void>;
|
|
7
13
|
/** Perform an axe-core analysis. */
|
|
14
|
+
axeWatcherAnalyze(params?: {
|
|
15
|
+
__UserRequestedAnalyze?: boolean;
|
|
16
|
+
}): Chainable<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Perform an axe-core analysis.
|
|
19
|
+
*
|
|
20
|
+
* @Deprecated Use cy.axeWatcherAnalyze() instead
|
|
21
|
+
*/
|
|
8
22
|
axeAnalyze(params?: {
|
|
9
23
|
__UserRequestedAnalyze?: boolean;
|
|
10
24
|
}): Chainable<void>;
|
|
11
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Start automatic analysis mode.
|
|
27
|
+
*/
|
|
28
|
+
axeWatcherStart(): Chainable<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Start automatic analysis mode.
|
|
31
|
+
*
|
|
32
|
+
* @Deprecated Use cy.axeWatcherStart() instead
|
|
33
|
+
*/
|
|
12
34
|
axeStart(): Chainable<void>;
|
|
13
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Stop automatic analysis mode.
|
|
37
|
+
*/
|
|
38
|
+
axeWatcherStop(): Chainable<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Stop automatic analysis mode.
|
|
41
|
+
*
|
|
42
|
+
* @Deprecated Use cy.axeWatcherStop() instead
|
|
43
|
+
*/
|
|
14
44
|
axeStop(): Chainable<void>;
|
|
15
45
|
/** Access Cypress internal state */
|
|
16
46
|
state(state: any): any;
|
package/dist/cypressCommands.js
CHANGED
|
@@ -63,7 +63,7 @@ exports.WRAPPED_COMMANDS.forEach(method => Cypress.Commands.overwrite(method, (o
|
|
|
63
63
|
win.__AXE_WATCHER_HAS_VISITED = true;
|
|
64
64
|
}
|
|
65
65
|
})
|
|
66
|
-
.
|
|
66
|
+
.axeWatcherAnalyze({ __UserRequestedAnalyze: false })
|
|
67
67
|
// Set the subject back to the previous subject
|
|
68
68
|
.then(() => subject)
|
|
69
69
|
.then(() => originalFn(...args));
|
|
@@ -78,7 +78,7 @@ exports.WRAPPED_COMMANDS.forEach(method => Cypress.Commands.overwrite(method, (o
|
|
|
78
78
|
Cypress.Commands.overwrite('visit', (originalFn, ...args) => {
|
|
79
79
|
// We use `cy.wrap(null)` here just to get into the Cypress command queue.
|
|
80
80
|
cy.wrap(null)
|
|
81
|
-
.
|
|
81
|
+
.axeWatcherAnalyze({ __UserRequestedAnalyze: false })
|
|
82
82
|
.then(() => originalFn(...args))
|
|
83
83
|
.then(visitResult => {
|
|
84
84
|
cy.window()
|
|
@@ -97,7 +97,7 @@ Cypress.Commands.overwrite('visit', (originalFn, ...args) => {
|
|
|
97
97
|
.then(() => visitResult);
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
|
-
|
|
100
|
+
function axeWatcherFlushCommand() {
|
|
101
101
|
cy.window().then(win => {
|
|
102
102
|
if (!shouldAnalyzeLocation(win.location)) {
|
|
103
103
|
return Promise.resolve();
|
|
@@ -130,10 +130,12 @@ Cypress.Commands.add('axeFlush', () => {
|
|
|
130
130
|
cy.writeFile(filename, JSON.stringify(results, null, 2));
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
}
|
|
134
|
+
const doesCypressCommandExist = (commandName) => {
|
|
135
|
+
//@ts-expect-error - Property 'cy' does not exist on type 'Cypress & CyEventEmitter'.ts(2339)
|
|
136
|
+
return !!Cypress.cy[commandName];
|
|
137
|
+
};
|
|
138
|
+
function axeWatcherAnalyzeCommand({ __UserRequestedAnalyze = true } = {}) {
|
|
137
139
|
const userRequestedAnalyze = __UserRequestedAnalyze;
|
|
138
140
|
cy.window().then(win => {
|
|
139
141
|
if (!shouldAnalyzeLocation(win.location)) {
|
|
@@ -155,8 +157,8 @@ Cypress.Commands.add('axeAnalyze',
|
|
|
155
157
|
win.dispatchEvent(event);
|
|
156
158
|
});
|
|
157
159
|
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
+
}
|
|
161
|
+
function axeWatcherStartCommand() {
|
|
160
162
|
cy.window().then(win => {
|
|
161
163
|
if (!shouldAnalyzeLocation(win.location)) {
|
|
162
164
|
return Promise.resolve();
|
|
@@ -173,8 +175,8 @@ Cypress.Commands.add('axeStart', () => {
|
|
|
173
175
|
isStopped = false;
|
|
174
176
|
});
|
|
175
177
|
});
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
+
}
|
|
179
|
+
function axeWatcherStopCommand() {
|
|
178
180
|
cy.window().then(win => {
|
|
179
181
|
if (!shouldAnalyzeLocation(win.location)) {
|
|
180
182
|
return Promise.resolve();
|
|
@@ -191,5 +193,21 @@ Cypress.Commands.add('axeStop', () => {
|
|
|
191
193
|
isStopped = true;
|
|
192
194
|
});
|
|
193
195
|
});
|
|
194
|
-
}
|
|
196
|
+
}
|
|
197
|
+
// Deprecated name; conflicts with @axe-devtools/cypress, should only be
|
|
198
|
+
// added if we don't see the other one already. Cypress uses the last-registered
|
|
199
|
+
// command, so this means that devtools will "win" the conflict.
|
|
200
|
+
if (!doesCypressCommandExist('axeAnalyze')) {
|
|
201
|
+
Cypress.Commands.add('axeAnalyze', axeWatcherAnalyzeCommand);
|
|
202
|
+
}
|
|
203
|
+
/** Deprecated: Replaced with `axeWatcherFlush` */
|
|
204
|
+
Cypress.Commands.add('axeFlush', axeWatcherFlushCommand);
|
|
205
|
+
/** Deprecated: Replaced with `axeWatcherStop` */
|
|
206
|
+
Cypress.Commands.add('axeStop', axeWatcherStopCommand);
|
|
207
|
+
/** Deprecated: Replaced with `axeWatcherStart` */
|
|
208
|
+
Cypress.Commands.add('axeStart', axeWatcherStartCommand);
|
|
209
|
+
Cypress.Commands.add('axeWatcherAnalyze', axeWatcherAnalyzeCommand);
|
|
210
|
+
Cypress.Commands.add('axeWatcherStart', axeWatcherStartCommand);
|
|
211
|
+
Cypress.Commands.add('axeWatcherStop', axeWatcherStopCommand);
|
|
212
|
+
Cypress.Commands.add('axeWatcherFlush', axeWatcherFlushCommand);
|
|
195
213
|
//# sourceMappingURL=cypressCommands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cypressCommands.js","sourceRoot":"","sources":["../src/cypressCommands.ts"],"names":[],"mappings":";;;AAqEA;;;;;;;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,MAAM;CACP,CAAA;AAED,MAAM,qBAAqB,GAAG,CAAC,QAAkB,EAAW,EAAE,CAC5D,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAE1D;;;;;;;GAOG;AACH,wBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,UAAU,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