webdriverio 7.1.1 → 7.2.3

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.
@@ -41,7 +41,7 @@ const constants_1 = require("../../constants");
41
41
  * @return {PuppeteerBrowser} initiated puppeteer instance connected to the browser
42
42
  */
43
43
  async function getPuppeteer() {
44
- var _a, _b, _c, _d;
44
+ var _a, _b, _c;
45
45
  /**
46
46
  * check if we already connected Puppeteer and if so return
47
47
  * that instance
@@ -53,7 +53,7 @@ async function getPuppeteer() {
53
53
  /**
54
54
  * attach to a Selenium 4 CDP Session if it's returned in the capabilities
55
55
  */
56
- const cdpEndpoint = (_a = caps['se:options']) === null || _a === void 0 ? void 0 : _a.cdp;
56
+ const cdpEndpoint = caps['se:cdp'];
57
57
  if (cdpEndpoint) {
58
58
  this.puppeteer = await puppeteer_core_1.default.connect({
59
59
  browserWSEndpoint: cdpEndpoint,
@@ -77,7 +77,7 @@ async function getPuppeteer() {
77
77
  /**
78
78
  * attach to Firefox debugger session
79
79
  */
80
- if (((_b = caps.browserName) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'firefox') {
80
+ if (((_a = caps.browserName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'firefox') {
81
81
  if (!caps.browserVersion) {
82
82
  throw new Error('Can\'t find "browserVersion" in capabilities');
83
83
  }
@@ -85,10 +85,10 @@ async function getPuppeteer() {
85
85
  if (majorVersion >= 79) {
86
86
  const reqCaps = this.requestedCapabilities.alwaysMatch || this.requestedCapabilities;
87
87
  const ffOptions = caps['moz:firefoxOptions'];
88
- const ffArgs = (_c = reqCaps['moz:firefoxOptions']) === null || _c === void 0 ? void 0 : _c.args;
88
+ const ffArgs = (_b = reqCaps['moz:firefoxOptions']) === null || _b === void 0 ? void 0 : _b.args;
89
89
  const rdPort = ffOptions && ffOptions.debuggerAddress
90
90
  ? ffOptions.debuggerAddress
91
- : (_d = ffArgs === null || ffArgs === void 0 ? void 0 : ffArgs[ffArgs.findIndex((arg) => arg === constants_1.FF_REMOTE_DEBUG_ARG) + 1]) !== null && _d !== void 0 ? _d : null;
91
+ : (_c = ffArgs === null || ffArgs === void 0 ? void 0 : ffArgs[ffArgs.findIndex((arg) => arg === constants_1.FF_REMOTE_DEBUG_ARG) + 1]) !== null && _c !== void 0 ? _c : null;
92
92
  if (!rdPort) {
93
93
  throw new Error('Could\'t find remote debug port in Firefox options');
94
94
  }
@@ -39,7 +39,7 @@ function url(path) {
39
39
  if (typeof path !== 'string') {
40
40
  throw new Error('Parameter for "url" command needs to be type of string');
41
41
  }
42
- if (typeof this.options.baseUrl === 'string') {
42
+ if (typeof this.options.baseUrl === 'string' && this.options.baseUrl) {
43
43
  path = (new URL(path, this.options.baseUrl)).href;
44
44
  }
45
45
  return this.navigateTo(utils_1.validateUrl(path));
@@ -40,5 +40,5 @@ import type { WaitUntilOptions } from '../../types';
40
40
  * @type utility
41
41
  *
42
42
  */
43
- export default function waitUntil(this: WebdriverIO.Browser | WebdriverIO.Element, condition: () => boolean | Promise<boolean>, { timeout, interval, timeoutMsg }?: Partial<WaitUntilOptions>): any;
43
+ export default function waitUntil(this: WebdriverIO.Browser | WebdriverIO.Element, condition: () => boolean | Promise<boolean>, { timeout, interval, timeoutMsg }?: Partial<WaitUntilOptions>): Promise<true | void>;
44
44
  //# sourceMappingURL=waitUntil.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"waitUntil.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/waitUntil.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC7B,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,SAAS,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAC3C,EACI,OAAqC,EACrC,QAAuC,EACvC,UAAU,EACb,GAAE,OAAO,CAAC,gBAAgB,CAAM,OA6BpC"}
1
+ {"version":3,"file":"waitUntil.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/waitUntil.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC7B,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,SAAS,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAC3C,EACI,OAAqC,EACrC,QAAuC,EACvC,UAAU,EACb,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAClC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CA4BtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"dragAndDrop.d.ts","sourceRoot":"","sources":["../../../src/commands/element/dragAndDrop.ts"],"names":[],"mappings":"AAMA,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,iBAkF7C"}
1
+ {"version":3,"file":"dragAndDrop.d.ts","sourceRoot":"","sources":["../../../src/commands/element/dragAndDrop.ts"],"names":[],"mappings":"AAOA,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,iBAyE7C"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../../utils");
3
+ const constants_1 = require("../../constants");
4
4
  const ACTION_BUTTON = 0;
5
5
  const sleep = (time = 0) => new Promise((resolve) => setTimeout(resolve, time));
6
6
  /**
@@ -73,23 +73,12 @@ async function dragAndDrop(target, { duration = 10 } = {}) {
73
73
  await sleep(duration);
74
74
  return this.buttonUp(ACTION_BUTTON);
75
75
  }
76
- /**
77
- * get coordinates to drag and drop
78
- */
79
- const { scrollX, scrollY } = await utils_1.getScrollPosition(this);
80
- const sourceRect = await utils_1.getElementRect(this);
81
- const sourceX = Math.floor(sourceRect.x - scrollX + (sourceRect.width / 2));
82
- const sourceY = Math.floor(sourceRect.y - scrollY + (sourceRect.height / 2));
83
- let targetX, targetY;
84
- if (isMovingToElement) {
85
- const targetRect = await utils_1.getElementRect(moveToElement);
86
- targetX = Math.floor(targetRect.x - scrollX + (targetRect.width / 2) - sourceX);
87
- targetY = Math.floor(targetRect.y - scrollY + (targetRect.height / 2) - sourceY);
88
- }
89
- else {
90
- targetX = moveToCoordinates.x;
91
- targetY = moveToCoordinates.y;
92
- }
76
+ const sourceRef = { [constants_1.ELEMENT_KEY]: this[constants_1.ELEMENT_KEY] };
77
+ const targetRef = { [constants_1.ELEMENT_KEY]: moveToElement[constants_1.ELEMENT_KEY] };
78
+ const origin = sourceRef;
79
+ const targetOrigin = isMovingToElement ? targetRef : 'pointer';
80
+ const targetX = isMovingToElement ? 0 : moveToCoordinates.x;
81
+ const targetY = isMovingToElement ? 0 : moveToCoordinates.y;
93
82
  /**
94
83
  * W3C way of handle the drag and drop action
95
84
  */
@@ -98,10 +87,10 @@ async function dragAndDrop(target, { duration = 10 } = {}) {
98
87
  id: 'finger1',
99
88
  parameters: { pointerType: 'mouse' },
100
89
  actions: [
101
- { type: 'pointerMove', duration: 0, x: sourceX, y: sourceY },
90
+ { type: 'pointerMove', duration: 0, origin, x: 0, y: 0 },
102
91
  { type: 'pointerDown', button: ACTION_BUTTON },
103
92
  { type: 'pause', duration: 10 },
104
- { type: 'pointerMove', duration, origin: 'pointer', x: targetX, y: targetY },
93
+ { type: 'pointerMove', duration, origin: targetOrigin, x: targetX, y: targetY },
105
94
  { type: 'pointerUp', button: ACTION_BUTTON }
106
95
  ]
107
96
  }]).then(() => this.releaseActions());
@@ -24,5 +24,5 @@ import type { WaitForOptions } from '../../types';
24
24
  * @return {Boolean} `true` if element is clickable (or doesn't if flag is set)
25
25
  *
26
26
  */
27
- export default function waitForClickable(this: WebdriverIO.Element, { timeout, interval, reverse, timeoutMsg }?: WaitForOptions): Promise<any>;
27
+ export default function waitForClickable(this: WebdriverIO.Element, { timeout, interval, reverse, timeoutMsg }?: WaitForOptions): Promise<true | void>;
28
28
  //# sourceMappingURL=waitForClickable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"waitForClickable.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForClickable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAA8B,gBAAgB,CAC1C,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EACI,OAAqC,EACrC,QAAuC,EACvC,OAAe,EACf,UAAsG,EACzG,GAAE,cAAmB,gBAMzB"}
1
+ {"version":3,"file":"waitForClickable.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForClickable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAA8B,gBAAgB,CAC1C,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EACI,OAAqC,EACrC,QAAuC,EACvC,OAAe,EACf,UAAsG,EACzG,GAAE,cAAmB,wBAMzB"}
@@ -34,5 +34,5 @@ import type { WaitForOptions } from '../../types';
34
34
  * @type utility
35
35
  *
36
36
  */
37
- export default function waitForDisplayed(this: WebdriverIO.Element, { timeout, interval, reverse, timeoutMsg }?: WaitForOptions): Promise<any>;
37
+ export default function waitForDisplayed(this: WebdriverIO.Element, { timeout, interval, reverse, timeoutMsg }?: WaitForOptions): Promise<true | void>;
38
38
  //# sourceMappingURL=waitForDisplayed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"waitForDisplayed.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForDisplayed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAA8B,gBAAgB,CAC1C,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EACI,OAAqC,EACrC,QAAuC,EACvC,OAAe,EACf,UAAsG,EACzG,GAAE,cAAmB,gBAMzB"}
1
+ {"version":3,"file":"waitForDisplayed.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForDisplayed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAA8B,gBAAgB,CAC1C,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EACI,OAAqC,EACrC,QAAuC,EACvC,OAAe,EACf,UAAsG,EACzG,GAAE,cAAmB,wBAMzB"}
@@ -35,5 +35,5 @@ import type { WaitForOptions } from '../../types';
35
35
  * @type utility
36
36
  *
37
37
  */
38
- export default function waitForEnabled(this: WebdriverIO.Element, { timeout, interval, reverse, timeoutMsg }?: WaitForOptions): Promise<any>;
38
+ export default function waitForEnabled(this: WebdriverIO.Element, { timeout, interval, reverse, timeoutMsg }?: WaitForOptions): Promise<true | void>;
39
39
  //# sourceMappingURL=waitForEnabled.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"waitForEnabled.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForEnabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAA8B,cAAc,CACxC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EACI,OAAqC,EACrC,QAAuC,EACvC,OAAe,EACf,UAAoG,EACvG,GAAE,cAAmB,gBAazB"}
1
+ {"version":3,"file":"waitForEnabled.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForEnabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAA8B,cAAc,CACxC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EACI,OAAqC,EACrC,QAAuC,EACvC,OAAe,EACf,UAAoG,EACvG,GAAE,cAAmB,wBAazB"}
@@ -35,5 +35,5 @@ import type { WaitForOptions } from '../../types';
35
35
  * @type utility
36
36
  *
37
37
  */
38
- export default function waitForExist(this: WebdriverIO.Element, { timeout, interval, reverse, timeoutMsg }?: WaitForOptions): any;
38
+ export default function waitForExist(this: WebdriverIO.Element, { timeout, interval, reverse, timeoutMsg }?: WaitForOptions): Promise<true | void>;
39
39
  //# sourceMappingURL=waitForExist.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"waitForExist.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForExist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EACI,OAAqC,EACrC,QAAuC,EACvC,OAAe,EACf,UAAqG,EACxG,GAAE,cAAmB,OAMzB"}
1
+ {"version":3,"file":"waitForExist.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForExist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EACI,OAAqC,EACrC,QAAuC,EACvC,OAAe,EACf,UAAqG,EACxG,GAAE,cAAmB,wBAMzB"}
@@ -14,7 +14,7 @@ const XPATH_SELECTORS_START = [
14
14
  '/', '(', '../', './', '*/'
15
15
  ];
16
16
  const NAME_MOBILE_SELECTORS_START = [
17
- 'uia', 'xcuielementtype', 'android.widget', 'cyi'
17
+ 'uia', 'xcuielementtype', 'android.widget', 'cyi', 'android.view'
18
18
  ];
19
19
  const XPATH_SELECTOR_REGEXP = [
20
20
  // HTML tag
@@ -262,7 +262,7 @@ function verifyArgsAndStripIfElement(args) {
262
262
  if (lodash_isobject_1.default(arg) && arg.constructor.name === 'Element') {
263
263
  const elem = arg;
264
264
  if (!elem.elementId) {
265
- throw new Error(`The element with selector "${elem.selector}" you trying to pass into the execute method wasn't found`);
265
+ throw new Error(`The element with selector "${elem.selector}" you are trying to pass into the execute method wasn't found`);
266
266
  }
267
267
  return {
268
268
  [constants_1.ELEMENT_KEY]: elem.elementId,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "webdriverio",
3
3
  "description": "Next-gen browser and mobile automation test framework for Node.js",
4
- "version": "7.1.1",
4
+ "version": "7.2.3",
5
5
  "homepage": "https://webdriver.io",
6
6
  "author": "Christian Bromann <christian@saucelabs.com>",
7
7
  "license": "MIT",
@@ -57,19 +57,19 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@types/aria-query": "^4.2.1",
60
- "@wdio/config": "7.1.1",
60
+ "@wdio/config": "7.2.1",
61
61
  "@wdio/logger": "7.0.0",
62
62
  "@wdio/protocols": "7.1.1",
63
- "@wdio/repl": "7.1.1",
64
- "@wdio/types": "7.1.1",
65
- "@wdio/utils": "7.1.1",
63
+ "@wdio/repl": "7.2.1",
64
+ "@wdio/types": "7.2.1",
65
+ "@wdio/utils": "7.2.1",
66
66
  "archiver": "^5.0.0",
67
67
  "aria-query": "^4.2.2",
68
68
  "atob": "^2.1.2",
69
69
  "css-shorthand-properties": "^1.1.1",
70
70
  "css-value": "^0.0.1",
71
- "devtools": "7.1.1",
72
- "devtools-protocol": "^0.0.856957",
71
+ "devtools": "7.2.1",
72
+ "devtools-protocol": "^0.0.863986",
73
73
  "fs-extra": "^9.0.1",
74
74
  "get-port": "^5.1.1",
75
75
  "grapheme-splitter": "^1.0.2",
@@ -82,7 +82,7 @@
82
82
  "resq": "^1.9.1",
83
83
  "rgb2hex": "0.2.3",
84
84
  "serialize-error": "^8.0.0",
85
- "webdriver": "7.1.1"
85
+ "webdriver": "7.2.1"
86
86
  },
87
- "gitHead": "39b675448969b8548e119a28a1ebc065ec3e6914"
87
+ "gitHead": "773eb18dcc851d35fc9136c21848b723906a055a"
88
88
  }