webdriverio 9.0.4 → 9.0.5

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.
@@ -0,0 +1,50 @@
1
+ // src/protocol-stub.ts
2
+ import { capabilitiesEnvironmentDetector } from "@wdio/utils";
3
+ var ProtocolStub = class {
4
+ static async newSession(options) {
5
+ const capabilities = emulateSessionCapabilities(options.capabilities);
6
+ const browser = {
7
+ options,
8
+ capabilities,
9
+ requestedCapabilities: capabilities,
10
+ customCommands: [],
11
+ // internally used to transfer custom commands to the actual protocol instance
12
+ overwrittenCommands: [],
13
+ // internally used to transfer overwritten commands to the actual protocol instance
14
+ commandList: [],
15
+ ...capabilitiesEnvironmentDetector(capabilities)
16
+ };
17
+ browser.addCommand = (...args) => browser.customCommands.push(args);
18
+ browser.overwriteCommand = (...args) => browser.overwrittenCommands.push(args);
19
+ return browser;
20
+ }
21
+ /**
22
+ * added just in case user wants to somehow reload webdriver before it was started.
23
+ */
24
+ static reloadSession() {
25
+ throw new Error("Protocol Stub: Make sure to start the session before reloading it.");
26
+ }
27
+ static attachToSession(options, modifier) {
28
+ if (options || !modifier) {
29
+ throw new Error("You are trying to attach to a protocol stub, this should never occur, please file an issue.");
30
+ }
31
+ return modifier({
32
+ commandList: []
33
+ });
34
+ }
35
+ };
36
+ function emulateSessionCapabilities(caps) {
37
+ const capabilities = {};
38
+ Object.entries(caps).forEach(([key, value]) => {
39
+ const newKey = key.replace("appium:", "");
40
+ capabilities[newKey] = value;
41
+ });
42
+ const c = "alwaysMatch" in caps ? caps.alwaysMatch : caps;
43
+ if (c.browserName && c.browserName.toLowerCase() === "chrome") {
44
+ capabilities["goog:chromeOptions"] = {};
45
+ }
46
+ return capabilities;
47
+ }
48
+ export {
49
+ ProtocolStub as default
50
+ };
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": "9.0.4",
4
+ "version": "9.0.5",
5
5
  "homepage": "https://webdriver.io",
6
6
  "author": "Christian Bromann <mail@bromann.dev>",
7
7
  "license": "MIT",
@@ -56,6 +56,10 @@
56
56
  "./scripts/*": {
57
57
  "source": "./src/scripts/*.ts",
58
58
  "import": "./build/scripts/*"
59
+ },
60
+ "./protocol-stub": {
61
+ "source": "./src/protocol-stub.ts",
62
+ "import": "./build/protocol-stub.js"
59
63
  }
60
64
  },
61
65
  "types": "./build/index.d.ts",
@@ -72,12 +76,12 @@
72
76
  "dependencies": {
73
77
  "@types/node": "^20.11.30",
74
78
  "@types/sinonjs__fake-timers": "^8.1.5",
75
- "@wdio/config": "9.0.4",
79
+ "@wdio/config": "9.0.5",
76
80
  "@wdio/logger": "9.0.4",
77
81
  "@wdio/protocols": "9.0.4",
78
82
  "@wdio/repl": "9.0.4",
79
83
  "@wdio/types": "9.0.4",
80
- "@wdio/utils": "9.0.4",
84
+ "@wdio/utils": "9.0.5",
81
85
  "archiver": "^7.0.1",
82
86
  "aria-query": "^5.3.0",
83
87
  "cheerio": "^1.0.0-rc.12",
@@ -96,7 +100,7 @@
96
100
  "rgb2hex": "0.2.5",
97
101
  "serialize-error": "^11.0.3",
98
102
  "urlpattern-polyfill": "^10.0.0",
99
- "webdriver": "9.0.4"
103
+ "webdriver": "9.0.5"
100
104
  },
101
105
  "peerDependencies": {
102
106
  "puppeteer-core": "^22.3.0"
@@ -106,5 +110,5 @@
106
110
  "optional": true
107
111
  }
108
112
  },
109
- "gitHead": "1f3d6f781391548e8672e768e72b3d5c499a3aa7"
113
+ "gitHead": "5ec4340e8caa435212cf4aede2c12dcc662459a4"
110
114
  }