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
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.findStrategy = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const lodash_isplainobject_1 = __importDefault(require("lodash.isplainobject"));
|
|
9
|
-
const aria_query_1 = require("aria-query");
|
|
10
|
-
const constants_1 = require("../constants");
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import isPlainObject from 'lodash.isplainobject';
|
|
3
|
+
import { roleElements } from 'aria-query';
|
|
4
|
+
import { DEEP_SELECTOR } from '../constants.js';
|
|
11
5
|
const DEFAULT_STRATEGY = 'css selector';
|
|
12
6
|
const DIRECT_SELECTOR_REGEXP = /^(id|css selector|xpath|link text|partial link text|name|tag name|class name|-android uiautomator|-android datamatcher|-android viewmatcher|-android viewtag|-ios uiautomation|-ios predicate string|-ios class chain|accessibility id):(.+)/;
|
|
13
7
|
const XPATH_SELECTORS_START = [
|
|
@@ -34,7 +28,7 @@ const defineStrategy = function (selector) {
|
|
|
34
28
|
// in case of "selector" argument is a plain object then .match() will cause
|
|
35
29
|
// an error like "selector.match is not a function"
|
|
36
30
|
// Use '-android datamatcher' or '-android viewmatcher' strategy if selector is a plain object (Android only)
|
|
37
|
-
if ((
|
|
31
|
+
if (isPlainObject(selector)) {
|
|
38
32
|
if (JSON.stringify(selector).indexOf('test.espresso.matcher.ViewMatchers') < 0)
|
|
39
33
|
return '-android datamatcher';
|
|
40
34
|
return '-android viewmatcher';
|
|
@@ -68,7 +62,7 @@ const defineStrategy = function (selector) {
|
|
|
68
62
|
return 'id';
|
|
69
63
|
}
|
|
70
64
|
// use shadow dom selector
|
|
71
|
-
if (stringSelector.startsWith(
|
|
65
|
+
if (stringSelector.startsWith(DEEP_SELECTOR)) {
|
|
72
66
|
return 'shadow';
|
|
73
67
|
}
|
|
74
68
|
// Recursive element search using the UiAutomator library (Android only)
|
|
@@ -113,7 +107,7 @@ const defineStrategy = function (selector) {
|
|
|
113
107
|
return 'role';
|
|
114
108
|
}
|
|
115
109
|
};
|
|
116
|
-
const findStrategy = function (selector, isW3C, isMobile) {
|
|
110
|
+
export const findStrategy = function (selector, isW3C, isMobile) {
|
|
117
111
|
const stringSelector = selector;
|
|
118
112
|
let using = DEFAULT_STRATEGY;
|
|
119
113
|
let value = selector;
|
|
@@ -121,7 +115,7 @@ const findStrategy = function (selector, isW3C, isMobile) {
|
|
|
121
115
|
// user has specified locator strategy directly
|
|
122
116
|
case 'directly': {
|
|
123
117
|
const match = stringSelector.match(DIRECT_SELECTOR_REGEXP);
|
|
124
|
-
if (!match
|
|
118
|
+
if (!match) {
|
|
125
119
|
throw new Error('InvalidSelectorStrategy'); // ToDo: move error to wdio-error package
|
|
126
120
|
}
|
|
127
121
|
using = match[1];
|
|
@@ -149,7 +143,7 @@ const findStrategy = function (selector, isW3C, isMobile) {
|
|
|
149
143
|
}
|
|
150
144
|
case 'shadow':
|
|
151
145
|
using = 'shadow';
|
|
152
|
-
value = stringSelector.slice(
|
|
146
|
+
value = stringSelector.slice(DEEP_SELECTOR.length);
|
|
153
147
|
break;
|
|
154
148
|
case '-android uiautomator': {
|
|
155
149
|
using = '-android uiautomator';
|
|
@@ -219,7 +213,7 @@ const findStrategy = function (selector, isW3C, isMobile) {
|
|
|
219
213
|
}
|
|
220
214
|
case '-image': {
|
|
221
215
|
using = '-image';
|
|
222
|
-
value =
|
|
216
|
+
value = fs.readFileSync(stringSelector, { encoding: 'base64' });
|
|
223
217
|
break;
|
|
224
218
|
}
|
|
225
219
|
case 'role': {
|
|
@@ -234,11 +228,9 @@ const findStrategy = function (selector, isW3C, isMobile) {
|
|
|
234
228
|
}
|
|
235
229
|
return { using, value };
|
|
236
230
|
};
|
|
237
|
-
exports.findStrategy = findStrategy;
|
|
238
231
|
const createRoleBaseXpathSelector = (role) => {
|
|
239
|
-
var _a;
|
|
240
232
|
const locatorArr = [];
|
|
241
|
-
|
|
233
|
+
roleElements.get(role)?.forEach((value) => {
|
|
242
234
|
let locator;
|
|
243
235
|
let tagname, tagAttribute, tagAttributevalue;
|
|
244
236
|
tagname = value.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getElementObject.d.ts","sourceRoot":"","sources":["../../src/utils/getElementObject.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"getElementObject.d.ts","sourceRoot":"","sources":["../../src/utils/getElementObject.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAMvD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,SACb,YAAY,OAAO,GAAG,mBAAmB,aACpC,QAAQ,QACb,gBAAgB,GAAG,KAAK,+BAE/B,mBAuDF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,SACd,YAAY,OAAO,GAAG,mBAAmB,YACrC,QAAQ,gBACJ,gBAAgB,EAAE,+BAEjC,YAwDF,CAAA"}
|
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const utils_1 = require("@wdio/utils");
|
|
8
|
-
const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
|
|
9
|
-
const _1 = require(".");
|
|
10
|
-
const middlewares_1 = require("../middlewares");
|
|
11
|
-
const constants_1 = require("../constants");
|
|
1
|
+
import { webdriverMonad, wrapCommand } from '@wdio/utils';
|
|
2
|
+
import clone from 'lodash.clonedeep';
|
|
3
|
+
import { getBrowserObject, getPrototype as getWDIOPrototype, getElementFromResponse } from './index.js';
|
|
4
|
+
import { elementErrorHandler } from '../middlewares.js';
|
|
5
|
+
import { ELEMENT_KEY } from '../constants.js';
|
|
6
|
+
import * as browserCommands from '../commands/browser.js';
|
|
12
7
|
/**
|
|
13
8
|
* transforms a findElement response into a WDIO element
|
|
14
9
|
* @param {String} selector selector that was used to query the element
|
|
15
10
|
* @param {Object} res findElement response
|
|
16
11
|
* @return {Object} WDIO element object
|
|
17
12
|
*/
|
|
18
|
-
const getElement = function findElement(selector, res, isReactElement = false) {
|
|
19
|
-
const browser =
|
|
13
|
+
export const getElement = function findElement(selector, res, isReactElement = false) {
|
|
14
|
+
const browser = getBrowserObject(this);
|
|
15
|
+
const browserCommandKeys = Object.keys(browserCommands.default);
|
|
20
16
|
const propertiesObject = {
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
/**
|
|
18
|
+
* filter out browser commands from object
|
|
19
|
+
*/
|
|
20
|
+
...(Object.entries(clone(browser.__propertiesObject__)).reduce((commands, [name, descriptor]) => {
|
|
21
|
+
if (!browserCommandKeys.includes(name)) {
|
|
22
|
+
commands[name] = descriptor;
|
|
23
|
+
}
|
|
24
|
+
return commands;
|
|
25
|
+
}, {})),
|
|
26
|
+
...getWDIOPrototype('element'),
|
|
23
27
|
scope: { value: 'element' }
|
|
24
28
|
};
|
|
25
|
-
const element =
|
|
26
|
-
const elementId =
|
|
29
|
+
const element = webdriverMonad(this.options, (client) => {
|
|
30
|
+
const elementId = getElementFromResponse(res);
|
|
27
31
|
if (elementId) {
|
|
28
32
|
/**
|
|
29
33
|
* set elementId for easy access
|
|
@@ -33,7 +37,7 @@ const getElement = function findElement(selector, res, isReactElement = false) {
|
|
|
33
37
|
* set element id with proper key so element can be passed into execute commands
|
|
34
38
|
*/
|
|
35
39
|
if (this.isW3C) {
|
|
36
|
-
client[
|
|
40
|
+
client[ELEMENT_KEY] = elementId;
|
|
37
41
|
}
|
|
38
42
|
else {
|
|
39
43
|
client.ELEMENT = elementId;
|
|
@@ -48,31 +52,39 @@ const getElement = function findElement(selector, res, isReactElement = false) {
|
|
|
48
52
|
client.isReactElement = isReactElement;
|
|
49
53
|
return client;
|
|
50
54
|
}, propertiesObject);
|
|
51
|
-
const elementInstance = element(this.sessionId,
|
|
55
|
+
const elementInstance = element(this.sessionId, elementErrorHandler(wrapCommand));
|
|
52
56
|
const origAddCommand = elementInstance.addCommand.bind(elementInstance);
|
|
53
57
|
elementInstance.addCommand = (name, fn) => {
|
|
54
58
|
browser.__propertiesObject__[name] = { value: fn };
|
|
55
|
-
origAddCommand(name,
|
|
59
|
+
origAddCommand(name, fn);
|
|
56
60
|
};
|
|
57
61
|
return elementInstance;
|
|
58
62
|
};
|
|
59
|
-
exports.getElement = getElement;
|
|
60
63
|
/**
|
|
61
64
|
* transforms a findElements response into an array of WDIO elements
|
|
62
65
|
* @param {String} selector selector that was used to query the element
|
|
63
66
|
* @param {Object} res findElements response
|
|
64
67
|
* @return {Array} array of WDIO elements
|
|
65
68
|
*/
|
|
66
|
-
const getElements = function getElements(selector, elemResponse, isReactElement = false) {
|
|
67
|
-
const browser =
|
|
69
|
+
export const getElements = function getElements(selector, elemResponse, isReactElement = false) {
|
|
70
|
+
const browser = getBrowserObject(this);
|
|
71
|
+
const browserCommandKeys = Object.keys(browserCommands.default);
|
|
68
72
|
const propertiesObject = {
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
/**
|
|
74
|
+
* filter out browser commands from object
|
|
75
|
+
*/
|
|
76
|
+
...(Object.entries(clone(browser.__propertiesObject__)).reduce((commands, [name, descriptor]) => {
|
|
77
|
+
if (!browserCommandKeys.includes(name)) {
|
|
78
|
+
commands[name] = descriptor;
|
|
79
|
+
}
|
|
80
|
+
return commands;
|
|
81
|
+
}, {})),
|
|
82
|
+
...getWDIOPrototype('element')
|
|
71
83
|
};
|
|
72
84
|
const elements = elemResponse.map((res, i) => {
|
|
73
85
|
propertiesObject.scope = { value: 'element' };
|
|
74
|
-
const element =
|
|
75
|
-
const elementId =
|
|
86
|
+
const element = webdriverMonad(this.options, (client) => {
|
|
87
|
+
const elementId = getElementFromResponse(res);
|
|
76
88
|
if (elementId) {
|
|
77
89
|
/**
|
|
78
90
|
* set elementId for easy access
|
|
@@ -81,7 +93,7 @@ const getElements = function getElements(selector, elemResponse, isReactElement
|
|
|
81
93
|
/**
|
|
82
94
|
* set element id with proper key so element can be passed into execute commands
|
|
83
95
|
*/
|
|
84
|
-
const elementKey = this.isW3C ?
|
|
96
|
+
const elementKey = this.isW3C ? ELEMENT_KEY : 'ELEMENT';
|
|
85
97
|
client[elementKey] = elementId;
|
|
86
98
|
}
|
|
87
99
|
else {
|
|
@@ -94,14 +106,13 @@ const getElements = function getElements(selector, elemResponse, isReactElement
|
|
|
94
106
|
client.isReactElement = isReactElement;
|
|
95
107
|
return client;
|
|
96
108
|
}, propertiesObject);
|
|
97
|
-
const elementInstance = element(this.sessionId,
|
|
109
|
+
const elementInstance = element(this.sessionId, elementErrorHandler(wrapCommand));
|
|
98
110
|
const origAddCommand = elementInstance.addCommand.bind(elementInstance);
|
|
99
111
|
elementInstance.addCommand = (name, fn) => {
|
|
100
112
|
browser.__propertiesObject__[name] = { value: fn };
|
|
101
|
-
origAddCommand(name,
|
|
113
|
+
origAddCommand(name, fn);
|
|
102
114
|
};
|
|
103
115
|
return elementInstance;
|
|
104
116
|
});
|
|
105
117
|
return elements;
|
|
106
118
|
};
|
|
107
|
-
exports.getElements = getElements;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
7
|
-
const log = (0, logger_1.default)('webdriverio');
|
|
1
|
+
import logger from '@wdio/logger';
|
|
2
|
+
const log = logger('webdriverio');
|
|
8
3
|
/**
|
|
9
4
|
* wait on element if:
|
|
10
5
|
* - elementId couldn't be fetched in the first place
|
|
11
6
|
* - command is not explicit wait command for existance or displayedness
|
|
12
7
|
*/
|
|
13
|
-
async function implicitWait(currentElement, commandName) {
|
|
8
|
+
export default async function implicitWait(currentElement, commandName) {
|
|
14
9
|
if (!currentElement.elementId && !commandName.match(/(waitUntil|waitFor|isExisting|is?\w+Displayed|is?\w+Clickable)/)) {
|
|
15
10
|
log.debug(`command ${commandName} was called on an element ("${currentElement.selector}") ` +
|
|
16
11
|
'that wasn\'t found, waiting for it...');
|
|
@@ -36,4 +31,3 @@ async function implicitWait(currentElement, commandName) {
|
|
|
36
31
|
}
|
|
37
32
|
return currentElement;
|
|
38
33
|
}
|
|
39
|
-
exports.default = implicitWait;
|
package/build/utils/index.d.ts
CHANGED
|
@@ -15,10 +15,6 @@ export declare const getElementFromResponse: (res: ElementReference) => any;
|
|
|
15
15
|
* traverse up the scope chain until browser element was reached
|
|
16
16
|
*/
|
|
17
17
|
export declare function getBrowserObject(elem: WebdriverIO.Element | WebdriverIO.Browser): WebdriverIO.Browser;
|
|
18
|
-
/**
|
|
19
|
-
* transform whatever value is into an array of char strings
|
|
20
|
-
*/
|
|
21
|
-
export declare function transformToCharString(value: any, translateToUnicode?: boolean): string[];
|
|
22
18
|
/**
|
|
23
19
|
* parse css values to a better format
|
|
24
20
|
* @param {Object} cssPropertyValue result of WebDriver call
|
|
@@ -31,7 +27,7 @@ export declare function parseCSS(cssPropertyValue: string, cssProperty?: string)
|
|
|
31
27
|
* @param {String} value text
|
|
32
28
|
* @return {Array} set of characters or unicode symbols
|
|
33
29
|
*/
|
|
34
|
-
export declare function checkUnicode(value: string, isDevTools?: boolean): string[];
|
|
30
|
+
export declare function checkUnicode(value: string, isDevTools?: boolean, platformName?: string): string[];
|
|
35
31
|
/**
|
|
36
32
|
* logic to find an element
|
|
37
33
|
*/
|
|
@@ -92,7 +88,7 @@ export declare const getAutomationProtocol: (config: Options.WebdriverIO | Optio
|
|
|
92
88
|
*
|
|
93
89
|
* NOTE: this method is executed twice when running the WDIO testrunner
|
|
94
90
|
*/
|
|
95
|
-
export declare const updateCapabilities: (params: Options.WebdriverIO | Options.Testrunner, automationProtocol?: Options.SupportedProtocols) =>
|
|
91
|
+
export declare const updateCapabilities: (params: Options.WebdriverIO | Options.Testrunner, automationProtocol?: Options.SupportedProtocols) => void;
|
|
96
92
|
/**
|
|
97
93
|
* compare if an object (`base`) contains the same values as another object (`match`)
|
|
98
94
|
* @param {object} base object to compare to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,aAAa,CAAA;AAMxD,OAAO,KAAK,EAAE,YAAY,EAAmB,QAAQ,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAmBjH;;GAEG;AACH,eAAO,MAAM,YAAY,UAAW,SAAS,GAAG,SAAS,uCAexD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAS,gBAAgB,QAuB3D,CAAA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAGtG;AAWD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,kBAkDvE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,MAAM,EACb,UAAU,UAAQ,EAClB,YAAY,CAAC,EAAE,MAAM,YAmBxB;AAkBD;;GAEG;AACH,wBAAsB,WAAW,CAC7B,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,QAAQ,EAAE,QAAQ,qCAqDrB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,QAAQ,EAAE,QAAQ,+BAkDrB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,GAAG,OAkBpD;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,iDAuC9D;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,UAInD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,QAIrD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAcnE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAE,KAAK,EAAE,WAAW,CAAC,OAAO;;;GAK5D;AAED,wBAAsB,YAAY,CAAE,OAAO,EAAE,WAAW,CAAC,OAAO,oBAkB/D;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB,UACnF,MAAM,mBAAmB,MAAM,SAAS,WAAW,KAAK,wBAAwB,UAOjG;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,aACnB,YAAY,UACd,YAAY,OAAO,GAAG,mBAAmB,YACvC,QAAQ,8BAEX,GAAG,EAAE,iBAOf,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,wBAAyB,MAAM,YAAgD,CAAA;AAElG,eAAO,MAAM,qBAAqB,WAAkB,mBAAmB,GAAG,QAAQ,UAAU,wCAmE3F,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,WACnB,mBAAmB,GAAG,QAAQ,UAAU,uBAC3B,QAAQ,kBAAkB,SAKlD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,SACvB,OAAO,MAAM,EAAE,MAAM,CAAC,SACrB,OAAO,MAAM,EAAE,MAAM,CAAC,YAShC,CAAA"}
|