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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/commands/element/$.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/commands/element/$.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,OAAO,CAAC,MAAM,iBAAiB,CAAA;AAC/B,eAAe,CAAC,CAAA"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
1
|
/**
|
|
7
2
|
* The `$` command is a short way to call the [`findElement`](/docs/api/webdriver#findelement) command in order
|
|
8
3
|
* to fetch a single element on the page similar to the `$` command from the browser scope. The difference when calling
|
|
@@ -72,5 +67,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
72
67
|
* @type utility
|
|
73
68
|
*
|
|
74
69
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
import $ from '../browser/$.js';
|
|
71
|
+
export default $;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
export declare type CommandOptions = {
|
|
2
|
-
translateToUnicode?: boolean;
|
|
3
|
-
};
|
|
4
|
-
export declare type Value = string | number;
|
|
5
1
|
/**
|
|
6
2
|
*
|
|
7
|
-
* Add a value to an
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
3
|
+
* Add a value to an input or textarea element found by given selector.
|
|
4
|
+
*
|
|
5
|
+
* :::info
|
|
6
|
+
*
|
|
7
|
+
* If you like to use special characters, e.g. to copy and paste a value from one input to another, use the
|
|
8
|
+
* [`keys`](/docs/api/browser/keys) command.
|
|
9
|
+
*
|
|
10
|
+
* :::
|
|
13
11
|
*
|
|
14
12
|
* <example>
|
|
15
13
|
:addValue.js
|
|
@@ -24,10 +22,8 @@ export declare type Value = string | number;
|
|
|
24
22
|
* </example>
|
|
25
23
|
*
|
|
26
24
|
* @alias element.addValue
|
|
27
|
-
* @param {string | number
|
|
28
|
-
* @param {CommandOptions=} options command options (optional)
|
|
29
|
-
* @param {boolean} options.translateToUnicode enable translation string to unicode value automatically
|
|
25
|
+
* @param {string | number} value value to be added
|
|
30
26
|
*
|
|
31
27
|
*/
|
|
32
|
-
export default function addValue(this: WebdriverIO.Element, value:
|
|
28
|
+
export default function addValue(this: WebdriverIO.Element, value: string | number): Promise<void>;
|
|
33
29
|
//# sourceMappingURL=addValue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addValue.d.ts","sourceRoot":"","sources":["../../../src/commands/element/addValue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addValue.d.ts","sourceRoot":"","sources":["../../../src/commands/element/addValue.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC5B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,EAAE,MAAM,GAAG,MAAM,iBAoBzB"}
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("../../utils");
|
|
7
|
-
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
8
|
-
const log = (0, logger_1.default)('addValue');
|
|
9
|
-
const isNumberOrString = (input) => typeof input === 'string' || typeof input === 'number';
|
|
10
|
-
const isValidType = (value) => (isNumberOrString(value) ||
|
|
11
|
-
Array.isArray(value) && value.every((item) => isNumberOrString(item)));
|
|
1
|
+
const VALID_TYPES = ['string', 'number'];
|
|
12
2
|
/**
|
|
13
3
|
*
|
|
14
|
-
* Add a value to an
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
4
|
+
* Add a value to an input or textarea element found by given selector.
|
|
5
|
+
*
|
|
6
|
+
* :::info
|
|
7
|
+
*
|
|
8
|
+
* If you like to use special characters, e.g. to copy and paste a value from one input to another, use the
|
|
9
|
+
* [`keys`](/docs/api/browser/keys) command.
|
|
10
|
+
*
|
|
11
|
+
* :::
|
|
20
12
|
*
|
|
21
13
|
* <example>
|
|
22
14
|
:addValue.js
|
|
@@ -31,18 +23,22 @@ const isValidType = (value) => (isNumberOrString(value) ||
|
|
|
31
23
|
* </example>
|
|
32
24
|
*
|
|
33
25
|
* @alias element.addValue
|
|
34
|
-
* @param {string | number
|
|
35
|
-
* @param {CommandOptions=} options command options (optional)
|
|
36
|
-
* @param {boolean} options.translateToUnicode enable translation string to unicode value automatically
|
|
26
|
+
* @param {string | number} value value to be added
|
|
37
27
|
*
|
|
38
28
|
*/
|
|
39
|
-
function addValue(value
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
export default function addValue(value) {
|
|
30
|
+
/**
|
|
31
|
+
* The JSONWireProtocol allowed array values and use of special characters when adding a value to an input.
|
|
32
|
+
* With the W3C protocol this was not possible anymore. This is a type check to ensure users are aware of
|
|
33
|
+
* this transition.
|
|
34
|
+
*/
|
|
35
|
+
if (!VALID_TYPES.includes(typeof value)) {
|
|
36
|
+
throw new Error('The setValue/addValue command only take string or number values. ' +
|
|
37
|
+
'If you like to use special characters, use the "keys" command.');
|
|
42
38
|
}
|
|
43
|
-
if (
|
|
44
|
-
return this.elementSendKeys(this.elementId,
|
|
39
|
+
if (this.isW3C) {
|
|
40
|
+
return this.elementSendKeys(this.elementId, value.toString());
|
|
45
41
|
}
|
|
46
|
-
|
|
42
|
+
// @ts-expect-error command is not typed as JWP command
|
|
43
|
+
return this.elementSendKeys(this.elementId, [value.toString()]);
|
|
47
44
|
}
|
|
48
|
-
exports.default = addValue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* Clear
|
|
3
|
+
* Clear the value of an input or textarea element. Make sure you can interact with the
|
|
4
4
|
* element before using this command. You can't clear an input element that is disabled or in
|
|
5
5
|
* readonly mode.
|
|
6
6
|
*
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
*
|
|
4
|
-
* Clear
|
|
3
|
+
* Clear the value of an input or textarea element. Make sure you can interact with the
|
|
5
4
|
* element before using this command. You can't clear an input element that is disabled or in
|
|
6
5
|
* readonly mode.
|
|
7
6
|
*
|
|
@@ -25,8 +24,6 @@
|
|
|
25
24
|
* @type action
|
|
26
25
|
*
|
|
27
26
|
*/
|
|
28
|
-
|
|
29
|
-
function clearValue() {
|
|
27
|
+
export default function clearValue() {
|
|
30
28
|
return this.elementClear(this.elementId);
|
|
31
29
|
}
|
|
32
|
-
exports.default = clearValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../src/commands/element/click.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../src/commands/element/click.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AACH,wBAA8B,KAAK,CAC/B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,CAAC,EAAE,YAAY,iBAyDzB"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
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/click');
|
|
1
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
8
2
|
/**
|
|
9
3
|
*
|
|
10
4
|
* Click on an element.
|
|
@@ -84,58 +78,49 @@ const log = (0, logger_1.default)('webdriverio/click');
|
|
|
84
78
|
* @param {number=} options.y Number (optional)
|
|
85
79
|
* @param {number=} options.skipRelease Boolean (optional)
|
|
86
80
|
*/
|
|
87
|
-
async function click(options) {
|
|
81
|
+
export default async function click(options) {
|
|
88
82
|
if (typeof options === 'undefined') {
|
|
89
83
|
return this.elementClick(this.elementId);
|
|
90
84
|
}
|
|
91
85
|
if (typeof options !== 'object' || Array.isArray(options)) {
|
|
92
86
|
throw new TypeError('Options must be an object');
|
|
93
87
|
}
|
|
94
|
-
let
|
|
88
|
+
let button = (options.button || 0);
|
|
89
|
+
let { x: xoffset = 0, y: yoffset = 0, skipRelease = false } = options || {};
|
|
95
90
|
if (typeof xoffset !== 'number'
|
|
96
91
|
|| typeof yoffset !== 'number'
|
|
97
92
|
|| !Number.isInteger(xoffset)
|
|
98
93
|
|| !Number.isInteger(yoffset)) {
|
|
99
94
|
throw new TypeError('Coordinates must be integers');
|
|
100
95
|
}
|
|
101
|
-
if (button === 'left') {
|
|
96
|
+
if (options.button === 'left') {
|
|
102
97
|
button = 0;
|
|
103
98
|
}
|
|
104
|
-
if (button === 'middle') {
|
|
99
|
+
if (options.button === 'middle') {
|
|
105
100
|
button = 1;
|
|
106
101
|
}
|
|
107
|
-
if (button === 'right') {
|
|
102
|
+
if (options.button === 'right') {
|
|
108
103
|
button = 2;
|
|
109
104
|
}
|
|
110
105
|
if (![0, 1, 2].includes(button)) {
|
|
111
106
|
throw new Error('Button type not supported.');
|
|
112
107
|
}
|
|
113
108
|
if (this.isW3C) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
type: 'pointerDown',
|
|
127
|
-
button
|
|
128
|
-
}, {
|
|
129
|
-
type: 'pointerUp',
|
|
130
|
-
button
|
|
131
|
-
}]
|
|
132
|
-
}]);
|
|
133
|
-
if (!skipRelease)
|
|
134
|
-
await this.releaseActions().then(() => null, (err) => log.warn(`Failed to call "releaseAction" command due to: ${err.message}, ignoring!`));
|
|
109
|
+
const browser = getBrowserObject(this);
|
|
110
|
+
await browser.action('pointer', {
|
|
111
|
+
parameters: { pointerType: 'mouse' }
|
|
112
|
+
})
|
|
113
|
+
.move({
|
|
114
|
+
origin: this,
|
|
115
|
+
x: xoffset,
|
|
116
|
+
y: yoffset
|
|
117
|
+
})
|
|
118
|
+
.down({ button })
|
|
119
|
+
.up({ button })
|
|
120
|
+
.perform(skipRelease);
|
|
135
121
|
return;
|
|
136
122
|
}
|
|
137
123
|
const { width, height } = await this.getElementSize(this.elementId);
|
|
138
124
|
await this.moveToElement(this.elementId, xoffset + (width / 2), yoffset + (height / 2));
|
|
139
125
|
return this.positionClick(button);
|
|
140
126
|
}
|
|
141
|
-
exports.default = click;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const utils_1 = require("../../utils");
|
|
5
|
-
const constants_1 = require("../../constants");
|
|
1
|
+
import { getElements } from '../../utils/getElementObject.js';
|
|
2
|
+
import { getBrowserObject, enhanceElementsArray } from '../../utils/index.js';
|
|
3
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
6
4
|
/**
|
|
7
5
|
*
|
|
8
6
|
* The `customs$$` allows you to use a custom strategy declared by using `browser.addLocatorStrategy`
|
|
@@ -28,7 +26,7 @@ const constants_1 = require("../../constants");
|
|
|
28
26
|
* @return {ElementArray}
|
|
29
27
|
*/
|
|
30
28
|
async function custom$$(strategyName, ...strategyArguments) {
|
|
31
|
-
const browserObject =
|
|
29
|
+
const browserObject = getBrowserObject(this);
|
|
32
30
|
const strategy = browserObject.strategies.get(strategyName);
|
|
33
31
|
if (!strategy) {
|
|
34
32
|
/* istanbul ignore next */
|
|
@@ -42,7 +40,7 @@ async function custom$$(strategyName, ...strategyArguments) {
|
|
|
42
40
|
throw Error(`Can't call custom$ on element with selector "${this.selector}" because element wasn't found`);
|
|
43
41
|
}
|
|
44
42
|
const strategyRef = { strategy, strategyName, strategyArguments: [...strategyArguments, this] };
|
|
45
|
-
let res = await
|
|
43
|
+
let res = await browserObject.execute(strategy, ...strategyArguments, this);
|
|
46
44
|
/**
|
|
47
45
|
* if the user's script return just one element
|
|
48
46
|
* then we convert it to an array as this method
|
|
@@ -51,8 +49,8 @@ async function custom$$(strategyName, ...strategyArguments) {
|
|
|
51
49
|
if (!Array.isArray(res)) {
|
|
52
50
|
res = [res];
|
|
53
51
|
}
|
|
54
|
-
res = res.filter((el) => !!el && typeof el[
|
|
55
|
-
const elements = res.length ? await
|
|
56
|
-
return
|
|
52
|
+
res = res.filter((el) => !!el && typeof el[ELEMENT_KEY] === 'string');
|
|
53
|
+
const elements = res.length ? await getElements.call(this, strategyRef, res) : [];
|
|
54
|
+
return enhanceElementsArray(elements, this, strategyName, 'custom$$', strategyArguments);
|
|
57
55
|
}
|
|
58
|
-
|
|
56
|
+
export default custom$$;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const utils_1 = require("../../utils");
|
|
5
|
-
const constants_1 = require("../../constants");
|
|
1
|
+
import { getElement } from '../../utils/getElementObject.js';
|
|
2
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
3
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
6
4
|
/**
|
|
7
5
|
*
|
|
8
6
|
* The `custom$` allows you to use a custom strategy declared by using `browser.addLocatorStrategy`
|
|
@@ -28,7 +26,7 @@ const constants_1 = require("../../constants");
|
|
|
28
26
|
* @return {Element}
|
|
29
27
|
*/
|
|
30
28
|
async function custom$(strategyName, ...strategyArguments) {
|
|
31
|
-
const browserObject =
|
|
29
|
+
const browserObject = getBrowserObject(this);
|
|
32
30
|
const strategy = browserObject.strategies.get(strategyName);
|
|
33
31
|
if (!strategy) {
|
|
34
32
|
throw Error('No strategy found for ' + strategyName);
|
|
@@ -41,7 +39,7 @@ async function custom$(strategyName, ...strategyArguments) {
|
|
|
41
39
|
throw Error(`Can't call custom$ on element with selector "${this.selector}" because element wasn't found`);
|
|
42
40
|
}
|
|
43
41
|
const strategyRef = { strategy, strategyName, strategyArguments: [...strategyArguments, this] };
|
|
44
|
-
let res = await
|
|
42
|
+
let res = await browserObject.execute(strategy, ...strategyArguments, this);
|
|
45
43
|
/**
|
|
46
44
|
* if the user's script returns multiple elements
|
|
47
45
|
* then we just return the first one as this method
|
|
@@ -50,9 +48,9 @@ async function custom$(strategyName, ...strategyArguments) {
|
|
|
50
48
|
if (Array.isArray(res)) {
|
|
51
49
|
res = res[0];
|
|
52
50
|
}
|
|
53
|
-
if (res && typeof res[
|
|
54
|
-
return await
|
|
51
|
+
if (res && typeof res[ELEMENT_KEY] === 'string') {
|
|
52
|
+
return await getElement.call(this, strategyRef, res);
|
|
55
53
|
}
|
|
56
54
|
throw Error('Your locator strategy script must return an element');
|
|
57
55
|
}
|
|
58
|
-
|
|
56
|
+
export default custom$;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doubleClick.d.ts","sourceRoot":"","sources":["../../../src/commands/element/doubleClick.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doubleClick.d.ts","sourceRoot":"","sources":["../../../src/commands/element/doubleClick.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAA8B,WAAW,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,iBAqBnE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
3
2
|
/**
|
|
4
3
|
*
|
|
5
4
|
* Double-click on an element.
|
|
@@ -23,7 +22,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
22
|
* @type action
|
|
24
23
|
*
|
|
25
24
|
*/
|
|
26
|
-
async function doubleClick() {
|
|
25
|
+
export default async function doubleClick() {
|
|
27
26
|
/**
|
|
28
27
|
* move to element
|
|
29
28
|
*/
|
|
@@ -34,18 +33,13 @@ async function doubleClick() {
|
|
|
34
33
|
/**
|
|
35
34
|
* W3C way of handle the double click actions
|
|
36
35
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{ type: 'pointerDown', button: 0 },
|
|
47
|
-
{ type: 'pointerUp', button: 0 }
|
|
48
|
-
]
|
|
49
|
-
}]);
|
|
36
|
+
const browser = getBrowserObject(this);
|
|
37
|
+
return browser.action('pointer', { parameters: { pointerType: 'mouse' } })
|
|
38
|
+
.move({ origin: this })
|
|
39
|
+
.down()
|
|
40
|
+
.up()
|
|
41
|
+
.pause(10)
|
|
42
|
+
.down()
|
|
43
|
+
.up()
|
|
44
|
+
.perform();
|
|
50
45
|
}
|
|
51
|
-
exports.default = doubleClick;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dragAndDrop.d.ts","sourceRoot":"","sources":["../../../src/commands/element/dragAndDrop.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dragAndDrop.d.ts","sourceRoot":"","sources":["../../../src/commands/element/dragAndDrop.ts"],"names":[],"mappings":"AAQA,aAAK,kBAAkB,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,aAAK,kBAAkB,GAAG;IACtB,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAA8B,WAAW,CACrC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,MAAM,EAAE,WAAW,CAAC,OAAO,GAAG,kBAAkB,EAChD,EAAE,QAAa,EAAE,GAAE,kBAAuB,iBAqE7C"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const constants_1 = require("../../constants");
|
|
1
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
2
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
4
3
|
const ACTION_BUTTON = 0;
|
|
5
4
|
const sleep = (time = 0) => new Promise((resolve) => setTimeout(resolve, time));
|
|
6
5
|
/**
|
|
@@ -34,7 +33,7 @@ const sleep = (time = 0) => new Promise((resolve) => setTimeout(resolve, time));
|
|
|
34
33
|
* @param {DragAndDropOptions=} options dragAndDrop command options
|
|
35
34
|
* @param {Number=} options.duration how long the drag should take place
|
|
36
35
|
*/
|
|
37
|
-
async function dragAndDrop(target, { duration = 10 } = {}) {
|
|
36
|
+
export default async function dragAndDrop(target, { duration = 10 } = {}) {
|
|
38
37
|
const moveToCoordinates = target;
|
|
39
38
|
const moveToElement = target;
|
|
40
39
|
/**
|
|
@@ -73,8 +72,8 @@ async function dragAndDrop(target, { duration = 10 } = {}) {
|
|
|
73
72
|
await sleep(duration);
|
|
74
73
|
return this.buttonUp(ACTION_BUTTON);
|
|
75
74
|
}
|
|
76
|
-
const sourceRef = { [
|
|
77
|
-
const targetRef = { [
|
|
75
|
+
const sourceRef = { [ELEMENT_KEY]: this[ELEMENT_KEY] };
|
|
76
|
+
const targetRef = { [ELEMENT_KEY]: moveToElement[ELEMENT_KEY] };
|
|
78
77
|
const origin = sourceRef;
|
|
79
78
|
const targetOrigin = isMovingToElement ? targetRef : 'pointer';
|
|
80
79
|
const targetX = isMovingToElement ? 0 : moveToCoordinates.x;
|
|
@@ -82,17 +81,12 @@ async function dragAndDrop(target, { duration = 10 } = {}) {
|
|
|
82
81
|
/**
|
|
83
82
|
* W3C way of handle the drag and drop action
|
|
84
83
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{ type: 'pointerMove', duration, origin: targetOrigin, x: targetX, y: targetY },
|
|
94
|
-
{ type: 'pointerUp', button: ACTION_BUTTON }
|
|
95
|
-
]
|
|
96
|
-
}]).then(() => this.releaseActions());
|
|
84
|
+
const browser = getBrowserObject(this);
|
|
85
|
+
return browser.action('pointer')
|
|
86
|
+
.move({ duration: 0, origin, x: 0, y: 0 })
|
|
87
|
+
.down({ button: ACTION_BUTTON })
|
|
88
|
+
.pause(10)
|
|
89
|
+
.move({ duration, origin: targetOrigin, x: targetX, y: targetY })
|
|
90
|
+
.up({ button: ACTION_BUTTON })
|
|
91
|
+
.perform();
|
|
97
92
|
}
|
|
98
|
-
exports.default = dragAndDrop;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
3
|
* Get an attribute from a DOM-element based on the attribute name.
|
|
@@ -26,7 +24,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
24
|
* @type property
|
|
27
25
|
*
|
|
28
26
|
*/
|
|
29
|
-
function getAttribute(attributeName) {
|
|
27
|
+
export default function getAttribute(attributeName) {
|
|
30
28
|
return this.getElementAttribute(this.elementId, attributeName);
|
|
31
29
|
}
|
|
32
|
-
exports.default = getAttribute;
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
* @return {CSSProperty} The specified css of the element
|
|
68
68
|
*
|
|
69
69
|
*/
|
|
70
|
-
export default function getCSSProperty(this: WebdriverIO.Element, cssProperty: string): Promise<import("
|
|
70
|
+
export default function getCSSProperty(this: WebdriverIO.Element, cssProperty: string): Promise<import("../../types.js").ParsedCSSValue>;
|
|
71
71
|
//# sourceMappingURL=getCSSProperty.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCSSProperty.d.ts","sourceRoot":"","sources":["../../../src/commands/element/getCSSProperty.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,wBAA8B,cAAc,CACxC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"getCSSProperty.d.ts","sourceRoot":"","sources":["../../../src/commands/element/getCSSProperty.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,wBAA8B,cAAc,CACxC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,WAAW,EAAE,MAAM,oDAsCtB"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const css_shorthand_properties_1 = __importDefault(require("css-shorthand-properties"));
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
1
|
+
import cssShorthandProps from 'css-shorthand-properties';
|
|
2
|
+
import { parseCSS } from '../../utils/index.js';
|
|
8
3
|
/**
|
|
9
4
|
*
|
|
10
5
|
* Get a css property from a DOM-element selected by given selector. The return value
|
|
@@ -74,18 +69,18 @@ const utils_1 = require("../../utils");
|
|
|
74
69
|
* @return {CSSProperty} The specified css of the element
|
|
75
70
|
*
|
|
76
71
|
*/
|
|
77
|
-
async function getCSSProperty(cssProperty) {
|
|
72
|
+
export default async function getCSSProperty(cssProperty) {
|
|
78
73
|
/**
|
|
79
74
|
* Getting the css value of a shorthand property results in different results
|
|
80
75
|
* given that the behavior of `getComputedStyle` is not defined in this case.
|
|
81
76
|
* Therefore if we don't deal with a shorthand property run `getElementCSSValue`
|
|
82
77
|
* otherwise expand it and run the command for each longhand property.
|
|
83
78
|
*/
|
|
84
|
-
if (!
|
|
79
|
+
if (!cssShorthandProps.isShorthand(cssProperty)) {
|
|
85
80
|
const cssValue = await this.getElementCSSValue(this.elementId, cssProperty);
|
|
86
|
-
return
|
|
81
|
+
return parseCSS(cssValue, cssProperty);
|
|
87
82
|
}
|
|
88
|
-
const properties =
|
|
83
|
+
const properties = cssShorthandProps.expand(cssProperty);
|
|
89
84
|
let cssValues = await Promise.all(properties.map((prop) => this.getElementCSSValue(this.elementId, prop)));
|
|
90
85
|
/**
|
|
91
86
|
* merge equal symmetrical values
|
|
@@ -103,6 +98,5 @@ async function getCSSProperty(cssProperty) {
|
|
|
103
98
|
}
|
|
104
99
|
cssValues = cssValues.slice(0, cssValues.length / 2);
|
|
105
100
|
}
|
|
106
|
-
return
|
|
101
|
+
return parseCSS(cssValues.join(' '), cssProperty);
|
|
107
102
|
}
|
|
108
|
-
exports.default = getCSSProperty;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
3
|
* Get the computed WAI-ARIA label of an element.
|
|
@@ -18,7 +16,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
16
|
* @type property
|
|
19
17
|
*
|
|
20
18
|
*/
|
|
21
|
-
function getComputedLabel() {
|
|
19
|
+
export default function getComputedLabel() {
|
|
22
20
|
return this.getElementComputedLabel(this.elementId);
|
|
23
21
|
}
|
|
24
|
-
exports.default = getComputedLabel;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
*
|
|
5
3
|
* Get the computed WAI-ARIA label of an element.
|
|
@@ -18,7 +16,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
16
|
* @type property
|
|
19
17
|
*
|
|
20
18
|
*/
|
|
21
|
-
function getComputedRole() {
|
|
19
|
+
export default function getComputedRole() {
|
|
22
20
|
return this.getElementComputedRole(this.elementId);
|
|
23
21
|
}
|
|
24
|
-
exports.default = getComputedRole;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const constants_1 = require("../../constants");
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
8
|
-
const getHTML_1 = __importDefault(require("../../scripts/getHTML"));
|
|
1
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
2
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
3
|
+
import getHTMLScript from '../../scripts/getHTML.js';
|
|
9
4
|
/**
|
|
10
5
|
*
|
|
11
6
|
* Get source code of specified DOM element by selector.
|
|
@@ -36,11 +31,10 @@ const getHTML_1 = __importDefault(require("../../scripts/getHTML"));
|
|
|
36
31
|
* @type property
|
|
37
32
|
*
|
|
38
33
|
*/
|
|
39
|
-
function getHTML(includeSelectorTag = true) {
|
|
40
|
-
const browser =
|
|
41
|
-
return browser.execute(
|
|
42
|
-
[
|
|
34
|
+
export default function getHTML(includeSelectorTag = true) {
|
|
35
|
+
const browser = getBrowserObject(this);
|
|
36
|
+
return browser.execute(getHTMLScript, {
|
|
37
|
+
[ELEMENT_KEY]: this.elementId,
|
|
43
38
|
ELEMENT: this.elementId // jsonwp compatible
|
|
44
39
|
}, includeSelectorTag);
|
|
45
40
|
}
|
|
46
|
-
exports.default = getHTML;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../utils");
|
|
1
|
+
import { getElementRect } from '../../utils/index.js';
|
|
4
2
|
/**
|
|
5
3
|
*
|
|
6
4
|
* Determine an element’s location on the page. The point (0, 0) refers to
|
|
@@ -31,7 +29,7 @@ const utils_1 = require("../../utils");
|
|
|
31
29
|
async function getLocation(prop) {
|
|
32
30
|
let location = {};
|
|
33
31
|
if (this.isW3C) {
|
|
34
|
-
location = await
|
|
32
|
+
location = await getElementRect(this);
|
|
35
33
|
delete location.width;
|
|
36
34
|
delete location.height;
|
|
37
35
|
}
|
|
@@ -43,4 +41,4 @@ async function getLocation(prop) {
|
|
|
43
41
|
}
|
|
44
42
|
return location;
|
|
45
43
|
}
|
|
46
|
-
|
|
44
|
+
export default getLocation;
|