webdriverio 7.16.5 → 7.16.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"newWindow.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/newWindow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAA8B,SAAS,CACnC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,GAAG,EAAE,MAAM,EACX,EAAE,UAAe,EAAE,cAAmB,EAAE,GAAE,gBAAqB,mBA2BlE"}
1
+ {"version":3,"file":"newWindow.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/newWindow.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAInD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAA8B,SAAS,CACnC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,GAAG,EAAE,MAAM,EACX,EAAE,UAAe,EAAE,cAAmB,EAAE,GAAE,gBAAqB,mBAyClE"}
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const utils_1 = require("@wdio/utils");
6
7
  const newWindow_1 = __importDefault(require("../../scripts/newWindow"));
8
+ const WAIT_FOR_NEW_HANDLE_TIMEOUT = 3000;
7
9
  /**
8
10
  *
9
11
  * Open new window in browser. This command is the equivalent function to `window.open()`. This command does not
@@ -55,9 +57,23 @@ async function newWindow(url, { windowName = '', windowFeatures = '' } = {}) {
55
57
  if (this.isMobile) {
56
58
  throw new Error('newWindow command is not supported on mobile platforms');
57
59
  }
60
+ const tabsBefore = await this.getWindowHandles();
58
61
  await this.execute(newWindow_1.default, url, windowName, windowFeatures);
59
- const tabs = await this.getWindowHandles();
60
- const newTab = tabs.pop();
62
+ /**
63
+ * if tests are run in DevTools there might be a delay until
64
+ * a new window handle got registered, this little procedure
65
+ * waits for it to exist and avoid race conditions
66
+ */
67
+ let tabsAfter = await this.getWindowHandles();
68
+ const now = Date.now();
69
+ while ((Date.now() - now) < WAIT_FOR_NEW_HANDLE_TIMEOUT) {
70
+ tabsAfter = await this.getWindowHandles();
71
+ if (tabsAfter.length > tabsBefore.length) {
72
+ break;
73
+ }
74
+ await (0, utils_1.sleep)(100);
75
+ }
76
+ const newTab = tabsAfter.pop();
61
77
  if (!newTab) {
62
78
  throw new Error('No window handle was found to switch to');
63
79
  }
@@ -13,7 +13,7 @@
13
13
  * :::info
14
14
  *
15
15
  * Please note that `isClickable` works only in web browser and in mobile webviews,
16
- * it doesn't work in mobile app native context. Also, as oppose to other element
16
+ * it doesn't work in mobile app native context. Also, As opposed to other element
17
17
  * commands WebdriverIO will not wait for the element to exist to execute this command.
18
18
  *
19
19
  * :::
@@ -21,7 +21,7 @@ const isElementClickable_1 = __importDefault(require("../../scripts/isElementCli
21
21
  * :::info
22
22
  *
23
23
  * Please note that `isClickable` works only in web browser and in mobile webviews,
24
- * it doesn't work in mobile app native context. Also, as oppose to other element
24
+ * it doesn't work in mobile app native context. Also, As opposed to other element
25
25
  * commands WebdriverIO will not wait for the element to exist to execute this command.
26
26
  *
27
27
  * :::
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * :::info
6
6
  *
7
- * As oppose to other element commands WebdriverIO will not wait for the element
7
+ * As opposed to other element commands WebdriverIO will not wait for the element
8
8
  * to exist to execute this command.
9
9
  *
10
10
  * :::
@@ -13,7 +13,7 @@ const noW3CEndpoint = ['microsoftedge', 'msedge', 'safari', 'chrome', 'safari te
13
13
  *
14
14
  * :::info
15
15
  *
16
- * As oppose to other element commands WebdriverIO will not wait for the element
16
+ * As opposed to other element commands WebdriverIO will not wait for the element
17
17
  * to exist to execute this command.
18
18
  *
19
19
  * :::
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * :::info
6
6
  *
7
- * As oppose to other element commands WebdriverIO will not wait for the element
7
+ * As opposed to other element commands WebdriverIO will not wait for the element
8
8
  * to exist to execute this command.
9
9
  *
10
10
  * :::
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  *
7
7
  * :::info
8
8
  *
9
- * As oppose to other element commands WebdriverIO will not wait for the element
9
+ * As opposed to other element commands WebdriverIO will not wait for the element
10
10
  * to exist to execute this command.
11
11
  *
12
12
  * :::
@@ -4,7 +4,7 @@ import type { WaitForOptions } from '../../types';
4
4
  *
5
5
  * :::info
6
6
  *
7
- * As oppose to other element commands WebdriverIO will not wait for the element to exist to execute
7
+ * As opposed to other element commands WebdriverIO will not wait for the element to exist to execute
8
8
  * this command.
9
9
  *
10
10
  * :::
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  *
6
6
  * :::info
7
7
  *
8
- * As oppose to other element commands WebdriverIO will not wait for the element to exist to execute
8
+ * As opposed to other element commands WebdriverIO will not wait for the element to exist to execute
9
9
  * this command.
10
10
  *
11
11
  * :::
@@ -5,7 +5,7 @@ import type { WaitForOptions } from '../../types';
5
5
  *
6
6
  * :::info
7
7
  *
8
- * As oppose to other element commands WebdriverIO will not wait for the element to exist to execute
8
+ * As opposed to other element commands WebdriverIO will not wait for the element to exist to execute
9
9
  * this command.
10
10
  *
11
11
  * :::
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  *
7
7
  * :::info
8
8
  *
9
- * As oppose to other element commands WebdriverIO will not wait for the element to exist to execute
9
+ * As opposed to other element commands WebdriverIO will not wait for the element to exist to execute
10
10
  * this command.
11
11
  *
12
12
  * :::
@@ -7,7 +7,7 @@ import type { WaitForOptions } from '../../types';
7
7
  *
8
8
  * :::info
9
9
  *
10
- * As oppose to other element commands WebdriverIO will not wait for the element
10
+ * As opposed to other element commands WebdriverIO will not wait for the element
11
11
  * to exist to execute this command.
12
12
  *
13
13
  * :::
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  *
9
9
  * :::info
10
10
  *
11
- * As oppose to other element commands WebdriverIO will not wait for the element
11
+ * As opposed to other element commands WebdriverIO will not wait for the element
12
12
  * to exist to execute this command.
13
13
  *
14
14
  * :::
@@ -9,7 +9,7 @@ import type { WaitForOptions } from '../../types';
9
9
  *
10
10
  * :::info
11
11
  *
12
- * As oppose to other element commands WebdriverIO will not wait for the
12
+ * As opposed to other element commands WebdriverIO will not wait for the
13
13
  * element to exist to execute this command.
14
14
  *
15
15
  * :::
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  *
11
11
  * :::info
12
12
  *
13
- * As oppose to other element commands WebdriverIO will not wait for the
13
+ * As opposed to other element commands WebdriverIO will not wait for the
14
14
  * element to exist to execute this command.
15
15
  *
16
16
  * :::
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * :::info
8
8
  *
9
- * As oppose to other element commands WebdriverIO will not wait for the element to exist to execute
9
+ * As opposed to other element commands WebdriverIO will not wait for the element to exist to execute
10
10
  * this command.
11
11
  *
12
12
  * :::
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  *
12
12
  * :::info
13
13
  *
14
- * As oppose to other element commands WebdriverIO will not wait for the element to exist to execute
14
+ * As opposed to other element commands WebdriverIO will not wait for the element to exist to execute
15
15
  * this command.
16
16
  *
17
17
  * :::
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.16.5",
4
+ "version": "7.16.6",
5
5
  "homepage": "https://webdriver.io",
6
6
  "author": "Christian Bromann <christian@saucelabs.com>",
7
7
  "license": "MIT",
@@ -70,7 +70,7 @@
70
70
  "css-shorthand-properties": "^1.1.1",
71
71
  "css-value": "^0.0.1",
72
72
  "devtools": "7.16.5",
73
- "devtools-protocol": "^0.0.938931",
73
+ "devtools-protocol": "^0.0.940028",
74
74
  "fs-extra": "^10.0.0",
75
75
  "get-port": "^5.1.1",
76
76
  "grapheme-splitter": "^1.0.2",
@@ -86,5 +86,5 @@
86
86
  "serialize-error": "^8.0.0",
87
87
  "webdriver": "7.16.3"
88
88
  },
89
- "gitHead": "18d21befbae2b65b11765b73f9926e724cacad56"
89
+ "gitHead": "3c4691df750c120c1b05d168d1b50bf047512892"
90
90
  }