webdriverio 8.29.7 → 8.30.0

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/README.md CHANGED
@@ -46,6 +46,10 @@ For more information on [options](https://webdriver.io/docs/options#webdriver-op
46
46
  <center>Package Sponsors:</center>
47
47
  <p align="center">
48
48
  <a href="https://www.browserstack.com/automation-webdriverio">
49
- <img src="https://www.browserstack.com/images/layout/browserstack-logo-600x315.png" alt="BrowserStack" width="300" />
49
+ <img src="https://webdriver.io/img/sponsors/browserstack_black.svg" alt="BrowserStack" width="300" />
50
+ </a>
51
+ &nbsp;
52
+ <a href="https://saucelabs.com">
53
+ <img src="https://webdriver.io/img/sponsors/saucelabs_black.svg" alt="Sauce Labs" width="300" />
50
54
  </a>
51
55
  </p>
@@ -13,11 +13,20 @@
13
13
  await browser.reloadSession()
14
14
  console.log(browser.sessionId) // outputs: 9a0d9bf9d4864160aa982c50cf18a573
15
15
  })
16
+
17
+ it('should reload my session with new capabilities', async () => {
18
+ console.log(browser.capabilities.browserName) // outputs: chrome
19
+ await browser.reloadSession({
20
+ browserName: 'firefox'
21
+ })
22
+ console.log(browser.capabilities.browserName) // outputs: firefox
23
+ })
16
24
  * </example>
17
25
  *
18
26
  * @alias browser.reloadSession
27
+ * @param newCapabilities new capabilities to create a session with
19
28
  * @type utility
20
29
  *
21
30
  */
22
- export declare function reloadSession(this: WebdriverIO.Browser): Promise<string>;
31
+ export declare function reloadSession(this: WebdriverIO.Browser, newCapabilities?: WebdriverIO.Capabilities): Promise<string>;
23
32
  //# sourceMappingURL=reloadSession.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reloadSession.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/reloadSession.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,aAAa,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,mBA+B7D"}
1
+ {"version":3,"file":"reloadSession.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/reloadSession.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,aAAa,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,EAAE,eAAe,CAAC,EAAE,WAAW,CAAC,YAAY,mBAoCzG"}
@@ -15,19 +15,32 @@ const log = logger('webdriverio');
15
15
  await browser.reloadSession()
16
16
  console.log(browser.sessionId) // outputs: 9a0d9bf9d4864160aa982c50cf18a573
17
17
  })
18
+
19
+ it('should reload my session with new capabilities', async () => {
20
+ console.log(browser.capabilities.browserName) // outputs: chrome
21
+ await browser.reloadSession({
22
+ browserName: 'firefox'
23
+ })
24
+ console.log(browser.capabilities.browserName) // outputs: firefox
25
+ })
18
26
  * </example>
19
27
  *
20
28
  * @alias browser.reloadSession
29
+ * @param newCapabilities new capabilities to create a session with
21
30
  * @type utility
22
31
  *
23
32
  */
24
- export async function reloadSession() {
33
+ export async function reloadSession(newCapabilities) {
25
34
  const oldSessionId = this.sessionId;
35
+ /**
36
+ * if a new browser name is given we can shut down the driver since we start a new one
37
+ */
38
+ const shutdownDriver = Boolean(newCapabilities?.browserName);
26
39
  /**
27
40
  * end current running session, if session already gone suppress exceptions
28
41
  */
29
42
  try {
30
- await this.deleteSession({ shutdownDriver: false });
43
+ await this.deleteSession({ shutdownDriver });
31
44
  }
32
45
  catch (err) {
33
46
  /**
@@ -42,7 +55,7 @@ export async function reloadSession() {
42
55
  log.debug('Disconnected puppeteer session');
43
56
  }
44
57
  const ProtocolDriver = (await import(this.options.automationProtocol)).default;
45
- await ProtocolDriver.reloadSession(this);
58
+ await ProtocolDriver.reloadSession(this, newCapabilities);
46
59
  const options = this.options;
47
60
  if (Array.isArray(options.onReload) && options.onReload.length) {
48
61
  await Promise.all(options.onReload.map((hook) => hook(oldSessionId, this.sessionId)));
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": "8.29.7",
4
+ "version": "8.30.0",
5
5
  "homepage": "https://webdriver.io",
6
6
  "author": "Christian Bromann <mail@bromann.dev>",
7
7
  "license": "MIT",
@@ -69,17 +69,17 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "@types/node": "^20.1.0",
72
- "@wdio/config": "8.29.3",
72
+ "@wdio/config": "8.30.0",
73
73
  "@wdio/logger": "8.28.0",
74
74
  "@wdio/protocols": "8.29.7",
75
75
  "@wdio/repl": "8.24.12",
76
- "@wdio/types": "8.29.1",
77
- "@wdio/utils": "8.29.3",
76
+ "@wdio/types": "8.30.0",
77
+ "@wdio/utils": "8.30.0",
78
78
  "archiver": "^6.0.0",
79
79
  "aria-query": "^5.0.0",
80
80
  "css-shorthand-properties": "^1.1.1",
81
81
  "css-value": "^0.0.1",
82
- "devtools-protocol": "^0.0.1249869",
82
+ "devtools-protocol": "^0.0.1255431",
83
83
  "grapheme-splitter": "^1.0.2",
84
84
  "import-meta-resolve": "^4.0.0",
85
85
  "is-plain-obj": "^4.1.0",
@@ -91,7 +91,7 @@
91
91
  "resq": "^1.9.1",
92
92
  "rgb2hex": "0.2.5",
93
93
  "serialize-error": "^11.0.1",
94
- "webdriver": "8.29.7"
94
+ "webdriver": "8.30.0"
95
95
  },
96
96
  "peerDependencies": {
97
97
  "devtools": "^8.14.0"
@@ -101,5 +101,5 @@
101
101
  "optional": true
102
102
  }
103
103
  },
104
- "gitHead": "1c7195268663df56856494c69d7bd655c834a368"
104
+ "gitHead": "033e2a91e97c9bd060eb70f2e4e412d382bec3af"
105
105
  }