@axe-core/watcher 2.0.0 → 2.1.1-next.293a245f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Controller.d.ts +9 -6
- package/dist/Controller.js +102 -139
- package/dist/Controller.js.map +1 -1
- package/dist/cypress.d.ts +1 -1
- package/dist/cypress.js +8 -37
- package/dist/cypress.js.map +1 -1
- package/dist/cypressCommands.d.ts +8 -5
- package/dist/cypressCommands.js +126 -116
- package/dist/cypressCommands.js.map +1 -1
- package/dist/git.d.ts +2 -0
- package/dist/git.js +31 -22
- package/dist/git.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/playwright.d.ts +6 -4
- package/dist/playwright.js +17 -82
- package/dist/playwright.js.map +1 -1
- package/dist/playwrightTest.d.ts +16 -0
- package/dist/playwrightTest.js +74 -0
- package/dist/playwrightTest.js.map +1 -0
- package/dist/playwrightWrapping.d.ts +2 -8
- package/dist/playwrightWrapping.js +212 -491
- package/dist/playwrightWrapping.js.map +1 -1
- package/dist/puppeteer.d.ts +3 -3
- package/dist/puppeteer.js +18 -92
- package/dist/puppeteer.js.map +1 -1
- package/dist/puppeteerWrapping.d.ts +14 -0
- package/dist/puppeteerWrapping.js +426 -0
- package/dist/puppeteerWrapping.js.map +1 -0
- package/dist/util.d.ts +12 -0
- package/dist/util.js +69 -45
- 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 +5 -2
- package/dist/wdio.js +60 -147
- package/dist/wdio.js.map +1 -1
- package/dist/webdriver.d.ts +3 -3
- package/dist/webdriver.js +25 -85
- package/dist/webdriver.js.map +1 -1
- package/dist/webdriverWrapping.d.ts +7 -0
- package/dist/webdriverWrapping.js +131 -0
- package/dist/webdriverWrapping.js.map +1 -0
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/extension/manifest.json +2 -3
- package/package.json +7 -7
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAiC;AACjC,4CAAmB;AACnB,gDAAuB;AACvB,4CAAmB;AACnB,2CAA4B;AAC5B,sEAA6C;AAGhC,QAAA,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAA;AAC3D,QAAA,kBAAkB,GAAG,wBAAwB,CAAA;AAC7C,QAAA,oBAAoB,GAAG,cAAI,CAAC,IAAI,CAC3C,YAAE,CAAC,MAAM,EAAE,EACX,0BAA0B,CAC3B,CAAA;AACY,QAAA,2BAA2B,GAAG,cAAI,CAAC,IAAI,CAClD,yBAAiB,EACjB,gBAAgB,CACjB,CAAA;AAEY,QAAA,aAAa,GAAG;IAC3B,+BAA+B,yBAAiB,EAAE;IAClD,oBAAoB,yBAAiB,EAAE;CAC/B,CAAA;AAEV,MAAa,yBAA0B,SAAQ,KAAK;IAGlD;QACE,KAAK,CAAC,sCAAsC,CAAC,CAAA;QAHxC,SAAI,GAAG,2BAA2B,CAAA;IAIzC,CAAC;CACF;AAND,8DAMC;AA+CD,6EAA6E;AAC7E,SAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,SAAS,EACT,SAAS,EACT,WAAW,EACX,OAAO,EACP,eAAe,EACf,cAAc,EAAE,oBAAoB,GAAG,IAAI,EACtB;IACrB,IAAI,CAAC,SAAS,EAAE;QACd,SAAS,GAAG,0BAAkB,CAAA;KAC/B;IAED,IAAI,SAAS,CAAA;IACb,IAAI;QACF,SAAS,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAA;KAC1C;IAA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,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IAC1C,SAAS,CAAC,YAAY,GAAG,GAAG,CAAA;IAC5B,YAAE,CAAC,aAAa,CAAC,mCAA2B,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAA;AAC1E,CAAC,CAAA;AALY,QAAA,iBAAiB,qBAK7B;AAED,MAAM,QAAQ,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAM9C,mCAAmC;AAC5B,MAAM,SAAS,GAAG,CAAI,CAAqB,EAAW,EAAE;IAC7D,IAAI,CAAC,CAAC,EAAE;QACN,OAAO,KAAK,CAAA;KACb;IACD,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAA;AAC7B,CAAC,CAAA;AALY,QAAA,SAAS,aAKrB;AAED,wCAAwC;AACjC,MAAM,aAAa,GAAG,CAAC,CAAU,EAAQ,EAAE;IAChD,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE;QACjC,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,IAAI;KACZ,CAAC,CAAA;AACJ,CAAC,CAAA;AANY,QAAA,aAAa,iBAMzB;AAEM,MAAM,0BAA0B,GACrC,CAAC,MAAe,EAAE,IAAY,EAAE,UAAsB,EAAE,EAAE,CAC1D,CAAO,GAAG,IAAe,EAAoB,EAAE;IAC7C,wCAAwC;IACxC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IAC1C,MAAM,UAAU,CAAC,OAAO,EAAE,CAAA;IAC1B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA,CAAA;AAPU,QAAA,0BAA0B,8BAOpC"}
|
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
|
/**
|
|
@@ -9,11 +9,14 @@ declare type Options = RemoteOptions & Configuration;
|
|
|
9
9
|
* @param arg Config to extend
|
|
10
10
|
*/
|
|
11
11
|
export declare function wdioConfig({ axe, ...options }: Options): RemoteOptions;
|
|
12
|
+
/** @deprecated This method of configuring the TestRunner is no longer supported. */
|
|
12
13
|
export declare function wdioTestRunner(axe: Configuration['axe'], config: Options.Testrunner): Options.Testrunner;
|
|
14
|
+
/** Configure WDIO TestRunner with axe Watcher. */
|
|
15
|
+
export declare function wdioTestRunner({ axe, ...config }: Options.Testrunner & Configuration): Options.Testrunner;
|
|
13
16
|
export declare class WdioController extends Controller {
|
|
14
17
|
private driver;
|
|
15
18
|
constructor(driver: Browser);
|
|
16
|
-
protected executeScript(fn: string | (() => Promise<
|
|
19
|
+
protected executeScript<T>(fn: string | (() => Promise<T>), ...args: unknown[]): Promise<T>;
|
|
17
20
|
}
|
|
18
21
|
/** Webdriver `browser` methods. */
|
|
19
22
|
export declare const WRAPPED_BROWSER_METHODS: ReadonlyArray<keyof BrowserCommandsType>;
|
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,10 @@ 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
|
-
var noop = function () {
|
|
27
|
+
const fs_1 = __importDefault(require("fs"));
|
|
28
|
+
const util_1 = require("./util");
|
|
29
|
+
const Controller_1 = __importDefault(require("./Controller"));
|
|
30
|
+
const noop = () => {
|
|
85
31
|
// Nothing.
|
|
86
32
|
};
|
|
87
33
|
/**
|
|
@@ -91,63 +37,57 @@ var noop = function () {
|
|
|
91
37
|
*/
|
|
92
38
|
function wdioConfig(_a) {
|
|
93
39
|
var _b;
|
|
94
|
-
var axe = _a
|
|
95
|
-
(0, util_1.writeVariables)(
|
|
96
|
-
// Ensure the session ID persists between browsers, as
|
|
97
|
-
// WDIO creates a new instance for each test.
|
|
98
|
-
sessionId: axe.sessionId || (0, uuid_1.v4)() }));
|
|
40
|
+
var { axe } = _a, options = __rest(_a, ["axe"]);
|
|
41
|
+
(0, util_1.writeVariables)(axe);
|
|
99
42
|
// Disable eslint. Wdio doesn't export this property even though they support it.
|
|
100
43
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
101
|
-
|
|
102
|
-
|
|
44
|
+
const chromeOpts = ((_b = options.capabilities) === null || _b === void 0 ? void 0 : _b['goog:chromeOptions']) || {};
|
|
45
|
+
const args = chromeOpts.args || [];
|
|
103
46
|
if (args.includes('--headless')) {
|
|
104
47
|
throw new util_1.HeadlessNotSupportedError();
|
|
105
48
|
}
|
|
106
|
-
return
|
|
49
|
+
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
50
|
args: util_1.extensionArgs.concat(args)
|
|
108
51
|
} }) });
|
|
109
52
|
}
|
|
110
53
|
exports.wdioConfig = wdioConfig;
|
|
111
|
-
|
|
112
|
-
function wdioTestRunner(
|
|
54
|
+
const CHROME_OPTIONS = 'goog:chromeOptions';
|
|
55
|
+
function wdioTestRunner(...params) {
|
|
56
|
+
var _a;
|
|
57
|
+
let axe;
|
|
58
|
+
let config;
|
|
59
|
+
if (params.length === 1) {
|
|
60
|
+
;
|
|
61
|
+
(_a = params[0], { axe } = _a, config = __rest(_a, ["axe"]));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
;
|
|
65
|
+
[axe, config] = params;
|
|
66
|
+
}
|
|
113
67
|
(0, util_1.writeVariables)(axe);
|
|
114
|
-
|
|
115
|
-
{
|
|
116
|
-
'goog:chromeOptions': {
|
|
117
|
-
args: []
|
|
118
|
-
}
|
|
119
|
-
}
|
|
68
|
+
const capabilities = config.capabilities || [
|
|
69
|
+
{ [CHROME_OPTIONS]: { args: [] } }
|
|
120
70
|
];
|
|
121
71
|
// has to be any because type is not exported
|
|
122
|
-
|
|
123
|
-
firstCapability[
|
|
124
|
-
|
|
125
|
-
var chromeOpts = firstCapability['goog:chromeOptions'];
|
|
72
|
+
const firstCapability = capabilities[0];
|
|
73
|
+
firstCapability[CHROME_OPTIONS] = firstCapability[CHROME_OPTIONS] || {};
|
|
74
|
+
const chromeOpts = firstCapability[CHROME_OPTIONS];
|
|
126
75
|
chromeOpts.args = chromeOpts.args || [];
|
|
127
|
-
|
|
76
|
+
const args = chromeOpts.args;
|
|
128
77
|
if (args.includes('--headless')) {
|
|
129
78
|
throw new util_1.HeadlessNotSupportedError();
|
|
130
79
|
}
|
|
131
80
|
chromeOpts.args = util_1.extensionArgs.concat(args);
|
|
132
|
-
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
var params = [];
|
|
137
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
138
|
-
params[_i] = arguments[_i];
|
|
139
|
-
}
|
|
140
|
-
var sessionId = axe.sessionId || (0, uuid_1.v4)();
|
|
81
|
+
const { onPrepare = noop, onComplete = noop } = config;
|
|
82
|
+
return Object.assign(Object.assign({}, config), { capabilities,
|
|
83
|
+
onPrepare(...prepareParams) {
|
|
84
|
+
const sessionId = axe.sessionId;
|
|
141
85
|
fs_1.default.writeFileSync(util_1.PATH_TO_SESSION_FILE, JSON.stringify({ id: sessionId }));
|
|
142
86
|
// @ts-expect-error TS is angry about calling this ¯\_(ツ)_/¯
|
|
143
|
-
return onPrepare
|
|
144
|
-
},
|
|
87
|
+
return onPrepare(...prepareParams);
|
|
88
|
+
},
|
|
145
89
|
// 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
|
-
}
|
|
90
|
+
onComplete(...completeParams) {
|
|
151
91
|
try {
|
|
152
92
|
fs_1.default.unlinkSync(util_1.PATH_TO_SESSION_FILE);
|
|
153
93
|
}
|
|
@@ -155,38 +95,28 @@ function wdioTestRunner(axe, config) {
|
|
|
155
95
|
// Oh well.
|
|
156
96
|
}
|
|
157
97
|
// @ts-expect-error TS is angry about calling this ¯\_(ツ)_/¯
|
|
158
|
-
return onComplete
|
|
98
|
+
return onComplete(...completeParams);
|
|
159
99
|
} });
|
|
160
100
|
}
|
|
161
101
|
exports.wdioTestRunner = wdioTestRunner;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
_this.driver = driver;
|
|
167
|
-
return _this;
|
|
102
|
+
class WdioController extends Controller_1.default {
|
|
103
|
+
constructor(driver) {
|
|
104
|
+
super();
|
|
105
|
+
this.driver = driver;
|
|
168
106
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
});
|
|
107
|
+
executeScript(fn, ...args) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
const script = `
|
|
110
|
+
const callback = arguments[arguments.length - 1];
|
|
111
|
+
Promise.resolve(...arguments)
|
|
112
|
+
.then(${fn})
|
|
113
|
+
.then(callback);
|
|
114
|
+
`;
|
|
115
|
+
const result = yield this.driver.executeAsync(script, ...args);
|
|
116
|
+
return result;
|
|
186
117
|
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
}(Controller_1.default));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
190
120
|
exports.WdioController = WdioController;
|
|
191
121
|
/** Webdriver `browser` methods. */
|
|
192
122
|
exports.WRAPPED_BROWSER_METHODS = [
|
|
@@ -217,33 +147,16 @@ exports.WRAPPED_ELEMENT_METHODS = [
|
|
|
217
147
|
'waitUntil'
|
|
218
148
|
];
|
|
219
149
|
/** 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];
|
|
150
|
+
const wrapWdio = (browser, controller) => {
|
|
151
|
+
const wrapper = (fn, ...args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
152
|
+
const res = yield fn(...args);
|
|
153
|
+
yield controller.analyze({ __UserRequestedAnalyze: false });
|
|
154
|
+
return res;
|
|
155
|
+
});
|
|
156
|
+
for (const method of exports.WRAPPED_BROWSER_METHODS) {
|
|
243
157
|
browser.overwriteCommand(method, wrapper);
|
|
244
158
|
}
|
|
245
|
-
for (
|
|
246
|
-
var method = WRAPPED_ELEMENT_METHODS_1[_a];
|
|
159
|
+
for (const method of exports.WRAPPED_ELEMENT_METHODS) {
|
|
247
160
|
browser.overwriteCommand(method, wrapper, true);
|
|
248
161
|
}
|
|
249
162
|
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,4CAAmB;AACnB,iCAMe;AACf,8DAAqC;AAErC,MAAM,IAAI,GAAG,GAAS,EAAE;IACtB,WAAW;AACb,CAAC,CAAA;AAID;;;;GAIG;AAEH,SAAgB,UAA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AAtBY,QAAA,QAAQ,YAsBpB"}
|
package/dist/webdriver.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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
|
+
export { wrapDriver as wrapWebdriver } from './webdriverWrapping';
|
|
5
6
|
interface WebDriverArgs extends Configuration {
|
|
6
7
|
options?: Options;
|
|
7
8
|
}
|
|
@@ -14,6 +15,5 @@ export declare function webdriverConfig(arg: WebDriverArgs): Options;
|
|
|
14
15
|
export declare class WebdriverController extends Controller {
|
|
15
16
|
private driver;
|
|
16
17
|
constructor(driver: WebDriver);
|
|
17
|
-
protected executeScript(fn: string | (() => Promise<
|
|
18
|
+
protected executeScript<T>(fn: string | (() => Promise<T>), ...args: unknown[]): Promise<T>;
|
|
18
19
|
}
|
|
19
|
-
export {};
|
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,15 @@ 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
|
-
exports.WebdriverController = exports.webdriverConfig = void 0;
|
|
67
|
-
|
|
68
|
-
|
|
15
|
+
exports.WebdriverController = exports.webdriverConfig = exports.wrapWebdriver = void 0;
|
|
16
|
+
const util_1 = require("./util");
|
|
17
|
+
const Controller_1 = __importDefault(require("./Controller"));
|
|
18
|
+
var webdriverWrapping_1 = require("./webdriverWrapping");
|
|
19
|
+
Object.defineProperty(exports, "wrapWebdriver", { enumerable: true, get: function () { return webdriverWrapping_1.wrapDriver; } });
|
|
69
20
|
/**
|
|
70
21
|
* Creates a Selenium config that uses axe extension
|
|
71
22
|
*
|
|
@@ -75,11 +26,11 @@ function webdriverConfig(arg) {
|
|
|
75
26
|
var _a, _b;
|
|
76
27
|
// Lazily require `chrome` to avoid Puppeteer/Playwright/WDIO users from needing `selenium-webdriver` installed.
|
|
77
28
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
78
|
-
|
|
79
|
-
|
|
29
|
+
const chrome = require('selenium-webdriver/chrome');
|
|
30
|
+
const { axe, options } = arg;
|
|
80
31
|
(0, util_1.writeVariables)(axe);
|
|
81
|
-
|
|
82
|
-
opts.addArguments
|
|
32
|
+
const opts = options ? options : new chrome.Options();
|
|
33
|
+
opts.addArguments(...util_1.extensionArgs);
|
|
83
34
|
// Note: fragile, but selenium does not give us a real way to check this
|
|
84
35
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
36
|
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 +39,23 @@ function webdriverConfig(arg) {
|
|
|
88
39
|
return opts;
|
|
89
40
|
}
|
|
90
41
|
exports.webdriverConfig = webdriverConfig;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
_this.driver = driver;
|
|
96
|
-
return _this;
|
|
42
|
+
class WebdriverController extends Controller_1.default {
|
|
43
|
+
constructor(driver) {
|
|
44
|
+
super();
|
|
45
|
+
this.driver = driver;
|
|
97
46
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
});
|
|
47
|
+
executeScript(fn, ...args) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const script = `
|
|
50
|
+
const callback = arguments[arguments.length - 1];
|
|
51
|
+
Promise.resolve(...arguments)
|
|
52
|
+
.then(${fn})
|
|
53
|
+
.then(callback);
|
|
54
|
+
`;
|
|
55
|
+
const result = yield this.driver.executeAsyncScript(script, ...args);
|
|
56
|
+
return result;
|
|
116
57
|
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
}(Controller_1.default));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
120
60
|
exports.WebdriverController = WebdriverController;
|
|
121
61
|
//# 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;AAErC,yDAAiE;AAAxD,kHAAA,UAAU,OAAiB;AAMpC;;;;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,EAA+B,EAC/B,GAAG,IAAe;;YAElB,MAAM,MAAM,GAAG;;;gBAGH,EAAE;;KAEb,CAAA;YACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAA;YACpE,OAAO,MAAW,CAAA;QACpB,CAAC;KAAA;CACF;AArBD,kDAqBC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WebDriver, Navigation, WebElement, TargetLocator } from 'selenium-webdriver';
|
|
2
|
+
import { type PossiblyWrapped } from './util';
|
|
3
|
+
import type { WebdriverController } from './webdriver';
|
|
4
|
+
export declare const wrapDriver: (driver: PossiblyWrapped<WebDriver>, controller: WebdriverController) => WebDriver;
|
|
5
|
+
export declare const wrapNavigation: (navigation: PossiblyWrapped<Navigation>, controller: WebdriverController) => Navigation;
|
|
6
|
+
export declare const wrapTargetLocator: (locator: PossiblyWrapped<TargetLocator>, controller: WebdriverController) => TargetLocator;
|
|
7
|
+
export declare const wrapElement: (element: PossiblyWrapped<WebElement>, controller: WebdriverController) => WebElement;
|