@axe-core/watcher 2.0.0-next.f699cb79 → 2.0.0-next.fd1cc39e
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.js +71 -131
- package/dist/Controller.js.map +1 -1
- package/dist/cypress.d.ts +1 -1
- package/dist/cypress.js +9 -34
- package/dist/cypress.js.map +1 -1
- package/dist/cypressCommands.js +55 -66
- package/dist/cypressCommands.js.map +1 -1
- package/dist/git.js +15 -21
- package/dist/git.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/playwright.d.ts +1 -1
- package/dist/playwright.js +17 -84
- package/dist/playwright.js.map +1 -1
- package/dist/playwrightTest.js +26 -104
- package/dist/playwrightTest.js.map +1 -1
- package/dist/playwrightWrapping.d.ts +1 -7
- package/dist/playwrightWrapping.js +197 -483
- package/dist/playwrightWrapping.js.map +1 -1
- package/dist/puppeteer.d.ts +2 -2
- package/dist/puppeteer.js +17 -92
- package/dist/puppeteer.js.map +1 -1
- package/dist/puppeteerWrapping.d.ts +14 -0
- package/dist/puppeteerWrapping.js +432 -0
- package/dist/puppeteerWrapping.js.map +1 -0
- package/dist/util.d.ts +8 -0
- package/dist/util.js +42 -44
- package/dist/util.js.map +1 -1
- package/dist/validateApiKey.js +6 -7
- package/dist/validateApiKey.js.map +1 -1
- package/dist/wdio.d.ts +1 -1
- package/dist/wdio.js +45 -134
- package/dist/wdio.js.map +1 -1
- package/dist/webdriver.d.ts +1 -1
- package/dist/webdriver.js +21 -84
- package/dist/webdriver.js.map +1 -1
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/package.json +2 -3
package/dist/validateApiKey.js
CHANGED
|
@@ -3,21 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const sync_request_1 = __importDefault(require("sync-request"));
|
|
7
|
+
const assert_1 = __importDefault(require("assert"));
|
|
8
8
|
/** Validate the given `apiKey`. This method is blocking and should not be called unnecessarily. */
|
|
9
|
-
|
|
10
|
-
var apiKey = _a.apiKey, serverURL = _a.serverURL;
|
|
9
|
+
const validateApiKey = ({ apiKey, serverURL }) => {
|
|
11
10
|
(0, assert_1.default)(apiKey, 'API key is required');
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const url = new URL(`/api/api-keys/${apiKey}/validate/axe-devtools-watcher`, serverURL);
|
|
12
|
+
const res = (0, sync_request_1.default)('GET', url.toString(), {
|
|
14
13
|
maxRedirects: 2,
|
|
15
14
|
followRedirects: true,
|
|
16
15
|
maxRetries: 2,
|
|
17
16
|
retry: true,
|
|
18
17
|
retryDelay: 100
|
|
19
18
|
});
|
|
20
|
-
|
|
19
|
+
const body = JSON.parse(res.getBody('utf8'));
|
|
21
20
|
if (body.error) {
|
|
22
21
|
throw new Error(body.error);
|
|
23
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateApiKey.js","sourceRoot":"","sources":["../src/validateApiKey.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"validateApiKey.js","sourceRoot":"","sources":["../src/validateApiKey.ts"],"names":[],"mappings":";;;;;AAAA,gEAAkC;AAClC,oDAA2B;AAO3B,mGAAmG;AACnG,MAAM,cAAc,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,EAAU,EAAQ,EAAE;IAC7D,IAAA,gBAAM,EAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;IACrC,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,iBAAiB,MAAM,gCAAgC,EACvD,SAAS,CACV,CAAA;IACD,MAAM,GAAG,GAAG,IAAA,sBAAO,EAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE;QACzC,YAAY,EAAE,CAAC;QACf,eAAe,EAAE,IAAI;QACrB,UAAU,EAAE,CAAC;QACb,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,GAAG;KAChB,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5C,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;KAC5B;AACH,CAAC,CAAA;AAED,kBAAe,cAAc,CAAA"}
|
package/dist/wdio.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Options } from '@wdio/types';
|
|
2
2
|
import type { Browser, BrowserCommandsType, ElementCommandsType, RemoteOptions } from 'webdriverio';
|
|
3
|
-
import { Configuration } from './util';
|
|
3
|
+
import { type Configuration } from './util';
|
|
4
4
|
import Controller from './Controller';
|
|
5
5
|
declare type Options = RemoteOptions & Configuration;
|
|
6
6
|
/**
|
package/dist/wdio.js
CHANGED
|
@@ -1,30 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -34,33 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
9
|
});
|
|
36
10
|
};
|
|
37
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
-
function step(op) {
|
|
42
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
-
while (_) try {
|
|
44
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
45
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
-
switch (op[0]) {
|
|
47
|
-
case 0: case 1: t = op; break;
|
|
48
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
-
default:
|
|
52
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
-
if (t[2]) _.ops.pop();
|
|
57
|
-
_.trys.pop(); continue;
|
|
58
|
-
}
|
|
59
|
-
op = body.call(thisArg, _);
|
|
60
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
11
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
65
12
|
var t = {};
|
|
66
13
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -77,11 +24,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
77
24
|
};
|
|
78
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
26
|
exports.wrapWdio = exports.WRAPPED_ELEMENT_METHODS = exports.WRAPPED_BROWSER_METHODS = exports.WdioController = exports.wdioTestRunner = exports.wdioConfig = void 0;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
27
|
+
const uuid_1 = require("uuid");
|
|
28
|
+
const fs_1 = __importDefault(require("fs"));
|
|
29
|
+
const util_1 = require("./util");
|
|
30
|
+
const Controller_1 = __importDefault(require("./Controller"));
|
|
31
|
+
const noop = () => {
|
|
85
32
|
// Nothing.
|
|
86
33
|
};
|
|
87
34
|
/**
|
|
@@ -91,19 +38,19 @@ var noop = function () {
|
|
|
91
38
|
*/
|
|
92
39
|
function wdioConfig(_a) {
|
|
93
40
|
var _b;
|
|
94
|
-
var axe = _a
|
|
95
|
-
(0, util_1.writeVariables)(
|
|
41
|
+
var { axe } = _a, options = __rest(_a, ["axe"]);
|
|
42
|
+
(0, util_1.writeVariables)(Object.assign(Object.assign({}, axe), {
|
|
96
43
|
// Ensure the session ID persists between browsers, as
|
|
97
44
|
// WDIO creates a new instance for each test.
|
|
98
45
|
sessionId: axe.sessionId || (0, uuid_1.v4)() }));
|
|
99
46
|
// Disable eslint. Wdio doesn't export this property even though they support it.
|
|
100
47
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
101
|
-
|
|
102
|
-
|
|
48
|
+
const chromeOpts = ((_b = options.capabilities) === null || _b === void 0 ? void 0 : _b['goog:chromeOptions']) || {};
|
|
49
|
+
const args = chromeOpts.args || [];
|
|
103
50
|
if (args.includes('--headless')) {
|
|
104
51
|
throw new util_1.HeadlessNotSupportedError();
|
|
105
52
|
}
|
|
106
|
-
return
|
|
53
|
+
return Object.assign(Object.assign({}, options), { capabilities: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.capabilities), { browserName: 'chrome', 'goog:chromeOptions': {
|
|
107
54
|
args: util_1.extensionArgs.concat(args)
|
|
108
55
|
} }) });
|
|
109
56
|
}
|
|
@@ -111,7 +58,7 @@ exports.wdioConfig = wdioConfig;
|
|
|
111
58
|
// Configuration.axe is not a namespace, therefore have to use ['axe'] instead of .axe
|
|
112
59
|
function wdioTestRunner(axe, config) {
|
|
113
60
|
(0, util_1.writeVariables)(axe);
|
|
114
|
-
|
|
61
|
+
const capabilities = config.capabilities || [
|
|
115
62
|
{
|
|
116
63
|
'goog:chromeOptions': {
|
|
117
64
|
args: []
|
|
@@ -119,35 +66,27 @@ function wdioTestRunner(axe, config) {
|
|
|
119
66
|
}
|
|
120
67
|
];
|
|
121
68
|
// has to be any because type is not exported
|
|
122
|
-
|
|
69
|
+
const firstCapability = capabilities[0];
|
|
123
70
|
firstCapability['goog:chromeOptions'] =
|
|
124
71
|
firstCapability['goog:chromeOptions'] || {};
|
|
125
|
-
|
|
72
|
+
const chromeOpts = firstCapability['goog:chromeOptions'];
|
|
126
73
|
chromeOpts.args = chromeOpts.args || [];
|
|
127
|
-
|
|
74
|
+
const args = chromeOpts.args;
|
|
128
75
|
if (args.includes('--headless')) {
|
|
129
76
|
throw new util_1.HeadlessNotSupportedError();
|
|
130
77
|
}
|
|
131
78
|
chromeOpts.args = util_1.extensionArgs.concat(args);
|
|
132
|
-
|
|
133
|
-
return
|
|
79
|
+
const { onPrepare = noop, onComplete = noop } = config;
|
|
80
|
+
return Object.assign(Object.assign({}, config), { capabilities,
|
|
134
81
|
// Write a static/persistent session to disk so that each worker uses the same session ID.
|
|
135
|
-
onPrepare
|
|
136
|
-
|
|
137
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
138
|
-
params[_i] = arguments[_i];
|
|
139
|
-
}
|
|
140
|
-
var sessionId = axe.sessionId || (0, uuid_1.v4)();
|
|
82
|
+
onPrepare(...params) {
|
|
83
|
+
const sessionId = axe.sessionId || (0, uuid_1.v4)();
|
|
141
84
|
fs_1.default.writeFileSync(util_1.PATH_TO_SESSION_FILE, JSON.stringify({ id: sessionId }));
|
|
142
85
|
// @ts-expect-error TS is angry about calling this ¯\_(ツ)_/¯
|
|
143
|
-
return onPrepare
|
|
144
|
-
},
|
|
86
|
+
return onPrepare(...params);
|
|
87
|
+
},
|
|
145
88
|
// Remove the file, preventing other sessions from reusing its ID.
|
|
146
|
-
onComplete
|
|
147
|
-
var params = [];
|
|
148
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
149
|
-
params[_i] = arguments[_i];
|
|
150
|
-
}
|
|
89
|
+
onComplete(...params) {
|
|
151
90
|
try {
|
|
152
91
|
fs_1.default.unlinkSync(util_1.PATH_TO_SESSION_FILE);
|
|
153
92
|
}
|
|
@@ -155,38 +94,27 @@ function wdioTestRunner(axe, config) {
|
|
|
155
94
|
// Oh well.
|
|
156
95
|
}
|
|
157
96
|
// @ts-expect-error TS is angry about calling this ¯\_(ツ)_/¯
|
|
158
|
-
return onComplete
|
|
97
|
+
return onComplete(...params);
|
|
159
98
|
} });
|
|
160
99
|
}
|
|
161
100
|
exports.wdioTestRunner = wdioTestRunner;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
_this.driver = driver;
|
|
167
|
-
return _this;
|
|
101
|
+
class WdioController extends Controller_1.default {
|
|
102
|
+
constructor(driver) {
|
|
103
|
+
super();
|
|
104
|
+
this.driver = driver;
|
|
168
105
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
case 0:
|
|
179
|
-
script = "\n const callback = arguments[arguments.length - 1];\n Promise.resolve(...arguments)\n .then(".concat(fn, ")\n .then(callback);\n ");
|
|
180
|
-
return [4 /*yield*/, this.driver.executeAsync(script, args)];
|
|
181
|
-
case 1:
|
|
182
|
-
_a.sent();
|
|
183
|
-
return [2 /*return*/];
|
|
184
|
-
}
|
|
185
|
-
});
|
|
106
|
+
executeScript(fn, ...args) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const script = `
|
|
109
|
+
const callback = arguments[arguments.length - 1];
|
|
110
|
+
Promise.resolve(...arguments)
|
|
111
|
+
.then(${fn})
|
|
112
|
+
.then(callback);
|
|
113
|
+
`;
|
|
114
|
+
yield this.driver.executeAsync(script, args);
|
|
186
115
|
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
}(Controller_1.default));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
190
118
|
exports.WdioController = WdioController;
|
|
191
119
|
/** Webdriver `browser` methods. */
|
|
192
120
|
exports.WRAPPED_BROWSER_METHODS = [
|
|
@@ -217,33 +145,16 @@ exports.WRAPPED_ELEMENT_METHODS = [
|
|
|
217
145
|
'waitUntil'
|
|
218
146
|
];
|
|
219
147
|
/** Wrap the given WDIO `browser` object, ensuring axe-core analysis is run after each command. */
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
var res;
|
|
228
|
-
return __generator(this, function (_a) {
|
|
229
|
-
switch (_a.label) {
|
|
230
|
-
case 0: return [4 /*yield*/, fn.apply(void 0, args)];
|
|
231
|
-
case 1:
|
|
232
|
-
res = _a.sent();
|
|
233
|
-
return [4 /*yield*/, controller.analyze({ __UserRequestedAnalyze: false })];
|
|
234
|
-
case 2:
|
|
235
|
-
_a.sent();
|
|
236
|
-
return [2 /*return*/, res];
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
};
|
|
241
|
-
for (var _i = 0, WRAPPED_BROWSER_METHODS_1 = exports.WRAPPED_BROWSER_METHODS; _i < WRAPPED_BROWSER_METHODS_1.length; _i++) {
|
|
242
|
-
var method = WRAPPED_BROWSER_METHODS_1[_i];
|
|
148
|
+
const wrapWdio = (browser, controller) => {
|
|
149
|
+
const wrapper = (fn, ...args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
150
|
+
const res = yield fn(...args);
|
|
151
|
+
yield controller.analyze({ __UserRequestedAnalyze: false });
|
|
152
|
+
return res;
|
|
153
|
+
});
|
|
154
|
+
for (const method of exports.WRAPPED_BROWSER_METHODS) {
|
|
243
155
|
browser.overwriteCommand(method, wrapper);
|
|
244
156
|
}
|
|
245
|
-
for (
|
|
246
|
-
var method = WRAPPED_ELEMENT_METHODS_1[_a];
|
|
157
|
+
for (const method of exports.WRAPPED_ELEMENT_METHODS) {
|
|
247
158
|
browser.overwriteCommand(method, wrapper, true);
|
|
248
159
|
}
|
|
249
160
|
return browser;
|
package/dist/wdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wdio.js","sourceRoot":"","sources":["../src/wdio.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wdio.js","sourceRoot":"","sources":["../src/wdio.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,+BAAiC;AACjC,4CAAmB;AACnB,iCAMe;AACf,8DAAqC;AAErC,MAAM,IAAI,GAAG,GAAS,EAAE;IACtB,WAAW;AACb,CAAC,CAAA;AAID;;;;GAIG;AAEH,SAAgB,UAAU,CAAC,EAA4B;;QAA5B,EAAE,GAAG,OAAuB,EAAlB,OAAO,cAAjB,OAAmB,CAAF;IAC1C,IAAA,qBAAc,kCACT,GAAG;QACN,sDAAsD;QACtD,6CAA6C;QAC7C,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,IAAA,SAAI,GAAE,IAClC,CAAA;IAEF,iFAAiF;IACjF,uDAAuD;IACvD,MAAM,UAAU,GAAG,CAAA,MAAC,OAAO,CAAC,YAAoB,0CAAG,oBAAoB,CAAC,KAAI,EAAE,CAAA;IAC9E,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,EAAE,CAAA;IAElC,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;QAC/B,MAAM,IAAI,gCAAyB,EAAE,CAAA;KACtC;IAED,uCACK,OAAO,KACV,YAAY,kCACP,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,KACxB,WAAW,EAAE,QAAQ,EACrB,oBAAoB,EAAE;gBACpB,IAAI,EAAE,oBAAa,CAAC,MAAM,CAAC,IAAI,CAAC;aACjC,OAEJ;AACH,CAAC;AA3BD,gCA2BC;AAED,sFAAsF;AACtF,SAAgB,cAAc,CAC5B,GAAyB,EACzB,MAA0B;IAE1B,IAAA,qBAAc,EAAC,GAAG,CAAC,CAAA;IACnB,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI;QAC1C;YACE,oBAAoB,EAAE;gBACpB,IAAI,EAAE,EAAE;aACT;SACF;KACF,CAAA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AAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAtBY,QAAA,QAAQ,YAsBpB"}
|
package/dist/webdriver.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WebDriver } from 'selenium-webdriver';
|
|
2
2
|
import type { Options } from 'selenium-webdriver/chrome';
|
|
3
|
-
import { Configuration } from './util';
|
|
3
|
+
import { type Configuration } from './util';
|
|
4
4
|
import Controller from './Controller';
|
|
5
5
|
interface WebDriverArgs extends Configuration {
|
|
6
6
|
options?: Options;
|
package/dist/webdriver.js
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -23,49 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
9
|
});
|
|
25
10
|
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
54
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
55
|
-
if (ar || !(i in from)) {
|
|
56
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
57
|
-
ar[i] = from[i];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
61
|
-
};
|
|
62
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
63
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
64
13
|
};
|
|
65
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
15
|
exports.WebdriverController = exports.webdriverConfig = void 0;
|
|
67
|
-
|
|
68
|
-
|
|
16
|
+
const util_1 = require("./util");
|
|
17
|
+
const Controller_1 = __importDefault(require("./Controller"));
|
|
69
18
|
/**
|
|
70
19
|
* Creates a Selenium config that uses axe extension
|
|
71
20
|
*
|
|
@@ -75,11 +24,11 @@ function webdriverConfig(arg) {
|
|
|
75
24
|
var _a, _b;
|
|
76
25
|
// Lazily require `chrome` to avoid Puppeteer/Playwright/WDIO users from needing `selenium-webdriver` installed.
|
|
77
26
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
78
|
-
|
|
79
|
-
|
|
27
|
+
const chrome = require('selenium-webdriver/chrome');
|
|
28
|
+
const { axe, options } = arg;
|
|
80
29
|
(0, util_1.writeVariables)(axe);
|
|
81
|
-
|
|
82
|
-
opts.addArguments
|
|
30
|
+
const opts = options ? options : new chrome.Options();
|
|
31
|
+
opts.addArguments(...util_1.extensionArgs);
|
|
83
32
|
// Note: fragile, but selenium does not give us a real way to check this
|
|
84
33
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
34
|
if ((_b = (_a = opts === null || opts === void 0 ? void 0 : opts.options_) === null || _a === void 0 ? void 0 : _a.args) === null || _b === void 0 ? void 0 : _b.includes('headless')) {
|
|
@@ -88,34 +37,22 @@ function webdriverConfig(arg) {
|
|
|
88
37
|
return opts;
|
|
89
38
|
}
|
|
90
39
|
exports.webdriverConfig = webdriverConfig;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
_this.driver = driver;
|
|
96
|
-
return _this;
|
|
40
|
+
class WebdriverController extends Controller_1.default {
|
|
41
|
+
constructor(driver) {
|
|
42
|
+
super();
|
|
43
|
+
this.driver = driver;
|
|
97
44
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
switch (_b.label) {
|
|
108
|
-
case 0:
|
|
109
|
-
script = "\n const callback = arguments[arguments.length - 1];\n Promise.resolve(...arguments)\n .then(".concat(fn, ")\n .then(callback);\n ");
|
|
110
|
-
return [4 /*yield*/, (_a = this.driver).executeAsyncScript.apply(_a, __spreadArray([script], args, false))];
|
|
111
|
-
case 1:
|
|
112
|
-
_b.sent();
|
|
113
|
-
return [2 /*return*/];
|
|
114
|
-
}
|
|
115
|
-
});
|
|
45
|
+
executeScript(fn, ...args) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const script = `
|
|
48
|
+
const callback = arguments[arguments.length - 1];
|
|
49
|
+
Promise.resolve(...arguments)
|
|
50
|
+
.then(${fn})
|
|
51
|
+
.then(callback);
|
|
52
|
+
`;
|
|
53
|
+
yield this.driver.executeAsyncScript(script, ...args);
|
|
116
54
|
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
}(Controller_1.default));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
120
57
|
exports.WebdriverController = WebdriverController;
|
|
121
58
|
//# sourceMappingURL=webdriver.js.map
|
package/dist/webdriver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webdriver.js","sourceRoot":"","sources":["../src/webdriver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webdriver.js","sourceRoot":"","sources":["../src/webdriver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,iCAKe;AACf,8DAAqC;AAMrC;;;;GAIG;AAEH,SAAgB,eAAe,CAAC,GAAkB;;IAChD,gHAAgH;IAChH,8DAA8D;IAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAA;IAEnD,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,CAAA;IAC5B,IAAA,qBAAc,EAAC,GAAG,CAAC,CAAA;IAEnB,MAAM,IAAI,GAAY,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAA;IAC9D,IAAI,CAAC,YAAY,CAAC,GAAG,oBAAa,CAAC,CAAA;IAEnC,wEAAwE;IACxE,8DAA8D;IAC9D,IAAI,MAAA,MAAC,IAAY,aAAZ,IAAI,uBAAJ,IAAI,CAAU,QAAQ,0CAAE,IAAI,0CAAE,QAAQ,CAAC,UAAU,CAAC,EAAE;QACvD,MAAM,IAAI,gCAAyB,EAAE,CAAA;KACtC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAlBD,0CAkBC;AAED,MAAa,mBAAoB,SAAQ,oBAAU;IAGjD,YAAY,MAAiB;QAC3B,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEe,aAAa,CAC3B,EAAkC,EAClC,GAAG,IAAe;;YAElB,MAAM,MAAM,GAAG;;;gBAGH,EAAE;;KAEb,CAAA;YACD,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAA;QACvD,CAAC;KAAA;CACF;AApBD,kDAoBC"}
|