webdriverio 7.21.0 → 8.0.0-alpha.239
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/build/cjs/index.d.ts +3 -0
- package/build/cjs/index.d.ts.map +1 -0
- package/build/cjs/index.js +13 -0
- package/build/cjs/package.json +3 -0
- package/build/commands/browser/$$.js +6 -9
- package/build/commands/browser/$.js +8 -11
- package/build/commands/browser/action.d.ts +128 -0
- package/build/commands/browser/action.d.ts.map +1 -0
- package/build/commands/browser/action.js +13 -0
- package/build/commands/browser/actions.d.ts +29 -0
- package/build/commands/browser/actions.d.ts.map +1 -0
- package/build/commands/browser/actions.js +30 -0
- package/build/commands/browser/call.js +1 -4
- package/build/commands/browser/custom$$.js +7 -10
- package/build/commands/browser/custom$.js +5 -8
- package/build/commands/browser/debug.js +8 -14
- package/build/commands/browser/deleteCookies.js +1 -4
- package/build/commands/browser/execute.js +3 -6
- package/build/commands/browser/executeAsync.js +3 -6
- package/build/commands/browser/getCookies.js +1 -4
- package/build/commands/browser/getPuppeteer.d.ts +1 -1
- package/build/commands/browser/getPuppeteer.d.ts.map +1 -1
- package/build/commands/browser/getPuppeteer.js +14 -21
- package/build/commands/browser/getWindowSize.js +3 -6
- package/build/commands/browser/keys.d.ts +20 -10
- package/build/commands/browser/keys.d.ts.map +1 -1
- package/build/commands/browser/keys.js +29 -24
- package/build/commands/browser/mock.d.ts +1 -1
- package/build/commands/browser/mock.d.ts.map +1 -1
- package/build/commands/browser/mock.js +12 -19
- package/build/commands/browser/mockClearAll.js +5 -11
- package/build/commands/browser/mockRestoreAll.js +5 -11
- package/build/commands/browser/newWindow.js +5 -11
- package/build/commands/browser/pause.js +1 -4
- package/build/commands/browser/react$$.d.ts.map +1 -1
- package/build/commands/browser/react$$.js +12 -16
- package/build/commands/browser/react$.d.ts.map +1 -1
- package/build/commands/browser/react$.js +10 -14
- package/build/commands/browser/reloadSession.js +5 -12
- package/build/commands/browser/savePDF.js +7 -13
- package/build/commands/browser/saveRecordingScreen.js +6 -12
- package/build/commands/browser/saveScreenshot.js +6 -12
- package/build/commands/browser/scroll.d.ts +25 -0
- package/build/commands/browser/scroll.d.ts.map +1 -0
- package/build/commands/browser/scroll.js +41 -0
- package/build/commands/browser/setCookies.js +1 -4
- package/build/commands/browser/setTimeout.js +1 -4
- package/build/commands/browser/setWindowSize.js +3 -6
- package/build/commands/browser/switchWindow.js +1 -4
- package/build/commands/browser/throttle.js +3 -6
- package/build/commands/browser/touchAction.d.ts +1 -1
- package/build/commands/browser/touchAction.d.ts.map +1 -1
- package/build/commands/browser/touchAction.js +3 -6
- package/build/commands/browser/uploadFile.d.ts +1 -1
- package/build/commands/browser/uploadFile.d.ts.map +1 -1
- package/build/commands/browser/uploadFile.js +10 -15
- package/build/commands/browser/url.js +3 -6
- package/build/commands/browser/waitUntil.js +3 -9
- package/build/commands/browser.d.ts +39 -33
- package/build/commands/browser.d.ts.map +1 -1
- package/build/commands/browser.js +42 -43
- package/build/commands/constant.d.ts +1 -1
- package/build/commands/constant.d.ts.map +1 -1
- package/build/commands/constant.js +6 -12
- package/build/commands/element/$$.d.ts +1 -1
- package/build/commands/element/$$.d.ts.map +1 -1
- package/build/commands/element/$$.js +2 -7
- package/build/commands/element/$.d.ts +1 -1
- package/build/commands/element/$.d.ts.map +1 -1
- package/build/commands/element/$.js +2 -7
- package/build/commands/element/addValue.d.ts +10 -14
- package/build/commands/element/addValue.d.ts.map +1 -1
- package/build/commands/element/addValue.js +23 -27
- package/build/commands/element/clearValue.d.ts +1 -1
- package/build/commands/element/clearValue.js +2 -5
- package/build/commands/element/click.d.ts +1 -1
- package/build/commands/element/click.d.ts.map +1 -1
- package/build/commands/element/click.js +19 -34
- package/build/commands/element/custom$$.js +9 -11
- package/build/commands/element/custom$.js +8 -10
- package/build/commands/element/doubleClick.d.ts.map +1 -1
- package/build/commands/element/doubleClick.js +11 -17
- package/build/commands/element/dragAndDrop.d.ts.map +1 -1
- package/build/commands/element/dragAndDrop.js +13 -19
- package/build/commands/element/getAttribute.js +1 -4
- package/build/commands/element/getCSSProperty.d.ts +1 -1
- package/build/commands/element/getCSSProperty.d.ts.map +1 -1
- package/build/commands/element/getCSSProperty.js +7 -13
- package/build/commands/element/getComputedLabel.js +1 -4
- package/build/commands/element/getComputedRole.js +1 -4
- package/build/commands/element/getHTML.js +7 -13
- package/build/commands/element/getLocation.js +3 -5
- package/build/commands/element/getProperty.d.ts +8 -8
- package/build/commands/element/getProperty.d.ts.map +1 -1
- package/build/commands/element/getProperty.js +5 -11
- package/build/commands/element/getSize.js +3 -5
- package/build/commands/element/getTagName.js +1 -4
- package/build/commands/element/getText.js +1 -4
- package/build/commands/element/getValue.js +1 -4
- package/build/commands/element/isClickable.js +7 -13
- package/build/commands/element/isDisplayed.js +9 -16
- package/build/commands/element/isDisplayedInViewport.js +7 -13
- package/build/commands/element/isEnabled.js +1 -4
- package/build/commands/element/isEqual.d.ts.map +1 -1
- package/build/commands/element/isEqual.js +9 -9
- package/build/commands/element/isExisting.js +1 -4
- package/build/commands/element/isFocused.js +7 -13
- package/build/commands/element/isSelected.js +1 -4
- package/build/commands/element/moveTo.d.ts.map +1 -1
- package/build/commands/element/moveTo.js +8 -13
- package/build/commands/element/nextElement.js +2 -5
- package/build/commands/element/parentElement.js +2 -5
- package/build/commands/element/previousElement.js +2 -5
- package/build/commands/element/react$$.d.ts.map +1 -1
- package/build/commands/element/react$$.js +13 -16
- package/build/commands/element/react$.d.ts.map +1 -1
- package/build/commands/element/react$.js +12 -14
- package/build/commands/element/saveScreenshot.js +6 -12
- package/build/commands/element/scrollIntoView.d.ts +3 -2
- package/build/commands/element/scrollIntoView.d.ts.map +1 -1
- package/build/commands/element/scrollIntoView.js +32 -12
- package/build/commands/element/selectByAttribute.js +3 -6
- package/build/commands/element/selectByIndex.js +3 -6
- package/build/commands/element/selectByVisibleText.js +3 -6
- package/build/commands/element/setValue.d.ts +13 -14
- package/build/commands/element/setValue.d.ts.map +1 -1
- package/build/commands/element/setValue.js +14 -17
- package/build/commands/element/shadow$$.d.ts +1 -1
- package/build/commands/element/shadow$$.d.ts.map +1 -1
- package/build/commands/element/shadow$$.js +3 -6
- package/build/commands/element/shadow$.js +3 -6
- package/build/commands/element/touchAction.js +3 -6
- package/build/commands/element/waitForClickable.js +1 -4
- package/build/commands/element/waitForDisplayed.js +1 -4
- package/build/commands/element/waitForEnabled.js +1 -4
- package/build/commands/element/waitForExist.js +1 -4
- package/build/commands/element/waitUntil.d.ts +1 -1
- package/build/commands/element/waitUntil.d.ts.map +1 -1
- package/build/commands/element/waitUntil.js +2 -7
- package/build/commands/element.d.ts +48 -48
- package/build/commands/element.d.ts.map +1 -1
- package/build/commands/element.js +57 -62
- package/build/constants.d.ts +66 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +91 -12
- package/build/index.d.ts +64 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +47 -85
- package/build/middlewares.d.ts +1 -1
- package/build/middlewares.js +11 -19
- package/build/multiremote.js +12 -20
- package/build/protocol-stub.d.ts.map +1 -1
- package/build/protocol-stub.js +4 -6
- package/build/scripts/getHTML.js +1 -4
- package/build/scripts/getProperty.d.ts +8 -8
- package/build/scripts/getProperty.d.ts.map +1 -1
- package/build/scripts/getProperty.js +1 -4
- package/build/scripts/isElementClickable.js +1 -4
- package/build/scripts/isElementDisplayed.js +1 -4
- package/build/scripts/isElementInViewport.js +1 -4
- package/build/scripts/isFocused.js +1 -4
- package/build/scripts/newWindow.js +1 -4
- package/build/scripts/resq.js +3 -9
- package/build/scripts/shadowFnFactory.js +2 -6
- package/build/types.d.ts +1 -5
- package/build/types.d.ts.map +1 -1
- package/build/types.js +1 -2
- package/build/utils/SevereServiceError.js +1 -4
- package/build/utils/Timer.d.ts.map +1 -1
- package/build/utils/Timer.js +1 -25
- package/build/utils/actions/base.d.ts +32 -0
- package/build/utils/actions/base.d.ts.map +1 -0
- package/build/utils/actions/base.js +78 -0
- package/build/utils/actions/index.d.ts +6 -0
- package/build/utils/actions/index.d.ts.map +1 -0
- package/build/utils/actions/index.js +5 -0
- package/build/utils/actions/key.d.ts +15 -0
- package/build/utils/actions/key.d.ts.map +1 -0
- package/build/utils/actions/key.js +22 -0
- package/build/utils/actions/pointer.d.ts +62 -0
- package/build/utils/actions/pointer.d.ts.map +1 -0
- package/build/utils/actions/pointer.js +76 -0
- package/build/utils/actions/wheel.d.ts +36 -0
- package/build/utils/actions/wheel.d.ts.map +1 -0
- package/build/utils/actions/wheel.js +20 -0
- package/build/utils/detectBackend.d.ts +1 -1
- package/build/utils/detectBackend.d.ts.map +1 -1
- package/build/utils/detectBackend.js +3 -7
- package/build/utils/findStrategy.js +11 -19
- package/build/utils/getElementObject.d.ts.map +1 -1
- package/build/utils/getElementObject.js +42 -31
- package/build/utils/implicitWait.js +3 -9
- package/build/utils/index.d.ts +2 -6
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +92 -142
- package/build/utils/interception/devtools.d.ts +1 -1
- package/build/utils/interception/devtools.d.ts.map +1 -1
- package/build/utils/interception/devtools.js +17 -23
- package/build/utils/interception/index.d.ts +2 -2
- package/build/utils/interception/index.d.ts.map +1 -1
- package/build/utils/interception/index.js +5 -11
- package/build/utils/interception/types.d.ts +1 -1
- package/build/utils/interception/types.d.ts.map +1 -1
- package/build/utils/interception/types.js +1 -2
- package/build/utils/interception/webdriver.d.ts +1 -1
- package/build/utils/interception/webdriver.d.ts.map +1 -1
- package/build/utils/interception/webdriver.js +5 -11
- package/build/utils/refetchElement.js +3 -9
- package/package.json +22 -11
- package/async.d.ts +0 -24
- package/sync.d.ts +0 -24
package/build/utils/index.js
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const constants_1 = require("../constants");
|
|
21
|
-
const findStrategy_1 = require("./findStrategy");
|
|
22
|
-
const browserCommands = require('../commands/browser').default;
|
|
23
|
-
const elementCommands = require('../commands/element').default;
|
|
24
|
-
const log = (0, logger_1.default)('webdriverio');
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import http from 'node:http';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { URL } from 'node:url';
|
|
5
|
+
import cssValue from 'css-value';
|
|
6
|
+
import rgb2hex from 'rgb2hex';
|
|
7
|
+
import GraphemeSplitter from 'grapheme-splitter';
|
|
8
|
+
import logger from '@wdio/logger';
|
|
9
|
+
import isObject from 'lodash.isobject';
|
|
10
|
+
import isPlainObject from 'lodash.isplainobject';
|
|
11
|
+
// @ts-expect-error
|
|
12
|
+
import { locatorStrategy } from 'query-selector-shadow-dom/plugins/webdriverio/index.js';
|
|
13
|
+
import { SUPPORTED_BROWSER } from 'devtools';
|
|
14
|
+
import { UNICODE_CHARACTERS } from '@wdio/utils';
|
|
15
|
+
import browserCommands from '../commands/browser.js';
|
|
16
|
+
import elementCommands from '../commands/element.js';
|
|
17
|
+
import { ELEMENT_KEY, DRIVER_DEFAULT_ENDPOINT, DEEP_SELECTOR, Key } from '../constants.js';
|
|
18
|
+
import { findStrategy } from './findStrategy.js';
|
|
19
|
+
const log = logger('webdriverio');
|
|
25
20
|
const INVALID_SELECTOR_ERROR = 'selector needs to be typeof `string` or `function`';
|
|
26
21
|
const scopes = {
|
|
27
22
|
browser: browserCommands,
|
|
@@ -35,16 +30,12 @@ const applyScopePrototype = (prototype, scope) => {
|
|
|
35
30
|
/**
|
|
36
31
|
* enhances objects with element commands
|
|
37
32
|
*/
|
|
38
|
-
const getPrototype = (scope) => {
|
|
33
|
+
export const getPrototype = (scope) => {
|
|
39
34
|
const prototype = {
|
|
40
35
|
/**
|
|
41
36
|
* used to store the puppeteer instance in the browser scope
|
|
42
37
|
*/
|
|
43
|
-
puppeteer: { value: null, writable: true }
|
|
44
|
-
/**
|
|
45
|
-
* for handling sync execution in @wdio/sync
|
|
46
|
-
*/
|
|
47
|
-
_NOT_FIBER: { value: false, writable: true, configurable: true }
|
|
38
|
+
puppeteer: { value: null, writable: true }
|
|
48
39
|
};
|
|
49
40
|
/**
|
|
50
41
|
* register action commands
|
|
@@ -53,13 +44,12 @@ const getPrototype = (scope) => {
|
|
|
53
44
|
prototype.strategies = { value: new Map() };
|
|
54
45
|
return prototype;
|
|
55
46
|
};
|
|
56
|
-
exports.getPrototype = getPrototype;
|
|
57
47
|
/**
|
|
58
48
|
* get element id from WebDriver response
|
|
59
49
|
* @param {?Object|undefined} res body object from response or null
|
|
60
50
|
* @return {?string} element id or null if element couldn't be found
|
|
61
51
|
*/
|
|
62
|
-
const getElementFromResponse = (res) => {
|
|
52
|
+
export const getElementFromResponse = (res) => {
|
|
63
53
|
/**
|
|
64
54
|
* a function selector can return null
|
|
65
55
|
*/
|
|
@@ -75,52 +65,18 @@ const getElementFromResponse = (res) => {
|
|
|
75
65
|
/**
|
|
76
66
|
* W3C WebDriver response
|
|
77
67
|
*/
|
|
78
|
-
if (res[
|
|
79
|
-
return res[
|
|
68
|
+
if (res[ELEMENT_KEY]) {
|
|
69
|
+
return res[ELEMENT_KEY];
|
|
80
70
|
}
|
|
81
71
|
return null;
|
|
82
72
|
};
|
|
83
|
-
exports.getElementFromResponse = getElementFromResponse;
|
|
84
73
|
/**
|
|
85
74
|
* traverse up the scope chain until browser element was reached
|
|
86
75
|
*/
|
|
87
|
-
function getBrowserObject(elem) {
|
|
76
|
+
export function getBrowserObject(elem) {
|
|
88
77
|
const elemObject = elem;
|
|
89
78
|
return elemObject.parent ? getBrowserObject(elemObject.parent) : elem;
|
|
90
79
|
}
|
|
91
|
-
exports.getBrowserObject = getBrowserObject;
|
|
92
|
-
/**
|
|
93
|
-
* transform whatever value is into an array of char strings
|
|
94
|
-
*/
|
|
95
|
-
function transformToCharString(value, translateToUnicode = true) {
|
|
96
|
-
const ret = [];
|
|
97
|
-
if (!Array.isArray(value)) {
|
|
98
|
-
value = [value];
|
|
99
|
-
}
|
|
100
|
-
for (const val of value) {
|
|
101
|
-
if (typeof val === 'string') {
|
|
102
|
-
translateToUnicode
|
|
103
|
-
? ret.push(...checkUnicode(val))
|
|
104
|
-
: ret.push(...`${val}`.split(''));
|
|
105
|
-
}
|
|
106
|
-
else if (typeof val === 'number') {
|
|
107
|
-
const entry = `${val}`.split('');
|
|
108
|
-
ret.push(...entry);
|
|
109
|
-
}
|
|
110
|
-
else if (val && typeof val === 'object') {
|
|
111
|
-
try {
|
|
112
|
-
ret.push(...JSON.stringify(val).split(''));
|
|
113
|
-
}
|
|
114
|
-
catch (err) { /* ignore */ }
|
|
115
|
-
}
|
|
116
|
-
else if (typeof val === 'boolean') {
|
|
117
|
-
const entry = val ? 'true'.split('') : 'false'.split('');
|
|
118
|
-
ret.push(...entry);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return ret;
|
|
122
|
-
}
|
|
123
|
-
exports.transformToCharString = transformToCharString;
|
|
124
80
|
function sanitizeCSS(value) {
|
|
125
81
|
/* istanbul ignore next */
|
|
126
82
|
if (!value) {
|
|
@@ -134,14 +90,13 @@ function sanitizeCSS(value) {
|
|
|
134
90
|
* @param {String} cssProperty name of css property to parse
|
|
135
91
|
* @return {Object} parsed css property
|
|
136
92
|
*/
|
|
137
|
-
function parseCSS(cssPropertyValue, cssProperty) {
|
|
138
|
-
var _a;
|
|
93
|
+
export function parseCSS(cssPropertyValue, cssProperty) {
|
|
139
94
|
const parsedValue = {
|
|
140
95
|
property: cssProperty,
|
|
141
96
|
value: cssPropertyValue.toLowerCase().trim(),
|
|
142
97
|
parsed: {}
|
|
143
98
|
};
|
|
144
|
-
if (
|
|
99
|
+
if (parsedValue.value?.indexOf('rgb') === 0) {
|
|
145
100
|
/**
|
|
146
101
|
* remove whitespaces in rgb values
|
|
147
102
|
*/
|
|
@@ -150,13 +105,13 @@ function parseCSS(cssPropertyValue, cssProperty) {
|
|
|
150
105
|
* parse color values
|
|
151
106
|
*/
|
|
152
107
|
let color = parsedValue.value;
|
|
153
|
-
parsedValue.parsed = (
|
|
108
|
+
parsedValue.parsed = rgb2hex(parsedValue.value);
|
|
154
109
|
parsedValue.parsed.type = 'color';
|
|
155
110
|
const colorType = /[rgba]+/g.exec(color) || [];
|
|
156
111
|
parsedValue.parsed[colorType[0]] = color;
|
|
157
112
|
}
|
|
158
113
|
else if (parsedValue.property === 'font-family') {
|
|
159
|
-
let font = (
|
|
114
|
+
let font = cssValue(cssPropertyValue);
|
|
160
115
|
let string = parsedValue.value;
|
|
161
116
|
let value = cssPropertyValue.split(/,/).map(sanitizeCSS);
|
|
162
117
|
parsedValue.value = sanitizeCSS(font[0].value || font[0].string);
|
|
@@ -167,7 +122,7 @@ function parseCSS(cssPropertyValue, cssProperty) {
|
|
|
167
122
|
* parse other css properties
|
|
168
123
|
*/
|
|
169
124
|
try {
|
|
170
|
-
const value = (
|
|
125
|
+
const value = cssValue(cssPropertyValue);
|
|
171
126
|
if (value.length === 1) {
|
|
172
127
|
parsedValue.parsed = value[0];
|
|
173
128
|
}
|
|
@@ -182,18 +137,27 @@ function parseCSS(cssPropertyValue, cssProperty) {
|
|
|
182
137
|
}
|
|
183
138
|
return parsedValue;
|
|
184
139
|
}
|
|
185
|
-
exports.parseCSS = parseCSS;
|
|
186
140
|
/**
|
|
187
141
|
* check for unicode character or split string into literals
|
|
188
142
|
* @param {String} value text
|
|
189
143
|
* @return {Array} set of characters or unicode symbols
|
|
190
144
|
*/
|
|
191
|
-
function checkUnicode(value, isDevTools = false) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
145
|
+
export function checkUnicode(value, isDevTools = false, platformName) {
|
|
146
|
+
if (value === Key.Ctrl) {
|
|
147
|
+
return [platformName && platformName.match(/mac(\s)*os/i) ? Key.Command : Key.Control];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* when sending emoji characters like 😄 or a value that is not a special character defined
|
|
151
|
+
* by the WebDriver protocol
|
|
152
|
+
*/
|
|
153
|
+
if (!Object.prototype.hasOwnProperty.call(UNICODE_CHARACTERS, value)) {
|
|
154
|
+
return new GraphemeSplitter().splitGraphemes(value);
|
|
155
|
+
}
|
|
156
|
+
if (isDevTools) {
|
|
157
|
+
return [value];
|
|
158
|
+
}
|
|
159
|
+
return [UNICODE_CHARACTERS[value]];
|
|
195
160
|
}
|
|
196
|
-
exports.checkUnicode = checkUnicode;
|
|
197
161
|
function fetchElementByJSFunction(selector, scope) {
|
|
198
162
|
if (!scope.elementId) {
|
|
199
163
|
return scope.execute(selector);
|
|
@@ -209,34 +173,35 @@ function fetchElementByJSFunction(selector, scope) {
|
|
|
209
173
|
/**
|
|
210
174
|
* logic to find an element
|
|
211
175
|
*/
|
|
212
|
-
async function findElement(selector) {
|
|
176
|
+
export async function findElement(selector) {
|
|
177
|
+
const browserObject = getBrowserObject(this);
|
|
213
178
|
/**
|
|
214
179
|
* check if shadow DOM integration is used
|
|
215
180
|
*/
|
|
216
|
-
if (!this.isDevTools && typeof selector === 'string' && selector.startsWith(
|
|
217
|
-
const notFoundError = new Error(`shadow selector "${selector.slice(
|
|
218
|
-
let elem = await
|
|
219
|
-
selector.slice(
|
|
181
|
+
if (!this.isDevTools && typeof selector === 'string' && selector.startsWith(DEEP_SELECTOR)) {
|
|
182
|
+
const notFoundError = new Error(`shadow selector "${selector.slice(DEEP_SELECTOR.length)}" did not return an HTMLElement`);
|
|
183
|
+
let elem = await browserObject.execute(locatorStrategy, ...[
|
|
184
|
+
selector.slice(DEEP_SELECTOR.length),
|
|
220
185
|
this.elementId ? this : undefined
|
|
221
186
|
].filter(Boolean));
|
|
222
187
|
elem = Array.isArray(elem) ? elem[0] : elem;
|
|
223
|
-
return
|
|
188
|
+
return getElementFromResponse(elem) ? elem : notFoundError;
|
|
224
189
|
}
|
|
225
190
|
/**
|
|
226
191
|
* fetch element using custom strategy function
|
|
227
192
|
*/
|
|
228
|
-
if ((
|
|
193
|
+
if (isPlainObject(selector) && typeof selector.strategy === 'function') {
|
|
229
194
|
const { strategy, strategyName, strategyArguments } = selector;
|
|
230
195
|
const notFoundError = new Error(`Custom Strategy "${strategyName}" did not return an HTMLElement`);
|
|
231
|
-
let elem = await
|
|
196
|
+
let elem = await browserObject.execute(strategy, ...strategyArguments);
|
|
232
197
|
elem = Array.isArray(elem) ? elem[0] : elem;
|
|
233
|
-
return
|
|
198
|
+
return getElementFromResponse(elem) ? elem : notFoundError;
|
|
234
199
|
}
|
|
235
200
|
/**
|
|
236
201
|
* fetch element using regular protocol command
|
|
237
202
|
*/
|
|
238
|
-
if (typeof selector === 'string' || (
|
|
239
|
-
const { using, value } =
|
|
203
|
+
if (typeof selector === 'string' || isPlainObject(selector)) {
|
|
204
|
+
const { using, value } = findStrategy(selector, this.isW3C, this.isMobile);
|
|
240
205
|
return this.elementId
|
|
241
206
|
// casting to any necessary given weak type support of protocol commands
|
|
242
207
|
? this.findElementFromElement(this.elementId, using, value)
|
|
@@ -249,40 +214,40 @@ async function findElement(selector) {
|
|
|
249
214
|
const notFoundError = new Error(`Function selector "${selector.toString()}" did not return an HTMLElement`);
|
|
250
215
|
let elem = await fetchElementByJSFunction(selector, this);
|
|
251
216
|
elem = Array.isArray(elem) ? elem[0] : elem;
|
|
252
|
-
return
|
|
217
|
+
return getElementFromResponse(elem) ? elem : notFoundError;
|
|
253
218
|
}
|
|
254
219
|
throw new Error(INVALID_SELECTOR_ERROR);
|
|
255
220
|
}
|
|
256
|
-
exports.findElement = findElement;
|
|
257
221
|
/**
|
|
258
222
|
* logic to find a elements
|
|
259
223
|
*/
|
|
260
|
-
async function findElements(selector) {
|
|
224
|
+
export async function findElements(selector) {
|
|
225
|
+
const browserObject = getBrowserObject(this);
|
|
261
226
|
/**
|
|
262
227
|
* check if shadow DOM integration is used
|
|
263
228
|
*/
|
|
264
|
-
if (!this.isDevTools && typeof selector === 'string' && selector.startsWith(
|
|
265
|
-
const elems = await
|
|
266
|
-
selector.slice(
|
|
229
|
+
if (!this.isDevTools && typeof selector === 'string' && selector.startsWith(DEEP_SELECTOR)) {
|
|
230
|
+
const elems = await browserObject.execute(locatorStrategy, ...[
|
|
231
|
+
selector.slice(DEEP_SELECTOR.length),
|
|
267
232
|
this.elementId ? this : undefined
|
|
268
233
|
].filter(Boolean));
|
|
269
234
|
const elemArray = Array.isArray(elems) ? elems : [elems];
|
|
270
|
-
return elemArray.filter((elem) => elem &&
|
|
235
|
+
return elemArray.filter((elem) => elem && getElementFromResponse(elem));
|
|
271
236
|
}
|
|
272
237
|
/**
|
|
273
238
|
* fetch elements using custom strategy function
|
|
274
239
|
*/
|
|
275
|
-
if ((
|
|
240
|
+
if (isPlainObject(selector) && typeof selector.strategy === 'function') {
|
|
276
241
|
const { strategy, strategyArguments } = selector;
|
|
277
|
-
const elems = await
|
|
242
|
+
const elems = await browserObject.execute(strategy, ...strategyArguments);
|
|
278
243
|
const elemArray = Array.isArray(elems) ? elems : [elems];
|
|
279
|
-
return elemArray.filter((elem) => elem &&
|
|
244
|
+
return elemArray.filter((elem) => elem && getElementFromResponse(elem));
|
|
280
245
|
}
|
|
281
246
|
/**
|
|
282
247
|
* fetch element using regular protocol command
|
|
283
248
|
*/
|
|
284
|
-
if (typeof selector === 'string' || (
|
|
285
|
-
const { using, value } =
|
|
249
|
+
if (typeof selector === 'string' || isPlainObject(selector)) {
|
|
250
|
+
const { using, value } = findStrategy(selector, this.isW3C, this.isMobile);
|
|
286
251
|
return this.elementId
|
|
287
252
|
// casting to any necessary given weak type support of protocol commands
|
|
288
253
|
? this.findElementsFromElement(this.elementId, using, value)
|
|
@@ -294,23 +259,22 @@ async function findElements(selector) {
|
|
|
294
259
|
if (typeof selector === 'function') {
|
|
295
260
|
const elems = await fetchElementByJSFunction(selector, this);
|
|
296
261
|
const elemArray = Array.isArray(elems) ? elems : [elems];
|
|
297
|
-
return elemArray.filter((elem) => elem &&
|
|
262
|
+
return elemArray.filter((elem) => elem && getElementFromResponse(elem));
|
|
298
263
|
}
|
|
299
264
|
throw new Error(INVALID_SELECTOR_ERROR);
|
|
300
265
|
}
|
|
301
|
-
exports.findElements = findElements;
|
|
302
266
|
/**
|
|
303
267
|
* Strip element object and return w3c and jsonwp compatible keys
|
|
304
268
|
*/
|
|
305
|
-
function verifyArgsAndStripIfElement(args) {
|
|
269
|
+
export function verifyArgsAndStripIfElement(args) {
|
|
306
270
|
function verify(arg) {
|
|
307
|
-
if ((
|
|
271
|
+
if (isObject(arg) && arg.constructor.name === 'Element') {
|
|
308
272
|
const elem = arg;
|
|
309
273
|
if (!elem.elementId) {
|
|
310
274
|
throw new Error(`The element with selector "${elem.selector}" you are trying to pass into the execute method wasn't found`);
|
|
311
275
|
}
|
|
312
276
|
return {
|
|
313
|
-
[
|
|
277
|
+
[ELEMENT_KEY]: elem.elementId,
|
|
314
278
|
ELEMENT: elem.elementId
|
|
315
279
|
};
|
|
316
280
|
}
|
|
@@ -318,11 +282,10 @@ function verifyArgsAndStripIfElement(args) {
|
|
|
318
282
|
}
|
|
319
283
|
return !Array.isArray(args) ? verify(args) : args.map(verify);
|
|
320
284
|
}
|
|
321
|
-
exports.verifyArgsAndStripIfElement = verifyArgsAndStripIfElement;
|
|
322
285
|
/**
|
|
323
286
|
* getElementRect
|
|
324
287
|
*/
|
|
325
|
-
async function getElementRect(scope) {
|
|
288
|
+
export async function getElementRect(scope) {
|
|
326
289
|
const rect = await scope.getElementRect(scope.elementId);
|
|
327
290
|
let defaults = { x: 0, y: 0, width: 0, height: 0 };
|
|
328
291
|
/**
|
|
@@ -359,31 +322,28 @@ async function getElementRect(scope) {
|
|
|
359
322
|
}
|
|
360
323
|
return rect;
|
|
361
324
|
}
|
|
362
|
-
|
|
363
|
-
function getAbsoluteFilepath(filepath) {
|
|
325
|
+
export function getAbsoluteFilepath(filepath) {
|
|
364
326
|
return filepath.startsWith('/') || filepath.startsWith('\\') || filepath.match(/^[a-zA-Z]:\\/)
|
|
365
327
|
? filepath
|
|
366
|
-
:
|
|
328
|
+
: path.join(process.cwd(), filepath);
|
|
367
329
|
}
|
|
368
|
-
exports.getAbsoluteFilepath = getAbsoluteFilepath;
|
|
369
330
|
/**
|
|
370
331
|
* check if directory exists
|
|
371
332
|
*/
|
|
372
|
-
function assertDirectoryExists(filepath) {
|
|
373
|
-
if (!
|
|
374
|
-
throw new Error(`directory (${
|
|
333
|
+
export function assertDirectoryExists(filepath) {
|
|
334
|
+
if (!fs.existsSync(path.dirname(filepath))) {
|
|
335
|
+
throw new Error(`directory (${path.dirname(filepath)}) doesn't exist`);
|
|
375
336
|
}
|
|
376
337
|
}
|
|
377
|
-
exports.assertDirectoryExists = assertDirectoryExists;
|
|
378
338
|
/**
|
|
379
339
|
* check if urls are valid and fix them if necessary
|
|
380
340
|
* @param {string} url url to navigate to
|
|
381
341
|
* @param {Boolean} [retryCheck=false] true if an url was already check and still failed with fix applied
|
|
382
342
|
* @return {string} fixed url
|
|
383
343
|
*/
|
|
384
|
-
function validateUrl(url, origError) {
|
|
344
|
+
export function validateUrl(url, origError) {
|
|
385
345
|
try {
|
|
386
|
-
const urlObject = new
|
|
346
|
+
const urlObject = new URL(url);
|
|
387
347
|
return urlObject.href;
|
|
388
348
|
}
|
|
389
349
|
catch (err) {
|
|
@@ -396,19 +356,17 @@ function validateUrl(url, origError) {
|
|
|
396
356
|
return validateUrl(`http://${url}`, new Error(`Invalid URL: ${url}`));
|
|
397
357
|
}
|
|
398
358
|
}
|
|
399
|
-
exports.validateUrl = validateUrl;
|
|
400
359
|
/**
|
|
401
360
|
* get window's scrollX and scrollY
|
|
402
361
|
* @param {object} scope
|
|
403
362
|
*/
|
|
404
|
-
function getScrollPosition(scope) {
|
|
363
|
+
export function getScrollPosition(scope) {
|
|
405
364
|
return getBrowserObject(scope)
|
|
406
365
|
.execute(/* istanbul ignore next */ function () {
|
|
407
366
|
return { scrollX: this.pageXOffset, scrollY: this.pageYOffset };
|
|
408
367
|
});
|
|
409
368
|
}
|
|
410
|
-
|
|
411
|
-
async function hasElementId(element) {
|
|
369
|
+
export async function hasElementId(element) {
|
|
412
370
|
/*
|
|
413
371
|
* This is only necessary as isDisplayed is on the exclusion list for the middleware
|
|
414
372
|
*/
|
|
@@ -426,8 +384,7 @@ async function hasElementId(element) {
|
|
|
426
384
|
}
|
|
427
385
|
return true;
|
|
428
386
|
}
|
|
429
|
-
|
|
430
|
-
function addLocatorStrategyHandler(scope) {
|
|
387
|
+
export function addLocatorStrategyHandler(scope) {
|
|
431
388
|
return (name, func) => {
|
|
432
389
|
if (scope.strategies.get(name)) {
|
|
433
390
|
throw new Error(`Strategy ${name} already exists`);
|
|
@@ -435,7 +392,6 @@ function addLocatorStrategyHandler(scope) {
|
|
|
435
392
|
scope.strategies.set(name, func);
|
|
436
393
|
};
|
|
437
394
|
}
|
|
438
|
-
exports.addLocatorStrategyHandler = addLocatorStrategyHandler;
|
|
439
395
|
/**
|
|
440
396
|
* Enhance elements array with data required to refetch it
|
|
441
397
|
* @param {object[]} elements elements
|
|
@@ -445,22 +401,19 @@ exports.addLocatorStrategyHandler = addLocatorStrategyHandler;
|
|
|
445
401
|
* @param {Array} props additional properties required to fetch elements again
|
|
446
402
|
* @returns {object[]} elements
|
|
447
403
|
*/
|
|
448
|
-
const enhanceElementsArray = (elements, parent, selector, foundWith = '$$', props = []) => {
|
|
404
|
+
export const enhanceElementsArray = (elements, parent, selector, foundWith = '$$', props = []) => {
|
|
449
405
|
elements.parent = parent;
|
|
450
406
|
elements.selector = selector;
|
|
451
407
|
elements.foundWith = foundWith;
|
|
452
408
|
elements.props = props;
|
|
453
409
|
return elements;
|
|
454
410
|
};
|
|
455
|
-
exports.enhanceElementsArray = enhanceElementsArray;
|
|
456
411
|
/**
|
|
457
412
|
* is protocol stub
|
|
458
413
|
* @param {string} automationProtocol
|
|
459
414
|
*/
|
|
460
|
-
const isStub = (automationProtocol) => automationProtocol === './protocol-stub';
|
|
461
|
-
|
|
462
|
-
const getAutomationProtocol = async (config) => {
|
|
463
|
-
var _a, _b;
|
|
415
|
+
export const isStub = (automationProtocol) => automationProtocol === './protocol-stub.js';
|
|
416
|
+
export const getAutomationProtocol = async (config) => {
|
|
464
417
|
/**
|
|
465
418
|
* if automation protocol is set by user prefer this
|
|
466
419
|
*/
|
|
@@ -476,10 +429,10 @@ const getAutomationProtocol = async (config) => {
|
|
|
476
429
|
/**
|
|
477
430
|
* only run DevTools protocol if capabilities match supported platforms
|
|
478
431
|
*/
|
|
479
|
-
const caps = (
|
|
432
|
+
const caps = (config.capabilities?.alwaysMatch ||
|
|
480
433
|
config.capabilities) || {};
|
|
481
434
|
const desiredCaps = caps;
|
|
482
|
-
if (!
|
|
435
|
+
if (!SUPPORTED_BROWSER.includes(caps.browserName?.toLowerCase())) {
|
|
483
436
|
return 'webdriver';
|
|
484
437
|
}
|
|
485
438
|
/**
|
|
@@ -500,7 +453,7 @@ const getAutomationProtocol = async (config) => {
|
|
|
500
453
|
* make a head request to check if a driver is available
|
|
501
454
|
*/
|
|
502
455
|
const resp = await new Promise((resolve) => {
|
|
503
|
-
const req =
|
|
456
|
+
const req = http.request(DRIVER_DEFAULT_ENDPOINT, resolve);
|
|
504
457
|
req.on('error', (error) => resolve({ error }));
|
|
505
458
|
req.end();
|
|
506
459
|
});
|
|
@@ -516,25 +469,23 @@ const getAutomationProtocol = async (config) => {
|
|
|
516
469
|
}
|
|
517
470
|
return 'devtools';
|
|
518
471
|
};
|
|
519
|
-
exports.getAutomationProtocol = getAutomationProtocol;
|
|
520
472
|
/**
|
|
521
473
|
* updateCapabilities allows modifying capabilities before session
|
|
522
474
|
* is started
|
|
523
475
|
*
|
|
524
476
|
* NOTE: this method is executed twice when running the WDIO testrunner
|
|
525
477
|
*/
|
|
526
|
-
const updateCapabilities =
|
|
478
|
+
export const updateCapabilities = (params, automationProtocol) => {
|
|
527
479
|
if (automationProtocol && !params.automationProtocol) {
|
|
528
480
|
params.automationProtocol = automationProtocol;
|
|
529
481
|
}
|
|
530
482
|
};
|
|
531
|
-
exports.updateCapabilities = updateCapabilities;
|
|
532
483
|
/**
|
|
533
484
|
* compare if an object (`base`) contains the same values as another object (`match`)
|
|
534
485
|
* @param {object} base object to compare to
|
|
535
486
|
* @param {object} match object that needs to match thebase
|
|
536
487
|
*/
|
|
537
|
-
const containsHeaderObject = (base, match) => {
|
|
488
|
+
export const containsHeaderObject = (base, match) => {
|
|
538
489
|
for (const [key, value] of Object.entries(match)) {
|
|
539
490
|
if (typeof base[key] === 'undefined' || base[key] !== value) {
|
|
540
491
|
return false;
|
|
@@ -542,4 +493,3 @@ const containsHeaderObject = (base, match) => {
|
|
|
542
493
|
}
|
|
543
494
|
return true;
|
|
544
495
|
};
|
|
545
|
-
exports.containsHeaderObject = containsHeaderObject;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { CDPSession } from 'puppeteer-core/lib/cjs/puppeteer/common/Connection';
|
|
3
3
|
import type Protocol from 'devtools-protocol';
|
|
4
|
-
import Interception from '.';
|
|
4
|
+
import Interception from './index.js';
|
|
5
5
|
import type { Matches, MockOverwrite, MockResponseParams } from './types';
|
|
6
6
|
declare type ClientResponse = {
|
|
7
7
|
body: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools.d.ts","sourceRoot":"","sources":["../../../src/utils/interception/devtools.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"devtools.d.ts","sourceRoot":"","sources":["../../../src/utils/interception/devtools.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAA;AACpF,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAE7C,OAAO,YAAY,MAAM,YAAY,CAAA;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAMzE,aAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,UAAU,WAAW;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,aAAK,KAAK,GAAG;IACT,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,OAAO,GAAG;QAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACtD,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,WAAW,EAAE,CAAA;CACjC,CAAA;AAID,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,YAAY;IAC1D,MAAM,CAAC,yBAAyB,CAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,GAAG,cAAc,CAAC;IA8IjI;;OAEG;IACH,IAAI,KAAK,cAER;IAED;;OAEG;IACH,KAAK;IAIL;;;OAGG;IACH,OAAO;IAKP;;;;OAIG;IACH,OAAO,CAAE,SAAS,EAAE,aAAa,EAAE,MAAM,GAAE,kBAAuB;IAIlE;;;;OAIG;IACH,WAAW,CAAE,SAAS,EAAE,aAAa,EAAE,MAAM,GAAE,kBAAuB;IAItE;;;OAGG;IACH,KAAK,CAAE,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,GAAE,OAAc;IAOxE;;;OAGG;IACH,SAAS,CAAE,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW;CAGvD"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const _1 = __importDefault(require("."));
|
|
10
|
-
const __1 = require("..");
|
|
11
|
-
const constants_1 = require("../../constants");
|
|
12
|
-
const log = (0, logger_1.default)('webdriverio');
|
|
13
|
-
class DevtoolsInterception extends _1.default {
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fse from 'fs-extra';
|
|
3
|
+
import logger from '@wdio/logger';
|
|
4
|
+
import Interception from './index.js';
|
|
5
|
+
import { containsHeaderObject } from '../index.js';
|
|
6
|
+
import { ERROR_REASON } from '../../constants.js';
|
|
7
|
+
const log = logger('webdriverio');
|
|
8
|
+
export default class DevtoolsInterception extends Interception {
|
|
14
9
|
static handleRequestInterception(client, mocks) {
|
|
15
10
|
return async (event) => {
|
|
16
11
|
// responseHeaders and responseStatusCode are only present in Response stage
|
|
@@ -36,7 +31,7 @@ class DevtoolsInterception extends _1.default {
|
|
|
36
31
|
/**
|
|
37
32
|
* match mock url
|
|
38
33
|
*/
|
|
39
|
-
if (!
|
|
34
|
+
if (!Interception.isMatchingRequest(mock.url, request.url)) {
|
|
40
35
|
continue;
|
|
41
36
|
}
|
|
42
37
|
/**
|
|
@@ -94,9 +89,9 @@ class DevtoolsInterception extends _1.default {
|
|
|
94
89
|
/**
|
|
95
90
|
* check if local file and load it
|
|
96
91
|
*/
|
|
97
|
-
const responseFilePath =
|
|
98
|
-
if (newBody.length > 0 && await
|
|
99
|
-
newBody = await
|
|
92
|
+
const responseFilePath = path.isAbsolute(newBody) ? newBody : path.join(process.cwd(), newBody);
|
|
93
|
+
if (newBody.length > 0 && await fse.pathExists(responseFilePath) && await canAccess(responseFilePath)) {
|
|
94
|
+
newBody = await fse.readFile(responseFilePath);
|
|
100
95
|
}
|
|
101
96
|
else if (newBody.startsWith('http')) {
|
|
102
97
|
responseCode = 301;
|
|
@@ -169,8 +164,8 @@ class DevtoolsInterception extends _1.default {
|
|
|
169
164
|
* @param {string} errorCode error code of the response
|
|
170
165
|
*/
|
|
171
166
|
abort(errorReason, sticky = true) {
|
|
172
|
-
if (typeof errorReason !== 'string' || !
|
|
173
|
-
throw new Error(`Invalid value for errorReason, allowed are: ${
|
|
167
|
+
if (typeof errorReason !== 'string' || !ERROR_REASON.includes(errorReason)) {
|
|
168
|
+
throw new Error(`Invalid value for errorReason, allowed are: ${ERROR_REASON.join(', ')}`);
|
|
174
169
|
}
|
|
175
170
|
this.respondOverwrites.push({ errorReason, sticky });
|
|
176
171
|
}
|
|
@@ -182,7 +177,6 @@ class DevtoolsInterception extends _1.default {
|
|
|
182
177
|
this.abort(errorReason, false);
|
|
183
178
|
}
|
|
184
179
|
}
|
|
185
|
-
exports.default = DevtoolsInterception;
|
|
186
180
|
const filterMethod = (method, expected) => {
|
|
187
181
|
if (typeof expected === 'undefined') {
|
|
188
182
|
return false;
|
|
@@ -199,7 +193,7 @@ const filterHeaders = (responseHeaders, expected) => {
|
|
|
199
193
|
if (typeof expected === 'function') {
|
|
200
194
|
return expected(responseHeaders) !== true;
|
|
201
195
|
}
|
|
202
|
-
return !
|
|
196
|
+
return !containsHeaderObject(responseHeaders, expected);
|
|
203
197
|
};
|
|
204
198
|
const filterRequest = (postData, expected) => {
|
|
205
199
|
if (typeof expected === 'undefined') {
|
|
@@ -226,7 +220,7 @@ const filterStatusCode = (statusCode, expected) => {
|
|
|
226
220
|
*/
|
|
227
221
|
const canAccess = async (filepath) => {
|
|
228
222
|
try {
|
|
229
|
-
await
|
|
223
|
+
await fse.access(filepath);
|
|
230
224
|
return true;
|
|
231
225
|
}
|
|
232
226
|
catch {
|
|
@@ -243,5 +237,5 @@ const tryParseJson = (body) => {
|
|
|
243
237
|
};
|
|
244
238
|
const logFetchError = (err) => {
|
|
245
239
|
/* istanbul ignore next */
|
|
246
|
-
log.debug(err
|
|
240
|
+
log.debug(err?.message);
|
|
247
241
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WaitForOptions } from '../../types';
|
|
2
|
-
import { MockFilterOptions, MockOverwrite, MockResponseParams, Matches } from './types';
|
|
1
|
+
import type { WaitForOptions } from '../../types';
|
|
2
|
+
import type { MockFilterOptions, MockOverwrite, MockResponseParams, Matches } from './types';
|
|
3
3
|
import type Protocol from 'devtools-protocol';
|
|
4
4
|
export default abstract class Interception {
|
|
5
5
|
url: string | RegExp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/interception/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/interception/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAE5F,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAE7C,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,YAAY;IAkB3B,GAAG,EAAE,MAAM,GAAG,MAAM;IACpB,aAAa,EAAE,iBAAiB;IAChC,OAAO,EAAE,WAAW,CAAC,OAAO;IAnBvC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;IAC9C,QAAQ,CAAC,KAAK,IAAK,IAAI;IACvB,QAAQ,CAAC,OAAO,IAAK,IAAI;IACzB,QAAQ,CAAC,OAAO,CAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAC7E,QAAQ,CAAC,WAAW,CAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI;IACjF,QAAQ,CAAC,KAAK,CAAE,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IACjF,QAAQ,CAAC,SAAS,CAAE,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,GAAG,IAAI;IAEpE,iBAAiB,EAAE;QACf,SAAS,CAAC,EAAE,aAAa,CAAA;QACzB,MAAM,CAAC,EAAE,kBAAkB,CAAA;QAC3B,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,WAAW,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAA;KAC7C,EAAE,CAAK;IACR,OAAO,EAAE,OAAO,EAAE,CAAK;gBAGZ,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,aAAa,EAAE,iBAAsB,EACrC,OAAO,EAAE,WAAW,CAAC,OAAO;IAIvC,eAAe,CAAE,EACb,OAA6C,EAC7C,QAA+C,EAC/C,UAAU,GACb,GAAE,cAAmB;IA4BtB,MAAM,CAAC,iBAAiB,CAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM;CAU5E"}
|