@wdio/browser-runner 8.15.10 → 8.16.2

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":"driver.d.ts","sourceRoot":"","sources":["../../src/browser/driver.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,OAAO,OAAO,WAAW;;IAG5B,MAAM,CAAC,UAAU,CACb,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,KAAK,EACf,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACjD,cAAc,EAAE,GAAG;CAoJ1B"}
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/browser/driver.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAC,OAAO,OAAO,WAAW;;IAG5B,MAAM,CAAC,UAAU,CACb,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,KAAK,EACf,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACjD,cAAc,EAAE,GAAG;CA+J1B"}
@@ -6,6 +6,8 @@ import { getCID } from './utils.js';
6
6
  import { MESSAGE_TYPES } from '../constants.js';
7
7
  const COMMAND_TIMEOUT = 30 * 1000; // 30s
8
8
  const CONSOLE_METHODS = ['log', 'info', 'warn', 'error', 'debug'];
9
+ const HIDE_REPORTER_FOR_COMMANDS = ['saveScreenshot', 'savePDF'];
10
+ const mochaFramework = document.querySelector('mocha-framework');
9
11
  export default class ProxyDriver {
10
12
  static #commandMessages = new Map();
11
13
  static newSession(params, modifier, userPrototype, commandWrapper) {
@@ -27,7 +29,7 @@ export default class ProxyDriver {
27
29
  const environment = sessionEnvironmentDetector({ capabilities: params.capabilities, requestedCapabilities: {} });
28
30
  const environmentPrototype = getEnvironmentVars(environment);
29
31
  // have debug command
30
- const commandsProcessedInNodeWorld = [...commands, 'debug'];
32
+ const commandsProcessedInNodeWorld = [...commands, 'debug', 'saveScreenshot', 'savePDF'];
31
33
  const protocolCommands = commandsProcessedInNodeWorld.reduce((prev, commandName) => {
32
34
  const isDebugCommand = commandName === 'debug';
33
35
  prev[commandName] = {
@@ -42,6 +44,9 @@ export default class ProxyDriver {
42
44
  console.log(...(isDebugCommand
43
45
  ? ['[WDIO] %cDebug Mode Enabled', 'background: #ea5906; color: #fff; padding: 3px; border-radius: 5px;']
44
46
  : [`[WDIO] ${(new Date()).toISOString()} - id: ${commandId} - COMMAND: ${commandName}(${args.join(', ')})`]));
47
+ if (HIDE_REPORTER_FOR_COMMANDS.includes(commandName) && mochaFramework) {
48
+ mochaFramework.setAttribute('style', 'display: none');
49
+ }
45
50
  socket.send(JSON.stringify(this.#commandRequest({
46
51
  commandName,
47
52
  cid,
@@ -53,16 +58,18 @@ export default class ProxyDriver {
53
58
  if (!isDebugCommand) {
54
59
  commandTimeout = setTimeout(() => reject(new Error(`Command "${commandName}" timed out`)), COMMAND_TIMEOUT);
55
60
  }
56
- this.#commandMessages.set(commandId.toString(), { resolve, reject, commandTimeout });
61
+ this.#commandMessages.set(commandId.toString(), { resolve, reject, commandTimeout, commandName });
57
62
  });
58
63
  }
59
64
  };
60
65
  return prev;
61
66
  }, {});
62
67
  /**
63
- * handle debug command on the server side
68
+ * handle certain commands on the server side
64
69
  */
65
70
  delete userPrototype.debug;
71
+ delete userPrototype.saveScreenshot;
72
+ delete userPrototype.savePDF;
66
73
  const prototype = {
67
74
  /**
68
75
  * custom protocol commands that communicate with Vite
@@ -95,6 +102,9 @@ export default class ProxyDriver {
95
102
  if (!commandMessage) {
96
103
  return console.error(`Unknown command id "${value.id}"`);
97
104
  }
105
+ if (HIDE_REPORTER_FOR_COMMANDS.includes(commandMessage.commandName) && mochaFramework) {
106
+ mochaFramework.removeAttribute('style');
107
+ }
98
108
  if (value.error) {
99
109
  console.log(`[WDIO] ${(new Date()).toISOString()} - id: ${value.id} - ERROR: ${JSON.stringify(value.error.message)}`);
100
110
  return commandMessage.reject(new Error(value.error.message || 'unknown error'));
@@ -1 +1 @@
1
- {"version":3,"file":"mockHoisting.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/mockHoisting.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAU7C,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE,CA8U/D"}
1
+ {"version":3,"file":"mockHoisting.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/mockHoisting.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAU7C,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE,CAgV/D"}
@@ -192,8 +192,10 @@ export function mockHoisting(mockHandler) {
192
192
  const newNode = b.importDeclaration([b.importNamespaceSpecifier(b.identifier(newImportIdentifier))], b.literal(source));
193
193
  nodePath.insertBefore(newNode);
194
194
  }
195
+ // determine file extension length so we can cut it out, fall back to infinity if no extension is set
196
+ const mockExtensionLengh = (path.extname(source).length * -1) || Infinity;
195
197
  const wdioImportModuleIdentifier = source.startsWith('.') || source.startsWith('/')
196
- ? url.pathToFileURL(path.resolve(path.dirname(id), source).slice(0, path.extname(source).length * -1)).pathname
198
+ ? url.pathToFileURL(path.resolve(path.dirname(id), source).slice(0, mockExtensionLengh)).pathname
197
199
  : source;
198
200
  const isNamespaceImport = dec.specifiers.length === 1 && dec.specifiers[0].type === types.namedTypes.ImportNamespaceSpecifier.toString();
199
201
  const mockImport = isSpecFile && !isMockedModule
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/browser-runner",
3
- "version": "8.15.10",
3
+ "version": "8.16.2",
4
4
  "description": "A WebdriverIO runner to run unit tests tests in the browser.",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browser-runner",
@@ -35,13 +35,13 @@
35
35
  "@types/istanbul-lib-source-maps": "^4.0.1",
36
36
  "@types/node": "^20.1.0",
37
37
  "@vitest/spy": "^0.34.1",
38
- "@wdio/globals": "8.15.10",
39
- "@wdio/local-runner": "8.15.10",
38
+ "@wdio/globals": "8.16.2",
39
+ "@wdio/local-runner": "8.16.2",
40
40
  "@wdio/logger": "8.11.0",
41
- "@wdio/mocha-framework": "8.15.10",
41
+ "@wdio/mocha-framework": "8.16.0",
42
42
  "@wdio/protocols": "8.14.6",
43
43
  "@wdio/types": "8.15.10",
44
- "@wdio/utils": "8.15.10",
44
+ "@wdio/utils": "8.16.0",
45
45
  "ast-types": "^0.14.2",
46
46
  "deepmerge-ts": "^5.0.0",
47
47
  "expect-webdriverio": "^4.2.5",
@@ -60,8 +60,8 @@
60
60
  "vite": "~4.4.6",
61
61
  "vite-plugin-istanbul": "^5.0.0",
62
62
  "vite-plugin-top-level-await": "^1.3.0",
63
- "webdriver": "8.15.10",
64
- "webdriverio": "8.15.10",
63
+ "webdriver": "8.16.0",
64
+ "webdriverio": "8.16.2",
65
65
  "ws": "^8.13.0"
66
66
  },
67
67
  "scripts": {
@@ -72,7 +72,7 @@
72
72
  },
73
73
  "devDependencies": {
74
74
  "@types/ws": "^8.5.4",
75
- "@wdio/runner": "8.15.10"
75
+ "@wdio/runner": "8.16.2"
76
76
  },
77
- "gitHead": "63a02b672216ae86a58475746a5eed5adf0d736f"
77
+ "gitHead": "103470cf452a582f9a1f3678c260575e08bf6c37"
78
78
  }