@wdio/utils 8.16.0 → 8.16.7

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":"manager.d.ts","sourceRoot":"","sources":["../../src/driver/manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAgGxD,wBAAsB,WAAW,CAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,kBAAkB,kCAezH;AAED,wBAAgB,YAAY,CAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,kBAAkB,kCAYpH"}
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/driver/manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA4GxD,wBAAsB,WAAW,CAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,kBAAkB,kCAezH;AAED,wBAAgB,YAAY,CAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,kBAAkB,kCAYpH"}
@@ -14,7 +14,12 @@ function mapCapabilities(options, caps, task, taskItemLabel) {
14
14
  const multiremoteCaps = cap;
15
15
  const isMultiremote = Boolean(multiremoteCaps[Object.keys(cap)[0]].capabilities);
16
16
  if (isMultiremote) {
17
- return Object.values(multiremoteCaps).map((c) => c.capabilities);
17
+ return Object.values(multiremoteCaps).map((c) => {
18
+ if (c.automationProtocol === 'devtools') {
19
+ return;
20
+ }
21
+ return c.capabilities;
22
+ });
18
23
  }
19
24
  else if (w3cCaps.alwaysMatch) {
20
25
  return w3cCaps.alwaysMatch;
@@ -23,6 +28,9 @@ function mapCapabilities(options, caps, task, taskItemLabel) {
23
28
  }).flat()
24
29
  : Object.values(caps).map((mrOpts) => {
25
30
  const w3cCaps = mrOpts.capabilities;
31
+ if (mrOpts.automationProtocol === 'devtools') {
32
+ return;
33
+ }
26
34
  if (w3cCaps.alwaysMatch) {
27
35
  return w3cCaps.alwaysMatch;
28
36
  }
@@ -31,14 +39,18 @@ function mapCapabilities(options, caps, task, taskItemLabel) {
31
39
  /**
32
40
  * only set up driver if
33
41
  */
34
- // - browserName is defined so we know it is a browser session
35
- cap.browserName &&
42
+ // - capabilities are defined and not empty because automationProtocol is set to `devtools`
43
+ cap &&
44
+ // - browserName is defined so we know it is a browser session
45
+ cap.browserName &&
36
46
  // - we are not about to run a cloud session
37
47
  !definesRemoteDriver(options) &&
38
48
  // - we are not running Safari (driver already installed on macOS)
39
49
  !isSafari(cap.browserName) &&
40
50
  // - driver options don't define a binary path
41
- !getDriverOptions(cap).binary));
51
+ !getDriverOptions(cap).binary &&
52
+ // - user is not defining "devtools" as automation protocol
53
+ options.automationProtocol !== 'devtools'));
42
54
  /**
43
55
  * nothing to setup
44
56
  */
@@ -38,7 +38,7 @@ export function getBuildIdByChromePath(chromePath) {
38
38
  const oldest = versions.sort((a, b) => a > b ? -1 : 1)[0];
39
39
  return oldest;
40
40
  }
41
- const versionString = cp.execSync(`"${chromePath}" --version`).toString();
41
+ const versionString = cp.execSync(`"${chromePath}" --version --no-sandbox`).toString();
42
42
  return versionString.trim().split(' ').pop()?.trim();
43
43
  }
44
44
  export async function getBuildIdByFirefoxPath(firefoxPath) {
@@ -74,7 +74,7 @@ export async function setupPuppeteerBrowser(cacheDir, caps) {
74
74
  await fsp.mkdir(cacheDir, { recursive: true });
75
75
  }
76
76
  /**
77
- * don't set up Chrome if a binary was defined in caps
77
+ * don't set up Chrome/Firefox if a binary was defined in caps
78
78
  */
79
79
  const browserOptions = (browserName === Browser.CHROME
80
80
  ? caps['goog:chromeOptions']
@@ -99,7 +99,7 @@ export async function setupPuppeteerBrowser(cacheDir, caps) {
99
99
  ? getBuildIdByChromePath(executablePath)
100
100
  : await getBuildIdByFirefoxPath(executablePath);
101
101
  /**
102
- * verify that we have a valid Chrome browser installed
102
+ * verify that we have a valid Chrome/Firefox browser installed
103
103
  */
104
104
  if (tag) {
105
105
  return {
@@ -109,7 +109,7 @@ export async function setupPuppeteerBrowser(cacheDir, caps) {
109
109
  }
110
110
  }
111
111
  /**
112
- * otherwise download provided Chrome browser version or "stable"
112
+ * otherwise download provided Chrome/Firefox browser version or "stable"
113
113
  */
114
114
  const tag = browserName === Browser.CHROME
115
115
  ? caps.browserVersion || ChromeReleaseChannel.STABLE
@@ -1 +1 @@
1
- {"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../src/shim.ts"],"names":[],"mappings":"AASA,UAAU,OAAO;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,OAAO,CAAC,MAAM,CAAC;IAEX,IAAI,WAAW,EAAE,GAAG,CAAA;CACvB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM,CAAC;QACb,UAAU,MAAM;YACZ,MAAM,EAAE,GAAG,CAAA;YACX,WAAW,EAAE,GAAG,CAAA;SACnB;KACJ;CACJ;AAaD,QAAA,MAAM,oBAAoB,YAAqD,GAAG,YAAY,MAAM,UAAS,QAAQ,GAAG,QAAQ,EAAE,SAAa,GAAG,EAAE,2BA6CnJ,CAAA;AAED;;;;GAIG;AACH,QAAA,MAAM,WAAW,mBAAwC,MAAM,MAAM,QAAQ,eAAa,GAAG,eAkL5F,CAAA;AAED;;;;;;;GAOG;AACH,iBAAe,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,GAAE,GAAG,EAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAmBzG;AAED,OAAO,EACH,oBAAoB,EACpB,WAAW,EACX,YAAY,GACf,CAAA"}
1
+ {"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../src/shim.ts"],"names":[],"mappings":"AASA,UAAU,OAAO;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,OAAO,CAAC,MAAM,CAAC;IAEX,IAAI,WAAW,EAAE,GAAG,CAAA;CACvB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM,CAAC;QACb,UAAU,MAAM;YACZ,MAAM,EAAE,GAAG,CAAA;YACX,WAAW,EAAE,GAAG,CAAA;SACnB;KACJ;CACJ;AAaD,QAAA,MAAM,oBAAoB,YAAqD,GAAG,YAAY,MAAM,UAAS,QAAQ,GAAG,QAAQ,EAAE,SAAa,GAAG,EAAE,2BAsDnJ,CAAA;AAED;;;;GAIG;AACH,QAAA,MAAM,WAAW,mBAAwC,MAAM,MAAM,QAAQ,eAAa,GAAG,eAkL5F,CAAA;AAED;;;;;;;GAOG;AACH,iBAAe,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,GAAE,GAAG,EAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAmBzG;AAED,OAAO,EACH,oBAAoB,EACpB,WAAW,EACX,YAAY,GACf,CAAA"}
package/build/shim.js CHANGED
@@ -25,12 +25,21 @@ const executeHooksWithArgs = async function executeHooksWithArgsShim(hookName, h
25
25
  if (!Array.isArray(args)) {
26
26
  args = [args];
27
27
  }
28
- const hooksPromises = hooks.map((hook) => new Promise((resolve) => {
28
+ const hooksPromises = hooks.map((hook) => new Promise((resolve, reject) => {
29
29
  let result;
30
30
  try {
31
31
  result = hook.apply(this, args);
32
32
  }
33
33
  catch (e) {
34
+ /**
35
+ * When we use `this.skip()` inside a test or a hook, it's a signal that we want to stop that particular test.
36
+ * Mocha, the testing framework, knows how to handle this for its own built-in hooks and test steps.
37
+ * However, for our custom hooks, we need to reject the promise, which effectively skips the test case.
38
+ * For more details, refer to: https://github.com/mochajs/mocha/pull/3859#issuecomment-534116333
39
+ */
40
+ if (/^(sync|async) skip; aborting execution$/.test(e.message)) {
41
+ return reject();
42
+ }
34
43
  log.error(e.stack);
35
44
  return resolve(e);
36
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/utils",
3
- "version": "8.16.0",
3
+ "version": "8.16.7",
4
4
  "description": "A WDIO helper utility to provide several utility functions used across the project.",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-utils",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "@puppeteer/browsers": "^1.6.0",
34
34
  "@wdio/logger": "8.11.0",
35
- "@wdio/types": "8.15.10",
35
+ "@wdio/types": "8.16.7",
36
36
  "decamelize": "^6.0.0",
37
37
  "deepmerge-ts": "^5.1.0",
38
38
  "edgedriver": "^5.3.5",
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "69af55a5cd2aa1f1e4173b2fa2c28a7d65ceca83"
50
+ "gitHead": "15f7f225e6a81ea0e5e7a9ba8067ca59007f09c2"
51
51
  }