@axe-core/watcher 3.13.1-next.470fe4e3 → 3.13.1-next.66bf76ba
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/cypress.js +12 -11
- package/dist/cypress.js.map +1 -1
- package/dist/cypressCommands.js +6 -5
- package/dist/cypressCommands.js.map +1 -1
- package/dist/sendResultsToServer.d.ts +2 -0
- package/dist/sendResultsToServer.js +18 -15
- package/dist/sendResultsToServer.js.map +1 -1
- package/dist/utils/constants.js +25 -2
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/initializeSession.d.ts +11 -0
- package/dist/utils/initializeSession.js +45 -0
- package/dist/utils/initializeSession.js.map +1 -0
- package/dist/utils/initializeSession.test.js +128 -0
- package/dist/utils/initializeSession.test.js.map +1 -0
- package/dist/utils/writeVariables.d.ts +15 -4
- package/dist/utils/writeVariables.js +33 -18
- package/dist/utils/writeVariables.js.map +1 -1
- package/dist/utils/writeVariables.test.js +2 -21
- package/dist/utils/writeVariables.test.js.map +1 -1
- package/dist/wdio.js +6 -1
- package/dist/wdio.js.map +1 -1
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/package.json +1 -1
- package/dist/utils/validateApiKey.d.ts +0 -7
- package/dist/utils/validateApiKey.js +0 -34
- package/dist/utils/validateApiKey.js.map +0 -1
- package/dist/utils/validateApiKey.test.js +0 -66
- package/dist/utils/validateApiKey.test.js.map +0 -1
- /package/dist/utils/{validateApiKey.test.d.ts → initializeSession.test.d.ts} +0 -0
package/dist/cypress.js
CHANGED
|
@@ -37,23 +37,23 @@ const cypressConfig = (config) => {
|
|
|
37
37
|
'*/__cypress/iframes/*'
|
|
38
38
|
]
|
|
39
39
|
});
|
|
40
|
-
if ((_a =
|
|
41
|
-
|
|
40
|
+
if ((_a = userConfig.e2e) === null || _a === void 0 ? void 0 : _a.env) {
|
|
41
|
+
userConfig.e2e.env = Object.assign({}, userConfig.e2e.env, {
|
|
42
42
|
[exports.cypressConfigRunFlag]: true
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
|
|
46
|
+
userConfig.env = Object.assign({}, userConfig.env, {
|
|
47
47
|
[exports.cypressConfigRunFlag]: true
|
|
48
48
|
});
|
|
49
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
|
|
51
|
+
if (hasWatcherDebug) {
|
|
52
|
+
userConfig.env = Object.assign({}, userConfig.env, {
|
|
53
|
+
__AXE_WATCHER_DEBUG: hasWatcherDebug
|
|
54
|
+
});
|
|
55
|
+
}
|
|
50
56
|
return {
|
|
51
|
-
...(hasWatcherDebug && {
|
|
52
|
-
env: {
|
|
53
|
-
...config.env,
|
|
54
|
-
__AXE_WATCHER_DEBUG: hasWatcherDebug
|
|
55
|
-
}
|
|
56
|
-
}),
|
|
57
57
|
...userConfig,
|
|
58
58
|
e2e: {
|
|
59
59
|
...userConfig.e2e,
|
|
@@ -95,13 +95,14 @@ const cypressConfig = (config) => {
|
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
on('task', {
|
|
98
|
-
__uploadAxeWatcherResults: async (results) => {
|
|
99
|
-
if (!results.length) {
|
|
98
|
+
__uploadAxeWatcherResults: async ({ results, skipped_url }) => {
|
|
99
|
+
if (!(results === null || results === void 0 ? void 0 : results.length) && !skipped_url) {
|
|
100
100
|
// Indicates to Cypress that the event has been handled.
|
|
101
101
|
// @see https://docs.cypress.io/api/commands/task#Usage
|
|
102
102
|
return null;
|
|
103
103
|
}
|
|
104
104
|
await (0, sendResultsToServer_1.default)({
|
|
105
|
+
skipped_url,
|
|
105
106
|
results,
|
|
106
107
|
debugLogger
|
|
107
108
|
});
|
package/dist/cypress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress.js","sourceRoot":"","sources":["../src/cypress.ts"],"names":[],"mappings":";;;;;;AACA,
|
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B,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;oBACrD,2FAA2F;oBAC3F,mEAAmE;oBACnE,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;oBAED,mEAAmE;oBACnE,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,CAAA;oBACvC,aAAa,CAAC,IAAI,GAAG,IAAA,yBAAe,EAAC,YAAY,EAAE;wBACjD,sBAAsB,EAAE,KAAK;qBAC9B,CAAC,CAAA;oBAEF,OAAO,aAAa,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;AAjJY,QAAA,aAAa,iBAiJzB"}
|
package/dist/cypressCommands.js
CHANGED
|
@@ -40,6 +40,10 @@ const logDebugAxeWatcher = ({ message }) => {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
const shouldAnalyzeLocation = (location) => ['http:', 'https:', 'file:'].includes(location.protocol);
|
|
43
|
+
// If cypressConfig was never invoked, fail immediately
|
|
44
|
+
if (!Cypress.env(cypress_1.cypressConfigRunFlag)) {
|
|
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.`);
|
|
46
|
+
}
|
|
43
47
|
/**
|
|
44
48
|
* Wrapped commands queue an axe run before calling the original method. This can seem
|
|
45
49
|
* a little counter-intuitive, but the reason we do this is so that we make sure we wait
|
|
@@ -87,7 +91,7 @@ exports.WRAPPED_COMMANDS.forEach(method => Cypress.Commands.overwrite(method, (o
|
|
|
87
91
|
// commandChain = commandChain.then(() => (cy as CyInternal).getSubjectFromChain!(originalSubjectChain))
|
|
88
92
|
//
|
|
89
93
|
if (tryRequerySubject) {
|
|
90
|
-
const timeout = (_e = args.find(arg => arg.timeout)) === null || _e === void 0 ? void 0 : _e.timeout;
|
|
94
|
+
const timeout = (_e = args.find(arg => arg === null || arg === void 0 ? void 0 : arg.timeout)) === null || _e === void 0 ? void 0 : _e.timeout;
|
|
91
95
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
96
|
commandChain = commandChain.__axeRestoreSubject(originalSubjectChain, timeout);
|
|
93
97
|
// In all hooked cases, originalFn can have its own timeout.
|
|
@@ -149,7 +153,7 @@ function axeWatcherFlushCommand() {
|
|
|
149
153
|
const event = new CustomEvent('axe:flush-start');
|
|
150
154
|
win.dispatchEvent(event);
|
|
151
155
|
}).then(results => {
|
|
152
|
-
cy.task('__uploadAxeWatcherResults', results, { log: false });
|
|
156
|
+
cy.task('__uploadAxeWatcherResults', { results }, { log: false });
|
|
153
157
|
logDebugAxeWatcher({ message: 'Flush: complete' });
|
|
154
158
|
});
|
|
155
159
|
});
|
|
@@ -163,9 +167,6 @@ function axeWatcherAnalyzeCommand({ __Method, __UserRequestedAnalyze = true } =
|
|
|
163
167
|
message: `Analyze: Invoked${__Method ? ` - ${__Method}` : ''}`
|
|
164
168
|
});
|
|
165
169
|
const userRequestedAnalyze = __UserRequestedAnalyze;
|
|
166
|
-
if (!Cypress.env(cypress_1.cypressConfigRunFlag)) {
|
|
167
|
-
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.`);
|
|
168
|
-
}
|
|
169
170
|
cy.window().then(win => {
|
|
170
171
|
if (!shouldAnalyzeLocation(win.location)) {
|
|
171
172
|
return Promise.resolve({ message: `Skipped - Invalid protocol` });
|
|
@@ -1 +1 @@
|
|
|
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,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAE1D;;;;;;;GAOG;AACH,wBAAgB,CAAC,OAAO,CAAC,MAAM,CA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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"}
|
|
@@ -14,10 +14,12 @@ export interface Result {
|
|
|
14
14
|
screenshot_id: string | null;
|
|
15
15
|
run_context: ElementContext | null;
|
|
16
16
|
run_options: RunOptions | null;
|
|
17
|
+
skipped_url: string | null;
|
|
17
18
|
}
|
|
18
19
|
interface SendResultsToServerParams {
|
|
19
20
|
results: Result[];
|
|
20
21
|
debugLogger: debug.Debugger;
|
|
22
|
+
skipped_url?: string | null;
|
|
21
23
|
}
|
|
22
24
|
export declare const sendResultsToServer: ({ results, debugLogger }: SendResultsToServerParams) => Promise<void>;
|
|
23
25
|
export default sendResultsToServer;
|
|
@@ -26,21 +26,10 @@ const sendResultsToServer = async ({ results, debugLogger }) => {
|
|
|
26
26
|
totalBytes: Buffer.byteLength(JSON.stringify(results))
|
|
27
27
|
});
|
|
28
28
|
debugLogger('SendResultsToServer: Session ID', { session_id });
|
|
29
|
-
|
|
30
|
-
results.forEach(result => {
|
|
31
|
-
if (result.screenshot) {
|
|
32
|
-
result.screenshot_id = (0, uuid_1.v4)();
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
// Send the results in batches.
|
|
36
|
-
for (let i = 0; i < results.length; i += exports.MAX_PAGE_STATES_PER_REQUEST) {
|
|
37
|
-
// Remove screenshots from results. They will be sent separately.
|
|
38
|
-
const batch = results
|
|
39
|
-
.slice(i, i + exports.MAX_PAGE_STATES_PER_REQUEST)
|
|
40
|
-
.map(r => ({ ...r, screenshot: null }));
|
|
29
|
+
const putResults = async (bodyResults = []) => {
|
|
41
30
|
const body = {
|
|
42
31
|
axe_watcher_version: version,
|
|
43
|
-
results:
|
|
32
|
+
results: bodyResults,
|
|
44
33
|
...git_data
|
|
45
34
|
};
|
|
46
35
|
const res = await (0, node_fetch_1.default)(resultsURL, {
|
|
@@ -54,7 +43,7 @@ const sendResultsToServer = async ({ results, debugLogger }) => {
|
|
|
54
43
|
});
|
|
55
44
|
if (!res.ok) {
|
|
56
45
|
debugLogger('SendResultsToServer: Failed to send results', {
|
|
57
|
-
batchResults:
|
|
46
|
+
batchResults: bodyResults.length,
|
|
58
47
|
reqSize: Buffer.byteLength(JSON.stringify(body)),
|
|
59
48
|
resStatus: res.status,
|
|
60
49
|
resStatusText: res.statusText
|
|
@@ -64,12 +53,26 @@ const sendResultsToServer = async ({ results, debugLogger }) => {
|
|
|
64
53
|
}
|
|
65
54
|
else {
|
|
66
55
|
debugLogger('SendResultsToServer: Successfully sent', {
|
|
67
|
-
batchResults:
|
|
56
|
+
batchResults: bodyResults.length,
|
|
68
57
|
reqSize: Buffer.byteLength(JSON.stringify(body)),
|
|
69
58
|
resStatus: res.status,
|
|
70
59
|
resStatusText: res.statusText
|
|
71
60
|
});
|
|
72
61
|
}
|
|
62
|
+
};
|
|
63
|
+
// Add an correlation ID to each result/screenshot combination (see #622).
|
|
64
|
+
results.forEach(result => {
|
|
65
|
+
if (result.screenshot) {
|
|
66
|
+
result.screenshot_id = (0, uuid_1.v4)();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
// Send the results in batches.
|
|
70
|
+
for (let i = 0; i < results.length; i += exports.MAX_PAGE_STATES_PER_REQUEST) {
|
|
71
|
+
// Remove screenshots from results. They will be sent separately.
|
|
72
|
+
const batch = results
|
|
73
|
+
.slice(i, i + exports.MAX_PAGE_STATES_PER_REQUEST)
|
|
74
|
+
.map(r => ({ ...r, screenshot: null }));
|
|
75
|
+
await putResults(batch);
|
|
73
76
|
}
|
|
74
77
|
// Send screenshots.
|
|
75
78
|
await Promise.all(results.map(async ({ screenshot, screenshot_id }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendResultsToServer.js","sourceRoot":"","sources":["../src/sendResultsToServer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAE9B,+BAAiC;AAGjC,0EAAiD;AAEjD,gFAAgF;AAChF,iEAAiE;AACjE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAE9C;;;;;GAKG;AAEU,QAAA,2BAA2B,GAAG,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"sendResultsToServer.js","sourceRoot":"","sources":["../src/sendResultsToServer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAE9B,+BAAiC;AAGjC,0EAAiD;AAEjD,gFAAgF;AAChF,iEAAiE;AACjE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAE9C;;;;;GAKG;AAEU,QAAA,2BAA2B,GAAG,CAAC,CAAA;AAwBrC,MAAM,mBAAmB,GAAG,KAAK,EAAE,EACxC,OAAO,EACP,WAAW,EACe,EAAiB,EAAE;IAC7C,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,IAAA,uBAAa,GAAE,CAAA;IAErE,MAAM,UAAU,GAAG,IAAI,GAAG,CACxB,6BAA6B,UAAU,EAAE,EACzC,UAAU,CACX,CAAA;IACD,MAAM,cAAc,GAAG,IAAI,GAAG,CAC5B,6BAA6B,UAAU,cAAc,EACrD,UAAU,CACX,CAAA;IAED,WAAW,CAAC,uCAAuC,EAAE;QACnD,KAAK,EAAE,OAAO,CAAC,MAAM;QACrB,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;KACvD,CAAC,CAAA;IACF,WAAW,CAAC,iCAAiC,EAAE,EAAE,UAAU,EAAE,CAAC,CAAA;IAE9D,MAAM,UAAU,GAAG,KAAK,EAAE,cAAwB,EAAE,EAAiB,EAAE;QACrE,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|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.PATH_TO_EXTENSION_VARIABLES = exports.PATH_TO_SESSION_FILE = exports.PATH_TO_EXTENSION = exports.DEFAULT_SERVER_URL = void 0;
|
|
7
30
|
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const
|
|
31
|
+
const os = __importStar(require("os"));
|
|
9
32
|
exports.DEFAULT_SERVER_URL = 'https://axe.deque.com/';
|
|
10
33
|
// The path the `@axe-core/watcher` extension e.g. /<path>/node_modules/@axe-core/watcher/extension
|
|
11
34
|
exports.PATH_TO_EXTENSION = path_1.default.join(__dirname, '..', '..', 'extension');
|
|
12
35
|
// The path to the session JSON created and used by WDIO TestRunner
|
|
13
|
-
exports.PATH_TO_SESSION_FILE = path_1.default.join(
|
|
36
|
+
exports.PATH_TO_SESSION_FILE = path_1.default.join(os.tmpdir(), 'axe-watcher-session.json');
|
|
14
37
|
// The path to the variables JSON utilized by the extension and various other utilities
|
|
15
38
|
exports.PATH_TO_EXTENSION_VARIABLES = path_1.default.join(exports.PATH_TO_EXTENSION, 'variables.json');
|
|
16
39
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAuB;AACvB,uCAAwB;AAEX,QAAA,kBAAkB,GAAG,wBAAwB,CAAA;AAE1D,mGAAmG;AACtF,QAAA,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAA;AAE9E,mEAAmE;AACtD,QAAA,oBAAoB,GAAG,cAAI,CAAC,IAAI,CAC3C,EAAE,CAAC,MAAM,EAAE,EACX,0BAA0B,CAC3B,CAAA;AAED,uFAAuF;AAC1E,QAAA,2BAA2B,GAAG,cAAI,CAAC,IAAI,CAClD,yBAAiB,EACjB,gBAAgB,CACjB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface InitializeSessionParams {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
serverURL: string;
|
|
4
|
+
watcherVersion: string;
|
|
5
|
+
sessionID: string | null;
|
|
6
|
+
buildID: string | null;
|
|
7
|
+
gitCommitSha: string | null;
|
|
8
|
+
}
|
|
9
|
+
/** Initialize a new session. */
|
|
10
|
+
declare function initializeSession({ apiKey, serverURL, watcherVersion, sessionID, buildID, gitCommitSha }: InitializeSessionParams): string;
|
|
11
|
+
export default initializeSession;
|
|
@@ -0,0 +1,45 @@
|
|
|
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 sync_request_1 = __importDefault(require("sync-request"));
|
|
7
|
+
const assert_1 = __importDefault(require("assert"));
|
|
8
|
+
const createDebugger_1 = __importDefault(require("../createDebugger"));
|
|
9
|
+
const debugLogger = (0, createDebugger_1.default)('config:initializeSession');
|
|
10
|
+
/** Initialize a new session. */
|
|
11
|
+
function initializeSession({ apiKey, serverURL, watcherVersion, sessionID, buildID, gitCommitSha }) {
|
|
12
|
+
(0, assert_1.default)(apiKey, 'API key is required');
|
|
13
|
+
(0, assert_1.default)(serverURL, 'Server URL is required');
|
|
14
|
+
(0, assert_1.default)(watcherVersion, 'Watcher version is required');
|
|
15
|
+
(0, assert_1.default)(!(sessionID && typeof sessionID !== 'string'), 'Session ID must be a string');
|
|
16
|
+
(0, assert_1.default)(!(buildID && typeof buildID !== 'string'), 'Build ID must be a string');
|
|
17
|
+
(0, assert_1.default)(!(sessionID && buildID), 'Session ID and Build ID are mutually exclusive. `sessionId` is deprecated, please use `buildID` instead');
|
|
18
|
+
(0, assert_1.default)(!(gitCommitSha && typeof gitCommitSha !== 'string'), 'Git commit SHA must be a string');
|
|
19
|
+
const url = new URL(`/api-pub/watcher/sessions`, serverURL);
|
|
20
|
+
const res = (0, sync_request_1.default)('POST', url.toString(), {
|
|
21
|
+
headers: {
|
|
22
|
+
'X-API-Key': apiKey
|
|
23
|
+
},
|
|
24
|
+
json: {
|
|
25
|
+
watcher_version: watcherVersion,
|
|
26
|
+
session_id: sessionID,
|
|
27
|
+
build_id: buildID,
|
|
28
|
+
git_commit_sha: gitCommitSha
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const body = JSON.parse(res.getBody('utf8'));
|
|
32
|
+
if (body.errors.length) {
|
|
33
|
+
debugLogger('Error initializing session:', body.errors);
|
|
34
|
+
throw new Error(body.errors.join(', '));
|
|
35
|
+
}
|
|
36
|
+
if (body.warnings.length) {
|
|
37
|
+
debugLogger('Warning initializing session:', body.warnings);
|
|
38
|
+
// eslint-disable-next-line no-console -- We want to emit a warning to the user's console
|
|
39
|
+
console.warn(body.warnings.join(', '));
|
|
40
|
+
}
|
|
41
|
+
debugLogger('Session initialized successfully:', body.session_id);
|
|
42
|
+
return body.session_id;
|
|
43
|
+
}
|
|
44
|
+
exports.default = initializeSession;
|
|
45
|
+
//# sourceMappingURL=initializeSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializeSession.js","sourceRoot":"","sources":["../../src/utils/initializeSession.ts"],"names":[],"mappings":";;;;;AAAA,gEAAkC;AAClC,oDAA2B;AAC3B,uEAA8C;AAE9C,MAAM,WAAW,GAAG,IAAA,wBAAc,EAAC,0BAA0B,CAAC,CAAA;AAkB9D,gCAAgC;AAChC,SAAS,iBAAiB,CAAC,EACzB,MAAM,EACN,SAAS,EACT,cAAc,EACd,SAAS,EACT,OAAO,EACP,YAAY,EACY;IACxB,IAAA,gBAAM,EAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;IACrC,IAAA,gBAAM,EAAC,SAAS,EAAE,wBAAwB,CAAC,CAAA;IAC3C,IAAA,gBAAM,EAAC,cAAc,EAAE,6BAA6B,CAAC,CAAA;IACrD,IAAA,gBAAM,EACJ,CAAC,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,CAAC,EAC7C,6BAA6B,CAC9B,CAAA;IACD,IAAA,gBAAM,EAAC,CAAC,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC,EA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C;AAED,kBAAe,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
require("mocha");
|
|
7
|
+
const chai_1 = require("chai");
|
|
8
|
+
const sinon_1 = __importDefault(require("sinon"));
|
|
9
|
+
const proxyquire_1 = __importDefault(require("proxyquire"));
|
|
10
|
+
const initializeSession_1 = __importDefault(require("./initializeSession"));
|
|
11
|
+
describe('initializeSession', () => {
|
|
12
|
+
afterEach(sinon_1.default.restore);
|
|
13
|
+
const defaultParams = {
|
|
14
|
+
apiKey: 'abc',
|
|
15
|
+
serverURL: 'http://localhost:3000',
|
|
16
|
+
watcherVersion: '1.0.0',
|
|
17
|
+
sessionID: null,
|
|
18
|
+
buildID: null,
|
|
19
|
+
gitCommitSha: null
|
|
20
|
+
};
|
|
21
|
+
describe('validating input', () => {
|
|
22
|
+
describe('when the API key is missing', () => {
|
|
23
|
+
it('throws an error', () => {
|
|
24
|
+
chai_1.assert.throws(() => {
|
|
25
|
+
//@ts-expect-error - expected missing apiKey
|
|
26
|
+
(0, initializeSession_1.default)({});
|
|
27
|
+
}, 'API key is required');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe('when the server URL is missing', () => {
|
|
31
|
+
it('throws an error', () => {
|
|
32
|
+
chai_1.assert.throws(() => {
|
|
33
|
+
//@ts-expect-error - expected missing serverURL
|
|
34
|
+
(0, initializeSession_1.default)({ apiKey: 'abc' });
|
|
35
|
+
}, 'Server URL is required');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
describe('when the watcher version is missing', () => {
|
|
39
|
+
it('throws an error', () => {
|
|
40
|
+
chai_1.assert.throws(() => {
|
|
41
|
+
//@ts-expect-error - expected missing watcherVersion
|
|
42
|
+
(0, initializeSession_1.default)({
|
|
43
|
+
apiKey: 'abc',
|
|
44
|
+
serverURL: 'http://localhost:3000'
|
|
45
|
+
});
|
|
46
|
+
}, 'Watcher version is required');
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe('when the session ID is not a string', () => {
|
|
50
|
+
it('throws an error', () => {
|
|
51
|
+
chai_1.assert.throws(() => {
|
|
52
|
+
(0, initializeSession_1.default)({
|
|
53
|
+
...defaultParams,
|
|
54
|
+
//@ts-expect-error - expected sessionID to be a string
|
|
55
|
+
sessionID: 123
|
|
56
|
+
});
|
|
57
|
+
}, 'Session ID must be a string');
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe('when the build ID is not a string', () => {
|
|
61
|
+
it('throws an error', () => {
|
|
62
|
+
chai_1.assert.throws(() => {
|
|
63
|
+
(0, initializeSession_1.default)({
|
|
64
|
+
...defaultParams,
|
|
65
|
+
//@ts-expect-error - expected buildID to be a string
|
|
66
|
+
buildID: 123
|
|
67
|
+
});
|
|
68
|
+
}, 'Build ID must be a string');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe('when both session ID and build ID are provided', () => {
|
|
72
|
+
it('throws an error', () => {
|
|
73
|
+
chai_1.assert.throws(() => {
|
|
74
|
+
(0, initializeSession_1.default)({
|
|
75
|
+
...defaultParams,
|
|
76
|
+
sessionID: 'abc',
|
|
77
|
+
buildID: '123'
|
|
78
|
+
});
|
|
79
|
+
}, 'Session ID and Build ID are mutually exclusive. `sessionId` is deprecated, please use `buildID` instead');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('when the git commit SHA is not a string', () => {
|
|
83
|
+
it('throws an error', () => {
|
|
84
|
+
chai_1.assert.throws(() => {
|
|
85
|
+
(0, initializeSession_1.default)({
|
|
86
|
+
...defaultParams,
|
|
87
|
+
//@ts-expect-error - expected gitCommitSha to be a string
|
|
88
|
+
gitCommitSha: 123
|
|
89
|
+
});
|
|
90
|
+
}, 'Git commit SHA must be a string');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
describe('when the server returns a non-200 response', () => {
|
|
95
|
+
afterEach(sinon_1.default.restore);
|
|
96
|
+
it('throws an error', () => {
|
|
97
|
+
const requestStub = sinon_1.default
|
|
98
|
+
.stub()
|
|
99
|
+
.returns({ statusCode: 500, getBody: () => '{"errors":["boom"]}' });
|
|
100
|
+
const fn = (0, proxyquire_1.default)('./initializeSession', {
|
|
101
|
+
'sync-request': requestStub
|
|
102
|
+
}).default;
|
|
103
|
+
chai_1.assert.throws(() => {
|
|
104
|
+
fn(defaultParams);
|
|
105
|
+
}, 'boom');
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
describe('when the server returns a 200 response', () => {
|
|
109
|
+
it('does not throw an error', () => {
|
|
110
|
+
const expectedBody = {
|
|
111
|
+
errors: [],
|
|
112
|
+
warnings: [],
|
|
113
|
+
session_id: 'abc'
|
|
114
|
+
};
|
|
115
|
+
const requestStub = sinon_1.default.stub().returns({
|
|
116
|
+
statusCode: 200,
|
|
117
|
+
getBody: () => JSON.stringify(expectedBody)
|
|
118
|
+
});
|
|
119
|
+
const fn = (0, proxyquire_1.default)('./initializeSession', {
|
|
120
|
+
'sync-request': requestStub
|
|
121
|
+
}).default;
|
|
122
|
+
const invoke = fn(defaultParams);
|
|
123
|
+
chai_1.assert.doesNotThrow(() => invoke);
|
|
124
|
+
chai_1.assert.deepEqual(invoke, expectedBody.session_id);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=initializeSession.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializeSession.test.js","sourceRoot":"","sources":["../../src/utils/initializeSession.test.ts"],"names":[],"mappings":";;;;;AAAA,iBAAc;AACd,+BAA6B;AAC7B,kDAAyB;AACzB,4DAAmC;AACnC,4EAE4B;AAE5B,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EA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AM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAA;YACjC,aAAM,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -16,7 +16,7 @@ interface AxeConfiguration {
|
|
|
16
16
|
apiKey: string;
|
|
17
17
|
/** Custom axe server URL. */
|
|
18
18
|
serverURL?: string;
|
|
19
|
-
/**
|
|
19
|
+
/** @deprecated Please use `buildID` instead */
|
|
20
20
|
sessionId?: string;
|
|
21
21
|
/**
|
|
22
22
|
* Whether or not to automatically run axe on the page when loaded and
|
|
@@ -39,8 +39,6 @@ interface AxeConfiguration {
|
|
|
39
39
|
* @see https://www.deque.com/axe/core-documentation/api-documentation/#options-parameter
|
|
40
40
|
*/
|
|
41
41
|
runOptions?: RunOptions;
|
|
42
|
-
/** Whether to take and send screenshots to the perf endpoint */
|
|
43
|
-
/** Run experimental advanced rules */
|
|
44
42
|
/**
|
|
45
43
|
* Exclude URLs from being scanned by axe-core/watcher by providing an array of minimatch patterns.
|
|
46
44
|
*
|
|
@@ -51,6 +49,19 @@ interface AxeConfiguration {
|
|
|
51
49
|
* ```
|
|
52
50
|
*/
|
|
53
51
|
excludeUrlPatterns?: string[];
|
|
52
|
+
/**
|
|
53
|
+
* A unique identifier for the build or test run. This is useful for:
|
|
54
|
+
*
|
|
55
|
+
* - Grouping `@axe-core/watcher` runs across multiple workers running in parallel
|
|
56
|
+
* - Grouping `@axe-core/watcher` runs across multiple axe Developer Hub projects
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```js
|
|
60
|
+
* buildID: ${ process.env.GITHUB.RUN_ID }
|
|
61
|
+
* buildID: ${ process.env.CIRCLE_PIPELINE_ID }
|
|
62
|
+
*```
|
|
63
|
+
*/
|
|
64
|
+
buildID?: string;
|
|
54
65
|
}
|
|
55
66
|
export interface Configuration {
|
|
56
67
|
axe: AxeConfiguration;
|
|
@@ -73,5 +84,5 @@ export interface Variables {
|
|
|
73
84
|
exclude_url_patterns: string[] | null;
|
|
74
85
|
}
|
|
75
86
|
/** Write the user's settings to the disk, so the extension can load them. */
|
|
76
|
-
declare function writeVariables({ apiKey, autoAnalyze, cypress, serverURL, sessionId, runContext, runOptions, takeScreenshots, experimentalAdvancedRules, excludeUrlPatterns }: WriteVariablesParams): void;
|
|
87
|
+
declare function writeVariables({ apiKey, autoAnalyze, cypress, serverURL, sessionId, runContext, runOptions, takeScreenshots, experimentalAdvancedRules, excludeUrlPatterns, buildID }: WriteVariablesParams): void;
|
|
77
88
|
export default writeVariables;
|
|
@@ -28,20 +28,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const git = __importStar(require("../git"));
|
|
30
30
|
const fs_1 = __importDefault(require("fs"));
|
|
31
|
-
const uuid_1 = require("uuid");
|
|
32
31
|
const constants_1 = require("./constants");
|
|
33
32
|
const validateAxeRunOptions_1 = require("./validateAxeRunOptions");
|
|
34
33
|
const createDebugger_1 = __importDefault(require("../createDebugger"));
|
|
35
|
-
const
|
|
34
|
+
const initializeSession_1 = __importDefault(require("./initializeSession"));
|
|
36
35
|
const validateAxeRunContext_1 = require("./validateAxeRunContext");
|
|
37
36
|
const isValidExcludePattern_1 = __importDefault(require("./isValidExcludePattern"));
|
|
38
37
|
const debugLogger = (0, createDebugger_1.default)('config:writeVariables');
|
|
38
|
+
// Read the version from package.json, but do not include the file in the build.
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
40
|
+
const { version } = require('../../package.json');
|
|
39
41
|
/** Write the user's settings to the disk, so the extension can load them. */
|
|
40
42
|
function writeVariables({ apiKey, autoAnalyze, cypress, serverURL, sessionId, runContext, runOptions,
|
|
41
43
|
// @ts-expect-error Feature flag, not part of public type
|
|
42
44
|
takeScreenshots,
|
|
43
45
|
// @ts-expect-error Feature flag, not part of public type
|
|
44
|
-
experimentalAdvancedRules, excludeUrlPatterns }) {
|
|
46
|
+
experimentalAdvancedRules, excludeUrlPatterns, buildID }) {
|
|
45
47
|
// only log the properties if they are not undefined
|
|
46
48
|
debugLogger('Received configuration:', {
|
|
47
49
|
apiKey: '<redacted>',
|
|
@@ -49,7 +51,9 @@ experimentalAdvancedRules, excludeUrlPatterns }) {
|
|
|
49
51
|
...(serverURL !== undefined && { serverURL }),
|
|
50
52
|
...(sessionId !== undefined && { sessionId }),
|
|
51
53
|
...(runContext !== undefined && { runContext }),
|
|
52
|
-
...(runOptions !== undefined && { runOptions })
|
|
54
|
+
...(runOptions !== undefined && { runOptions }),
|
|
55
|
+
...(excludeUrlPatterns !== undefined && { excludeUrlPatterns }),
|
|
56
|
+
...(buildID !== undefined && { buildID })
|
|
53
57
|
});
|
|
54
58
|
if (!serverURL) {
|
|
55
59
|
serverURL = constants_1.DEFAULT_SERVER_URL;
|
|
@@ -84,31 +88,42 @@ experimentalAdvancedRules, excludeUrlPatterns }) {
|
|
|
84
88
|
gitData.git_commit_email = info === null || info === void 0 ? void 0 : info.email;
|
|
85
89
|
gitData.git_commit_message = info === null || info === void 0 ? void 0 : info.message;
|
|
86
90
|
}
|
|
87
|
-
debugLogger('
|
|
88
|
-
(0,
|
|
91
|
+
debugLogger('Initializing axe Watcher session');
|
|
92
|
+
let session_id = (0, initializeSession_1.default)({
|
|
93
|
+
apiKey,
|
|
94
|
+
serverURL: urlString,
|
|
95
|
+
watcherVersion: version,
|
|
96
|
+
sessionID: sessionId || null,
|
|
97
|
+
buildID: buildID || null,
|
|
98
|
+
gitCommitSha: gitData.git_commit_sha || null
|
|
99
|
+
});
|
|
89
100
|
if (typeof autoAnalyze === 'undefined') {
|
|
90
101
|
autoAnalyze = true;
|
|
91
102
|
}
|
|
92
103
|
if (excludeUrlPatterns === null || excludeUrlPatterns === void 0 ? void 0 : excludeUrlPatterns.length) {
|
|
93
104
|
(0, isValidExcludePattern_1.default)(excludeUrlPatterns);
|
|
94
105
|
}
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
// Note: If a build ID is provided the session ID will be consistent
|
|
107
|
+
// so there is no need to write to the file.
|
|
108
|
+
// between workers/machines (parallel runners)
|
|
109
|
+
if (!buildID) {
|
|
110
|
+
// When a custom session ID is not provided, attempt to read it from the filesystem.
|
|
111
|
+
// This enables multi-process/multi-browser test suites to all use the same session ID.
|
|
112
|
+
if (!sessionId && fs_1.default.existsSync(constants_1.PATH_TO_SESSION_FILE)) {
|
|
113
|
+
debugLogger('Reading session ID from file for WDIO Test Runner');
|
|
114
|
+
try {
|
|
115
|
+
const data = JSON.parse(fs_1.default.readFileSync(constants_1.PATH_TO_SESSION_FILE, 'utf8'));
|
|
116
|
+
session_id = data.id;
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
throw new Error(`Unable to read session configuration: ${error}`);
|
|
120
|
+
}
|
|
105
121
|
}
|
|
106
122
|
}
|
|
107
123
|
const variables = {
|
|
108
124
|
api_key: apiKey,
|
|
109
125
|
server_url: urlString,
|
|
110
|
-
|
|
111
|
-
session_id: sessionId || (0, uuid_1.v4)(),
|
|
126
|
+
session_id,
|
|
112
127
|
take_screenshots: !!takeScreenshots,
|
|
113
128
|
auto_analyze: !!autoAnalyze,
|
|
114
129
|
cypress: !!cypress,
|