@axe-core/watcher 2.0.0-next.3e4ae779 → 2.0.0-next.4be36929
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.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/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.js +165 -463
- package/dist/playwrightWrapping.js.map +1 -1
- package/dist/puppeteer.js +14 -91
- package/dist/puppeteer.js.map +1 -1
- package/dist/puppeteerWrapping.js +141 -409
- package/dist/puppeteerWrapping.js.map +1 -1
- package/dist/util.js +26 -46
- package/dist/util.js.map +1 -1
- package/dist/validateApiKey.js +6 -7
- package/dist/validateApiKey.js.map +1 -1
- package/dist/wdio.js +45 -134
- package/dist/wdio.js.map +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 +1 -1
|
@@ -8,112 +8,45 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.wrapTouchscreen = exports.wrapMouse = exports.wrapKeyboard = exports.wrapJSHandle = exports.wrapLocator = exports.wrapFrameLocator = exports.wrapFrame = exports.wrapElementHandle = exports.wrapPage = exports.wrapBrowser = exports.wrapBrowserContext = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var result;
|
|
49
|
-
return __generator(this, function (_a) {
|
|
50
|
-
switch (_a.label) {
|
|
51
|
-
case 0: return [4 /*yield*/, target[prop].apply(target, args)];
|
|
52
|
-
case 1:
|
|
53
|
-
result = _a.sent();
|
|
54
|
-
return [4 /*yield*/, controller.analyze()];
|
|
55
|
-
case 2:
|
|
56
|
-
_a.sent();
|
|
57
|
-
return [2 /*return*/, result];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
var wrapBrowserContext = function (browserContext, controller) {
|
|
13
|
+
const util_1 = require("./util");
|
|
14
|
+
const wrappedCallWithSideEffects = (target, prop, controller) => (...args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
// @ts-expect-error TypeScript is angry.
|
|
16
|
+
const result = yield target[prop](...args);
|
|
17
|
+
yield controller.analyze();
|
|
18
|
+
return result;
|
|
19
|
+
});
|
|
20
|
+
const wrapBrowserContext = (browserContext, controller) => {
|
|
64
21
|
if ((0, util_1.isWrapped)(browserContext)) {
|
|
65
22
|
return browserContext;
|
|
66
23
|
}
|
|
67
|
-
|
|
68
|
-
get
|
|
69
|
-
var _this = this;
|
|
24
|
+
const browserContextProxy = new Proxy(browserContext, {
|
|
25
|
+
get(target, prop, receiver) {
|
|
70
26
|
switch (prop) {
|
|
71
27
|
case 'newPage':
|
|
72
|
-
return function () {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
78
|
-
var page;
|
|
79
|
-
return __generator(this, function (_a) {
|
|
80
|
-
switch (_a.label) {
|
|
81
|
-
case 0: return [4 /*yield*/, target.newPage.apply(target, args)];
|
|
82
|
-
case 1:
|
|
83
|
-
page = _a.sent();
|
|
84
|
-
return [2 /*return*/, (0, exports.wrapPage)(page, controller)];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
};
|
|
28
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const page = yield target.newPage(...args);
|
|
30
|
+
return (0, exports.wrapPage)(page, controller);
|
|
31
|
+
});
|
|
89
32
|
case 'browser':
|
|
90
|
-
return
|
|
91
|
-
|
|
33
|
+
return () => {
|
|
34
|
+
const browser = target.browser();
|
|
92
35
|
if (!browser) {
|
|
93
36
|
return null;
|
|
94
37
|
}
|
|
95
38
|
return (0, exports.wrapBrowser)(browser, controller);
|
|
96
39
|
};
|
|
97
40
|
case 'pages':
|
|
98
|
-
return
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
args[_i] = arguments[_i];
|
|
102
|
-
}
|
|
103
|
-
var pages = target.pages.apply(target, args);
|
|
104
|
-
return pages.map(function (p) { return (0, exports.wrapPage)(p, controller); });
|
|
41
|
+
return (...args) => {
|
|
42
|
+
const pages = target.pages(...args);
|
|
43
|
+
return pages.map(p => (0, exports.wrapPage)(p, controller));
|
|
105
44
|
};
|
|
106
45
|
case 'close':
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
case 1:
|
|
112
|
-
_a.sent();
|
|
113
|
-
return [2 /*return*/, target.close()];
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}); };
|
|
46
|
+
return () => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
yield controller.flush();
|
|
48
|
+
return target.close();
|
|
49
|
+
});
|
|
117
50
|
default:
|
|
118
51
|
return Reflect.get(target, prop, receiver);
|
|
119
52
|
}
|
|
@@ -123,70 +56,33 @@ var wrapBrowserContext = function (browserContext, controller) {
|
|
|
123
56
|
return browserContextProxy;
|
|
124
57
|
};
|
|
125
58
|
exports.wrapBrowserContext = wrapBrowserContext;
|
|
126
|
-
|
|
59
|
+
const wrapBrowser = (browser, controller) => {
|
|
127
60
|
if ((0, util_1.isWrapped)(browser)) {
|
|
128
61
|
return browser;
|
|
129
62
|
}
|
|
130
|
-
|
|
131
|
-
get
|
|
132
|
-
var _this = this;
|
|
63
|
+
const browserProxy = new Proxy(browser, {
|
|
64
|
+
get(target, prop, receiver) {
|
|
133
65
|
switch (prop) {
|
|
134
66
|
case 'newContext':
|
|
135
|
-
return function () {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
141
|
-
var context;
|
|
142
|
-
return __generator(this, function (_a) {
|
|
143
|
-
switch (_a.label) {
|
|
144
|
-
case 0: return [4 /*yield*/, target.newContext.apply(target, args)];
|
|
145
|
-
case 1:
|
|
146
|
-
context = _a.sent();
|
|
147
|
-
return [2 /*return*/, (0, exports.wrapBrowserContext)(context, controller)];
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
};
|
|
67
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const context = yield target.newContext(...args);
|
|
69
|
+
return (0, exports.wrapBrowserContext)(context, controller);
|
|
70
|
+
});
|
|
152
71
|
case 'newPage':
|
|
153
|
-
return function () {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
159
|
-
var page;
|
|
160
|
-
return __generator(this, function (_a) {
|
|
161
|
-
switch (_a.label) {
|
|
162
|
-
case 0: return [4 /*yield*/, target.newPage.apply(target, args)];
|
|
163
|
-
case 1:
|
|
164
|
-
page = _a.sent();
|
|
165
|
-
return [2 /*return*/, (0, exports.wrapPage)(page, controller)];
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
};
|
|
72
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const page = yield target.newPage(...args);
|
|
74
|
+
return (0, exports.wrapPage)(page, controller);
|
|
75
|
+
});
|
|
170
76
|
case 'contexts':
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
args[_i] = arguments[_i];
|
|
175
|
-
}
|
|
176
|
-
var contexts = target.contexts.apply(target, args);
|
|
177
|
-
return contexts.map(function (c) { return (0, exports.wrapBrowserContext)(c, controller); });
|
|
77
|
+
return (...args) => {
|
|
78
|
+
const contexts = target.contexts(...args);
|
|
79
|
+
return contexts.map(c => (0, exports.wrapBrowserContext)(c, controller));
|
|
178
80
|
};
|
|
179
81
|
case 'close':
|
|
180
|
-
return
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
case 1:
|
|
185
|
-
_a.sent();
|
|
186
|
-
return [2 /*return*/, target.close()];
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
}); };
|
|
82
|
+
return () => __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
yield controller.flush();
|
|
84
|
+
return target.close();
|
|
85
|
+
});
|
|
190
86
|
default:
|
|
191
87
|
return Reflect.get(target, prop, receiver);
|
|
192
88
|
}
|
|
@@ -196,33 +92,20 @@ var wrapBrowser = function (browser, controller) {
|
|
|
196
92
|
return browserProxy;
|
|
197
93
|
};
|
|
198
94
|
exports.wrapBrowser = wrapBrowser;
|
|
199
|
-
|
|
95
|
+
const wrapPage = (page, controller) => {
|
|
200
96
|
if ((0, util_1.isWrapped)(page)) {
|
|
201
97
|
return page;
|
|
202
98
|
}
|
|
203
|
-
|
|
204
|
-
get
|
|
205
|
-
var _this = this;
|
|
99
|
+
const pageProxy = new Proxy(page, {
|
|
100
|
+
get(target, prop, receiver) {
|
|
206
101
|
switch (prop) {
|
|
207
102
|
case 'addScriptTag':
|
|
208
103
|
case 'addStyleTag':
|
|
209
|
-
return function () {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
215
|
-
var style;
|
|
216
|
-
return __generator(this, function (_a) {
|
|
217
|
-
switch (_a.label) {
|
|
218
|
-
case 0: return [4 /*yield*/, target[prop].apply(target, args)];
|
|
219
|
-
case 1:
|
|
220
|
-
style = _a.sent();
|
|
221
|
-
return [2 /*return*/, (0, exports.wrapElementHandle)(style, controller)];
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
};
|
|
104
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
// @ts-expect-error TypeScript is angry.
|
|
106
|
+
const style = yield target[prop](...args);
|
|
107
|
+
return (0, exports.wrapElementHandle)(style, controller);
|
|
108
|
+
});
|
|
226
109
|
case 'bringToFront':
|
|
227
110
|
case 'check':
|
|
228
111
|
case 'click':
|
|
@@ -245,59 +128,35 @@ var wrapPage = function (page, controller) {
|
|
|
245
128
|
case 'uncheck':
|
|
246
129
|
return wrappedCallWithSideEffects(target, prop, controller);
|
|
247
130
|
case 'context':
|
|
248
|
-
return
|
|
249
|
-
|
|
131
|
+
return () => {
|
|
132
|
+
const context = target.context();
|
|
250
133
|
return (0, exports.wrapBrowserContext)(context, controller);
|
|
251
134
|
};
|
|
252
135
|
case 'evaluateHandle':
|
|
253
136
|
case 'waitForFunction':
|
|
254
|
-
return function () {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
260
|
-
var handle;
|
|
261
|
-
return __generator(this, function (_a) {
|
|
262
|
-
switch (_a.label) {
|
|
263
|
-
case 0: return [4 /*yield*/, target[prop].apply(target, args)];
|
|
264
|
-
case 1:
|
|
265
|
-
handle = _a.sent();
|
|
266
|
-
return [2 /*return*/, (0, exports.wrapJSHandle)(handle, controller)];
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
};
|
|
137
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
// @ts-expect-error TypeScript is angry.
|
|
139
|
+
const handle = yield target[prop](...args);
|
|
140
|
+
return (0, exports.wrapJSHandle)(handle, controller);
|
|
141
|
+
});
|
|
271
142
|
case 'frame':
|
|
272
143
|
case 'mainFrame':
|
|
273
|
-
return
|
|
274
|
-
var args = [];
|
|
275
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
276
|
-
args[_i] = arguments[_i];
|
|
277
|
-
}
|
|
144
|
+
return (...args) => {
|
|
278
145
|
// @ts-expect-error TypeScript is angry.
|
|
279
|
-
|
|
146
|
+
const mainFrame = target[prop](...args);
|
|
280
147
|
if (!mainFrame) {
|
|
281
148
|
return null;
|
|
282
149
|
}
|
|
283
150
|
return (0, exports.wrapFrame)(mainFrame, controller);
|
|
284
151
|
};
|
|
285
152
|
case 'frames':
|
|
286
|
-
return
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
args[_i] = arguments[_i];
|
|
290
|
-
}
|
|
291
|
-
var frames = target.frames.apply(target, args);
|
|
292
|
-
return frames.map(function (f) { return (0, exports.wrapFrame)(f, controller); });
|
|
153
|
+
return (...args) => {
|
|
154
|
+
const frames = target.frames(...args);
|
|
155
|
+
return frames.map(f => (0, exports.wrapFrame)(f, controller));
|
|
293
156
|
};
|
|
294
157
|
case 'frameLocator':
|
|
295
|
-
return
|
|
296
|
-
|
|
297
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
298
|
-
args[_i] = arguments[_i];
|
|
299
|
-
}
|
|
300
|
-
var frameLocator = target.frameLocator.apply(target, args);
|
|
158
|
+
return (...args) => {
|
|
159
|
+
const frameLocator = target.frameLocator(...args);
|
|
301
160
|
return (0, exports.wrapFrameLocator)(frameLocator, controller);
|
|
302
161
|
};
|
|
303
162
|
case 'getByAltText':
|
|
@@ -308,13 +167,9 @@ var wrapPage = function (page, controller) {
|
|
|
308
167
|
case 'getByText':
|
|
309
168
|
case 'getByTitle':
|
|
310
169
|
case 'locator':
|
|
311
|
-
return
|
|
312
|
-
var args = [];
|
|
313
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
314
|
-
args[_i] = arguments[_i];
|
|
315
|
-
}
|
|
170
|
+
return (...args) => {
|
|
316
171
|
// @ts-expect-error TypeScript is angry.
|
|
317
|
-
|
|
172
|
+
const el = target[prop](...args);
|
|
318
173
|
return (0, exports.wrapLocator)(el, controller);
|
|
319
174
|
};
|
|
320
175
|
case 'keyboard':
|
|
@@ -324,16 +179,10 @@ var wrapPage = function (page, controller) {
|
|
|
324
179
|
case 'touchscreen':
|
|
325
180
|
return (0, exports.wrapTouchscreen)(target.touchscreen, controller);
|
|
326
181
|
case 'close':
|
|
327
|
-
return
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
case 1:
|
|
332
|
-
_a.sent();
|
|
333
|
-
return [2 /*return*/, target.close()];
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
}); };
|
|
182
|
+
return () => __awaiter(this, void 0, void 0, function* () {
|
|
183
|
+
yield controller.flush();
|
|
184
|
+
return target.close();
|
|
185
|
+
});
|
|
337
186
|
default:
|
|
338
187
|
return Reflect.get(target, prop, receiver);
|
|
339
188
|
}
|
|
@@ -343,52 +192,26 @@ var wrapPage = function (page, controller) {
|
|
|
343
192
|
return pageProxy;
|
|
344
193
|
};
|
|
345
194
|
exports.wrapPage = wrapPage;
|
|
346
|
-
|
|
195
|
+
const wrapElementHandle = (elementHandle, controller) => {
|
|
347
196
|
if ((0, util_1.isWrapped)(elementHandle)) {
|
|
348
197
|
return elementHandle;
|
|
349
198
|
}
|
|
350
|
-
|
|
351
|
-
get
|
|
352
|
-
var _this = this;
|
|
199
|
+
const elementHandleProxy = new Proxy(elementHandle, {
|
|
200
|
+
get(target, prop, receiver) {
|
|
353
201
|
switch (prop) {
|
|
354
202
|
case '$':
|
|
355
203
|
case 'asElement':
|
|
356
204
|
case 'waitForSelector':
|
|
357
|
-
return function () {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
363
|
-
var el;
|
|
364
|
-
return __generator(this, function (_a) {
|
|
365
|
-
switch (_a.label) {
|
|
366
|
-
case 0: return [4 /*yield*/, target[prop].apply(target, args)];
|
|
367
|
-
case 1:
|
|
368
|
-
el = _a.sent();
|
|
369
|
-
return [2 /*return*/, (0, exports.wrapElementHandle)(el, controller)];
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
};
|
|
205
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
// @ts-expect-error TypeScript is angry.
|
|
207
|
+
const el = yield target[prop](...args);
|
|
208
|
+
return (0, exports.wrapElementHandle)(el, controller);
|
|
209
|
+
});
|
|
374
210
|
case '$$':
|
|
375
|
-
return function () {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}
|
|
380
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
381
|
-
var els;
|
|
382
|
-
return __generator(this, function (_a) {
|
|
383
|
-
switch (_a.label) {
|
|
384
|
-
case 0: return [4 /*yield*/, target.$$.apply(target, args)];
|
|
385
|
-
case 1:
|
|
386
|
-
els = _a.sent();
|
|
387
|
-
return [2 /*return*/, els.map(function (e) { return (0, exports.wrapElementHandle)(e, controller); })];
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
});
|
|
391
|
-
};
|
|
211
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
212
|
+
const els = yield target.$$(...args);
|
|
213
|
+
return els.map(e => (0, exports.wrapElementHandle)(e, controller));
|
|
214
|
+
});
|
|
392
215
|
case 'check':
|
|
393
216
|
case 'click':
|
|
394
217
|
case 'dblclick':
|
|
@@ -408,26 +231,14 @@ var wrapElementHandle = function (elementHandle, controller) {
|
|
|
408
231
|
return wrappedCallWithSideEffects(target, prop, controller);
|
|
409
232
|
case 'contentFrame':
|
|
410
233
|
case 'ownerFrame':
|
|
411
|
-
return function () {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
234
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
235
|
+
// @ts-expect-error TypeScript is angry.
|
|
236
|
+
const frame = yield target[prop](...args);
|
|
237
|
+
if (!frame) {
|
|
238
|
+
return null;
|
|
415
239
|
}
|
|
416
|
-
return
|
|
417
|
-
|
|
418
|
-
return __generator(this, function (_a) {
|
|
419
|
-
switch (_a.label) {
|
|
420
|
-
case 0: return [4 /*yield*/, target[prop].apply(target, args)];
|
|
421
|
-
case 1:
|
|
422
|
-
frame = _a.sent();
|
|
423
|
-
if (!frame) {
|
|
424
|
-
return [2 /*return*/, null];
|
|
425
|
-
}
|
|
426
|
-
return [2 /*return*/, (0, exports.wrapFrame)(frame, controller)];
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
});
|
|
430
|
-
};
|
|
240
|
+
return (0, exports.wrapFrame)(frame, controller);
|
|
241
|
+
});
|
|
431
242
|
default:
|
|
432
243
|
return Reflect.get(target, prop, receiver);
|
|
433
244
|
}
|
|
@@ -437,65 +248,35 @@ var wrapElementHandle = function (elementHandle, controller) {
|
|
|
437
248
|
return elementHandleProxy;
|
|
438
249
|
};
|
|
439
250
|
exports.wrapElementHandle = wrapElementHandle;
|
|
440
|
-
|
|
251
|
+
const wrapFrame = (frame, controller) => {
|
|
441
252
|
if ((0, util_1.isWrapped)(frame)) {
|
|
442
253
|
return frame;
|
|
443
254
|
}
|
|
444
|
-
|
|
445
|
-
get
|
|
446
|
-
var _this = this;
|
|
255
|
+
const frameProxy = new Proxy(frame, {
|
|
256
|
+
get(target, prop, receiver) {
|
|
447
257
|
switch (prop) {
|
|
448
258
|
case '$':
|
|
449
259
|
case 'addScriptTag':
|
|
450
260
|
case 'addStyleTag':
|
|
451
261
|
case 'frameElement':
|
|
452
262
|
case 'waitForSelector':
|
|
453
|
-
return function () {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
263
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
264
|
+
// @ts-expect-error TypeScript is angry.
|
|
265
|
+
const el = yield target[prop](...args);
|
|
266
|
+
if (!el) {
|
|
267
|
+
return null;
|
|
457
268
|
}
|
|
458
|
-
return
|
|
459
|
-
|
|
460
|
-
return __generator(this, function (_a) {
|
|
461
|
-
switch (_a.label) {
|
|
462
|
-
case 0: return [4 /*yield*/, target[prop].apply(target, args)];
|
|
463
|
-
case 1:
|
|
464
|
-
el = _a.sent();
|
|
465
|
-
if (!el) {
|
|
466
|
-
return [2 /*return*/, null];
|
|
467
|
-
}
|
|
468
|
-
return [2 /*return*/, (0, exports.wrapElementHandle)(el, controller)];
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
});
|
|
472
|
-
};
|
|
269
|
+
return (0, exports.wrapElementHandle)(el, controller);
|
|
270
|
+
});
|
|
473
271
|
case 'evaluateHandle':
|
|
474
|
-
return function () {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
480
|
-
var el;
|
|
481
|
-
return __generator(this, function (_a) {
|
|
482
|
-
switch (_a.label) {
|
|
483
|
-
case 0: return [4 /*yield*/, target.evaluateHandle.apply(target, args)];
|
|
484
|
-
case 1:
|
|
485
|
-
el = _a.sent();
|
|
486
|
-
return [2 /*return*/, (0, exports.wrapJSHandle)(el, controller)];
|
|
487
|
-
}
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
};
|
|
272
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
273
|
+
const el = yield target.evaluateHandle(...args);
|
|
274
|
+
return (0, exports.wrapJSHandle)(el, controller);
|
|
275
|
+
});
|
|
491
276
|
case 'childFrames':
|
|
492
|
-
return
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
args[_i] = arguments[_i];
|
|
496
|
-
}
|
|
497
|
-
var frames = target.childFrames.apply(target, args);
|
|
498
|
-
return frames.map(function (f) { return (0, exports.wrapFrame)(f, controller); });
|
|
277
|
+
return (...args) => {
|
|
278
|
+
const frames = target.childFrames(...args);
|
|
279
|
+
return frames.map(f => (0, exports.wrapFrame)(f, controller));
|
|
499
280
|
};
|
|
500
281
|
case 'check':
|
|
501
282
|
case 'click':
|
|
@@ -514,12 +295,8 @@ var wrapFrame = function (frame, controller) {
|
|
|
514
295
|
case 'uncheck':
|
|
515
296
|
return wrappedCallWithSideEffects(target, prop, controller);
|
|
516
297
|
case 'frameLocator':
|
|
517
|
-
return
|
|
518
|
-
|
|
519
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
520
|
-
args[_i] = arguments[_i];
|
|
521
|
-
}
|
|
522
|
-
var frameLocator = target.frameLocator.apply(target, args);
|
|
298
|
+
return (...args) => {
|
|
299
|
+
const frameLocator = target.frameLocator(...args);
|
|
523
300
|
return (0, exports.wrapFrameLocator)(frameLocator, controller);
|
|
524
301
|
};
|
|
525
302
|
case 'getByAltText':
|
|
@@ -530,20 +307,16 @@ var wrapFrame = function (frame, controller) {
|
|
|
530
307
|
case 'getByText':
|
|
531
308
|
case 'getByTitle':
|
|
532
309
|
case 'locator':
|
|
533
|
-
return
|
|
534
|
-
var args = [];
|
|
535
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
536
|
-
args[_i] = arguments[_i];
|
|
537
|
-
}
|
|
310
|
+
return (...args) => {
|
|
538
311
|
// @ts-expect-error TypeScript is angry.
|
|
539
|
-
|
|
312
|
+
const el = target[prop](...args);
|
|
540
313
|
return (0, exports.wrapLocator)(el, controller);
|
|
541
314
|
};
|
|
542
315
|
case 'page':
|
|
543
|
-
return
|
|
316
|
+
return () => (0, exports.wrapPage)(target.page(), controller);
|
|
544
317
|
case 'parentFrame':
|
|
545
|
-
return
|
|
546
|
-
|
|
318
|
+
return () => {
|
|
319
|
+
const parentFrame = target.parentFrame();
|
|
547
320
|
if (!parentFrame) {
|
|
548
321
|
return null;
|
|
549
322
|
}
|
|
@@ -558,24 +331,20 @@ var wrapFrame = function (frame, controller) {
|
|
|
558
331
|
return frameProxy;
|
|
559
332
|
};
|
|
560
333
|
exports.wrapFrame = wrapFrame;
|
|
561
|
-
|
|
334
|
+
const wrapFrameLocator = (frameLocator, controller) => {
|
|
562
335
|
if ((0, util_1.isWrapped)(frameLocator)) {
|
|
563
336
|
return frameLocator;
|
|
564
337
|
}
|
|
565
|
-
|
|
566
|
-
get
|
|
338
|
+
const frameLocatorProxy = new Proxy(frameLocator, {
|
|
339
|
+
get(target, prop, receiver) {
|
|
567
340
|
switch (prop) {
|
|
568
341
|
case 'first':
|
|
569
342
|
case 'frameLocator':
|
|
570
343
|
case 'last':
|
|
571
344
|
case 'nth':
|
|
572
|
-
return
|
|
573
|
-
var args = [];
|
|
574
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
575
|
-
args[_i] = arguments[_i];
|
|
576
|
-
}
|
|
345
|
+
return (...args) => {
|
|
577
346
|
// @ts-expect-error TypeScript is angry.
|
|
578
|
-
|
|
347
|
+
const frame = target[prop](...args);
|
|
579
348
|
if (!frame) {
|
|
580
349
|
return null;
|
|
581
350
|
}
|
|
@@ -589,13 +358,9 @@ var wrapFrameLocator = function (frameLocator, controller) {
|
|
|
589
358
|
case 'getByTestId':
|
|
590
359
|
case 'getByText':
|
|
591
360
|
case 'getByTitle':
|
|
592
|
-
return
|
|
593
|
-
var args = [];
|
|
594
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
595
|
-
args[_i] = arguments[_i];
|
|
596
|
-
}
|
|
361
|
+
return (...args) => {
|
|
597
362
|
// @ts-expect-error TypeScript is angry.
|
|
598
|
-
|
|
363
|
+
const el = target[prop](...args);
|
|
599
364
|
return (0, exports.wrapLocator)(el, controller);
|
|
600
365
|
};
|
|
601
366
|
default:
|
|
@@ -607,32 +372,18 @@ var wrapFrameLocator = function (frameLocator, controller) {
|
|
|
607
372
|
return frameLocatorProxy;
|
|
608
373
|
};
|
|
609
374
|
exports.wrapFrameLocator = wrapFrameLocator;
|
|
610
|
-
|
|
375
|
+
const wrapLocator = (locator, controller) => {
|
|
611
376
|
if ((0, util_1.isWrapped)(locator)) {
|
|
612
377
|
return locator;
|
|
613
378
|
}
|
|
614
|
-
|
|
615
|
-
get
|
|
616
|
-
var _this = this;
|
|
379
|
+
const locatorProxy = new Proxy(locator, {
|
|
380
|
+
get(target, prop, receiver) {
|
|
617
381
|
switch (prop) {
|
|
618
382
|
case 'all':
|
|
619
|
-
return function () {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
624
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
625
|
-
var els;
|
|
626
|
-
return __generator(this, function (_a) {
|
|
627
|
-
switch (_a.label) {
|
|
628
|
-
case 0: return [4 /*yield*/, target.all.apply(target, args)];
|
|
629
|
-
case 1:
|
|
630
|
-
els = _a.sent();
|
|
631
|
-
return [2 /*return*/, els.map(function (e) { return (0, exports.wrapLocator)(e, controller); })];
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
});
|
|
635
|
-
};
|
|
383
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
384
|
+
const els = yield target.all(...args);
|
|
385
|
+
return els.map(e => (0, exports.wrapLocator)(e, controller));
|
|
386
|
+
});
|
|
636
387
|
case 'blur':
|
|
637
388
|
case 'check':
|
|
638
389
|
case 'click':
|
|
@@ -654,50 +405,23 @@ var wrapLocator = function (locator, controller) {
|
|
|
654
405
|
case 'uncheck':
|
|
655
406
|
return wrappedCallWithSideEffects(target, prop, controller);
|
|
656
407
|
case 'elementHandle':
|
|
657
|
-
return
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
if (!el) {
|
|
665
|
-
return [2 /*return*/, null];
|
|
666
|
-
}
|
|
667
|
-
return [2 /*return*/, (0, exports.wrapElementHandle)(el, controller)];
|
|
668
|
-
}
|
|
669
|
-
});
|
|
670
|
-
}); };
|
|
408
|
+
return () => __awaiter(this, void 0, void 0, function* () {
|
|
409
|
+
const el = yield target.elementHandle();
|
|
410
|
+
if (!el) {
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
return (0, exports.wrapElementHandle)(el, controller);
|
|
414
|
+
});
|
|
671
415
|
case 'elementHandles':
|
|
672
|
-
return
|
|
673
|
-
|
|
674
|
-
return
|
|
675
|
-
|
|
676
|
-
case 0: return [4 /*yield*/, target.elementHandles()];
|
|
677
|
-
case 1:
|
|
678
|
-
els = _a.sent();
|
|
679
|
-
return [2 /*return*/, els.map(function (e) { return (0, exports.wrapElementHandle)(e, controller); })];
|
|
680
|
-
}
|
|
681
|
-
});
|
|
682
|
-
}); };
|
|
416
|
+
return () => __awaiter(this, void 0, void 0, function* () {
|
|
417
|
+
const els = yield target.elementHandles();
|
|
418
|
+
return els.map(e => (0, exports.wrapElementHandle)(e, controller));
|
|
419
|
+
});
|
|
683
420
|
case 'evaluateHandle':
|
|
684
|
-
return function () {
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
}
|
|
689
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
690
|
-
var handle;
|
|
691
|
-
return __generator(this, function (_a) {
|
|
692
|
-
switch (_a.label) {
|
|
693
|
-
case 0: return [4 /*yield*/, target.evaluateHandle.apply(target, args)];
|
|
694
|
-
case 1:
|
|
695
|
-
handle = _a.sent();
|
|
696
|
-
return [2 /*return*/, (0, exports.wrapJSHandle)(handle, controller)];
|
|
697
|
-
}
|
|
698
|
-
});
|
|
699
|
-
});
|
|
700
|
-
};
|
|
421
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
422
|
+
const handle = yield target.evaluateHandle(...args);
|
|
423
|
+
return (0, exports.wrapJSHandle)(handle, controller);
|
|
424
|
+
});
|
|
701
425
|
case 'filter':
|
|
702
426
|
case 'first':
|
|
703
427
|
case 'last':
|
|
@@ -710,28 +434,20 @@ var wrapLocator = function (locator, controller) {
|
|
|
710
434
|
case 'getByTestId':
|
|
711
435
|
case 'getByText':
|
|
712
436
|
case 'getByTitle':
|
|
713
|
-
return
|
|
714
|
-
var args = [];
|
|
715
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
716
|
-
args[_i] = arguments[_i];
|
|
717
|
-
}
|
|
437
|
+
return (...args) => {
|
|
718
438
|
// @ts-expect-error TypeScript doesn't like this.
|
|
719
|
-
|
|
439
|
+
const el = target[prop](...args);
|
|
720
440
|
return (0, exports.wrapLocator)(el, controller);
|
|
721
441
|
};
|
|
722
442
|
case 'frameLocator':
|
|
723
|
-
return
|
|
724
|
-
var args = [];
|
|
725
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
726
|
-
args[_i] = arguments[_i];
|
|
727
|
-
}
|
|
443
|
+
return (...args) => {
|
|
728
444
|
// @ts-expect-error TypeScript doesn't like this.
|
|
729
|
-
|
|
445
|
+
const frame = target[prop](...args);
|
|
730
446
|
return (0, exports.wrapFrameLocator)(frame, controller);
|
|
731
447
|
};
|
|
732
448
|
case 'page':
|
|
733
|
-
return
|
|
734
|
-
|
|
449
|
+
return () => {
|
|
450
|
+
const page = target[prop]();
|
|
735
451
|
return (0, exports.wrapPage)(page, controller);
|
|
736
452
|
};
|
|
737
453
|
default:
|
|
@@ -743,40 +459,26 @@ var wrapLocator = function (locator, controller) {
|
|
|
743
459
|
return locatorProxy;
|
|
744
460
|
};
|
|
745
461
|
exports.wrapLocator = wrapLocator;
|
|
746
|
-
|
|
462
|
+
const wrapJSHandle = (jsHandle, controller) => {
|
|
747
463
|
if ((0, util_1.isWrapped)(jsHandle)) {
|
|
748
464
|
return jsHandle;
|
|
749
465
|
}
|
|
750
|
-
|
|
751
|
-
get
|
|
752
|
-
var _this = this;
|
|
466
|
+
const jsHandleProxy = new Proxy(jsHandle, {
|
|
467
|
+
get(target, prop, receiver) {
|
|
753
468
|
switch (prop) {
|
|
754
469
|
case 'asElement':
|
|
755
|
-
return
|
|
756
|
-
|
|
470
|
+
return () => {
|
|
471
|
+
const el = target.asElement();
|
|
757
472
|
if (!el) {
|
|
758
473
|
return null;
|
|
759
474
|
}
|
|
760
475
|
return (0, exports.wrapElementHandle)(el, controller);
|
|
761
476
|
};
|
|
762
477
|
case 'evaluateHandle':
|
|
763
|
-
return function () {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
768
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
769
|
-
var handle;
|
|
770
|
-
return __generator(this, function (_a) {
|
|
771
|
-
switch (_a.label) {
|
|
772
|
-
case 0: return [4 /*yield*/, target.evaluateHandle.apply(target, args)];
|
|
773
|
-
case 1:
|
|
774
|
-
handle = _a.sent();
|
|
775
|
-
return [2 /*return*/, (0, exports.wrapJSHandle)(handle, controller)];
|
|
776
|
-
}
|
|
777
|
-
});
|
|
778
|
-
});
|
|
779
|
-
};
|
|
478
|
+
return (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
479
|
+
const handle = yield target.evaluateHandle(...args);
|
|
480
|
+
return (0, exports.wrapJSHandle)(handle, controller);
|
|
481
|
+
});
|
|
780
482
|
default:
|
|
781
483
|
return Reflect.get(target, prop, receiver);
|
|
782
484
|
}
|
|
@@ -786,12 +488,12 @@ var wrapJSHandle = function (jsHandle, controller) {
|
|
|
786
488
|
return jsHandleProxy;
|
|
787
489
|
};
|
|
788
490
|
exports.wrapJSHandle = wrapJSHandle;
|
|
789
|
-
|
|
491
|
+
const wrapKeyboard = (keyboard, controller) => {
|
|
790
492
|
if ((0, util_1.isWrapped)(keyboard)) {
|
|
791
493
|
return keyboard;
|
|
792
494
|
}
|
|
793
|
-
|
|
794
|
-
get
|
|
495
|
+
const keyboardProxy = new Proxy(keyboard, {
|
|
496
|
+
get(target, prop, receiver) {
|
|
795
497
|
switch (prop) {
|
|
796
498
|
case 'down':
|
|
797
499
|
case 'press':
|
|
@@ -808,12 +510,12 @@ var wrapKeyboard = function (keyboard, controller) {
|
|
|
808
510
|
return keyboardProxy;
|
|
809
511
|
};
|
|
810
512
|
exports.wrapKeyboard = wrapKeyboard;
|
|
811
|
-
|
|
513
|
+
const wrapMouse = (mouse, controller) => {
|
|
812
514
|
if ((0, util_1.isWrapped)(mouse)) {
|
|
813
515
|
return mouse;
|
|
814
516
|
}
|
|
815
|
-
|
|
816
|
-
get
|
|
517
|
+
const mouseProxy = new Proxy(mouse, {
|
|
518
|
+
get(target, prop, receiver) {
|
|
817
519
|
switch (prop) {
|
|
818
520
|
case 'click':
|
|
819
521
|
case 'dblclick':
|
|
@@ -831,12 +533,12 @@ var wrapMouse = function (mouse, controller) {
|
|
|
831
533
|
return mouseProxy;
|
|
832
534
|
};
|
|
833
535
|
exports.wrapMouse = wrapMouse;
|
|
834
|
-
|
|
536
|
+
const wrapTouchscreen = (touchscreen, controller) => {
|
|
835
537
|
if ((0, util_1.isWrapped)(touchscreen)) {
|
|
836
538
|
return touchscreen;
|
|
837
539
|
}
|
|
838
|
-
|
|
839
|
-
get
|
|
540
|
+
const touchscreenProxy = new Proxy(touchscreen, {
|
|
541
|
+
get(target, prop, receiver) {
|
|
840
542
|
switch (prop) {
|
|
841
543
|
case 'tap':
|
|
842
544
|
return wrappedCallWithSideEffects(target, prop, controller);
|