@wdio/browser-runner 8.2.3 → 8.2.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":"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;CAkJ1B"}
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/browser/driver.ts"],"names":[],"mappings":"AAiBA,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;CAmJ1B"}
@@ -1,6 +1,6 @@
1
1
  import stringify from 'fast-safe-stringify';
2
2
  import { commands } from 'virtual:wdio';
3
- import { webdriverMonad } from '@wdio/utils';
3
+ import { webdriverMonad, sessionEnvironmentDetector } from '@wdio/utils';
4
4
  import { getEnvironmentVars } from 'webdriver';
5
5
  import { MESSAGE_TYPES } from '../constants.js';
6
6
  const COMMAND_TIMEOUT = 30 * 1000; // 30s
@@ -23,7 +23,8 @@ export default class ProxyDriver {
23
23
  const socket = window.__wdioSocket__;
24
24
  socket.addEventListener('message', this.#handleServerMessage.bind(this));
25
25
  let commandId = 0;
26
- const environmentPrototype = getEnvironmentVars(params);
26
+ const environment = sessionEnvironmentDetector({ capabilities: params.capabilities, requestedCapabilities: {} });
27
+ const environmentPrototype = getEnvironmentVars(environment);
27
28
  // have debug command
28
29
  const commandsProcessedInNodeWorld = [...commands, 'debug'];
29
30
  const protocolCommands = commandsProcessedInNodeWorld.reduce((prev, commandName) => {
@@ -94,8 +95,8 @@ export default class ProxyDriver {
94
95
  return console.error(`Unknown command id "${value.id}"`);
95
96
  }
96
97
  if (value.error) {
97
- console.log(`[WDIO] ${(new Date()).toISOString()} - id: ${value.id} - ERROR: ${JSON.stringify(value.result)}`);
98
- return commandMessage.reject(value.error);
98
+ console.log(`[WDIO] ${(new Date()).toISOString()} - id: ${value.id} - ERROR: ${JSON.stringify(value.error.message)}`);
99
+ return commandMessage.reject(new Error(value.error.message || 'unknown error'));
99
100
  }
100
101
  if (commandMessage.commandTimeout) {
101
102
  clearTimeout(commandMessage.commandTimeout);
@@ -19,6 +19,7 @@ export declare const pathToFileURL: () => string;
19
19
  export declare const fileURLToPath: () => string;
20
20
  export declare const dirname: () => string;
21
21
  export declare const resolve: () => string;
22
+ export declare const sep = "/";
22
23
  declare const _default: () => void;
23
24
  export default _default;
24
25
  //# sourceMappingURL=mock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../src/browser/mock.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;;;CAIzB,CAAA;AAED,eAAO,MAAM,iBAAiB,SAAK,CAAA;AACnC,eAAO,MAAM,eAAe,IAAK,CAAA;AACjC,qBAAa,YAAY;CAAG;AAC5B,eAAO,MAAM,GAAG;;;;;CAAa,CAAA;AAC7B,eAAO,MAAM,aAAa,cAAW,CAAA;AACrC,eAAO,MAAM,aAAa,cAAW,CAAA;AACrC,eAAO,MAAM,OAAO,cAAW,CAAA;AAC/B,eAAO,MAAM,OAAO,cAAW,CAAA;;AAC/B,wBAAuB"}
1
+ {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../src/browser/mock.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;;;CAIzB,CAAA;AAED,eAAO,MAAM,iBAAiB,SAAK,CAAA;AACnC,eAAO,MAAM,eAAe,IAAK,CAAA;AACjC,qBAAa,YAAY;CAAG;AAC5B,eAAO,MAAM,GAAG;;;;;CAAa,CAAA;AAC7B,eAAO,MAAM,aAAa,cAAW,CAAA;AACrC,eAAO,MAAM,aAAa,cAAW,CAAA;AACrC,eAAO,MAAM,OAAO,cAAW,CAAA;AAC/B,eAAO,MAAM,OAAO,cAAW,CAAA;AAC/B,eAAO,MAAM,GAAG,MAAM,CAAA;;AACtB,wBAAuB"}
@@ -15,4 +15,5 @@ export const pathToFileURL = () => '';
15
15
  export const fileURLToPath = () => '';
16
16
  export const dirname = () => '';
17
17
  export const resolve = () => '';
18
+ export const sep = '/';
18
19
  export default () => { };
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/vite/constants.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAgB1F,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,OAAO,CAAC,YAAY,CAwBrD,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/vite/constants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAgB1F,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,OAAO,CAAC,YAAY,CAmBrD,CAAA"}
@@ -1,6 +1,5 @@
1
1
  import topLevelAwait from 'vite-plugin-top-level-await';
2
2
  import { esbuildCommonjs } from '@originjs/vite-plugin-commonjs';
3
- import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
4
3
  export const PRESET_DEPENDENCIES = {
5
4
  react: ['@vitejs/plugin-react', 'default', {
6
5
  babel: {
@@ -33,11 +32,6 @@ export const DEFAULT_VITE_CONFIG = {
33
32
  },
34
33
  // Enable esbuild polyfill plugins
35
34
  plugins: [
36
- // @ts-expect-error see https://github.com/webdriverio/webdriverio/pull/9593
37
- NodeGlobalsPolyfillPlugin({
38
- process: true,
39
- buffer: true
40
- }),
41
35
  esbuildCommonjs(['@testing-library/vue'])
42
36
  ],
43
37
  },
@@ -1 +1 @@
1
- {"version":3,"file":"testrunner.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/testrunner.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AA6ClC,wBAAgB,UAAU,CAAE,OAAO,EAAE,WAAW,CAAC,oBAAoB,GAAG,MAAM,CA6G7E"}
1
+ {"version":3,"file":"testrunner.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/testrunner.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAuClC,wBAAgB,UAAU,CAAE,OAAO,EAAE,WAAW,CAAC,oBAAoB,GAAG,MAAM,CA6G7E"}
@@ -1,23 +1,14 @@
1
1
  import url from 'node:url';
2
2
  import path from 'node:path';
3
3
  import logger from '@wdio/logger';
4
+ import { deepmerge } from 'deepmerge-ts';
4
5
  import { resolve } from 'import-meta-resolve';
5
6
  import { WebDriverProtocol, MJsonWProtocol, JsonWProtocol, AppiumProtocol, ChromiumProtocol, SauceLabsProtocol, SeleniumProtocol, GeckoProtocol, WebDriverBidiProtocol } from '@wdio/protocols';
6
7
  import { SESSIONS } from '../../constants.js';
7
8
  import { getTemplate, getErrorTemplate } from '../utils.js';
8
9
  const log = logger('@wdio/browser-runner:plugin');
9
10
  const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
10
- const commands = {
11
- ...WebDriverProtocol,
12
- ...MJsonWProtocol,
13
- ...JsonWProtocol,
14
- ...AppiumProtocol,
15
- ...ChromiumProtocol,
16
- ...SauceLabsProtocol,
17
- ...SeleniumProtocol,
18
- ...GeckoProtocol,
19
- ...WebDriverBidiProtocol
20
- };
11
+ const commands = deepmerge(WebDriverProtocol, MJsonWProtocol, JsonWProtocol, AppiumProtocol, ChromiumProtocol, SauceLabsProtocol, SeleniumProtocol, GeckoProtocol, WebDriverBidiProtocol);
21
12
  const protocolCommandList = Object.values(commands).map((endpoint) => Object.values(endpoint).map(({ command }) => command)).flat();
22
13
  const WDIO_PACKAGES = ['webdriverio', 'expect-webdriverio'];
23
14
  const virtualModuleId = 'virtual:wdio';
@@ -33,7 +24,7 @@ const FETCH_FROM_ESM = [
33
24
  'mocha'
34
25
  ];
35
26
  export function testrunner(options) {
36
- const automationProtocolPath = path.resolve(__dirname, '..', '..', 'browser', 'driver.js');
27
+ const automationProtocolPath = `/@fs${url.pathToFileURL(path.resolve(__dirname, '..', '..', 'browser', 'driver.js')).pathname}`;
37
28
  const mockModulePath = path.resolve(__dirname, '..', '..', 'browser', 'mock.js');
38
29
  const setupModulePath = path.resolve(__dirname, '..', '..', 'browser', 'setup.js');
39
30
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/vite/server.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM1C,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAA;AAGpC,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,MAAM,CAAA;AAQvD,OAAO,KAAK,EAAgB,gBAAgB,EAA6E,MAAM,YAAY,CAAA;AAY3I,qBAAa,UAAW,SAAQ,YAAY;;IAQxC,IAAI,YAAY,gCAEf;IAED,IAAI,MAAM,0BAET;gBAEY,OAAO,EAAE,WAAW,CAAC,oBAAoB;IAkBhD,KAAK;IAwCL,KAAK;IAmIX,OAAO,CAAC,cAAc;IAetB,WAAW,CAAE,MAAM,EAAE,gBAAgB;CAUxC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/vite/server.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM1C,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAA;AAGpC,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,MAAM,CAAA;AAQvD,OAAO,KAAK,EAAgB,gBAAgB,EAA6E,MAAM,YAAY,CAAA;AAY3I,qBAAa,UAAW,SAAQ,YAAY;;IAQxC,IAAI,YAAY,gCAEf;IAED,IAAI,MAAM,0BAET;gBAEY,OAAO,EAAE,WAAW,CAAC,oBAAoB;IAkBhD,KAAK;IAwCL,KAAK;IA2IX,OAAO,CAAC,cAAc;IAetB,WAAW,CAAE,MAAM,EAAE,gBAAgB;CAUxC"}
@@ -139,7 +139,7 @@ export class ViteServer extends EventEmitter {
139
139
  return ws.send(JSON.stringify(this.#hookResponse(result)));
140
140
  }
141
141
  async #handleCommand(ws, payload) {
142
- log.info(`Received browser message: ${payload}`);
142
+ log.debug(`Received browser message: ${JSON.stringify(payload)}`);
143
143
  const cid = payload.cid;
144
144
  if (typeof cid !== 'string') {
145
145
  const error = serializeError(new Error(`No "cid" property passed into command message with id "${payload.id}"`));
@@ -157,6 +157,12 @@ export class ViteServer extends EventEmitter {
157
157
  if (payload.commandName === 'debug') {
158
158
  this.emit('debugState', true);
159
159
  }
160
+ /**
161
+ * double check if function is registered
162
+ */
163
+ if (typeof browser[payload.commandName] !== 'function') {
164
+ throw new Error(`browser.${payload.commandName} is not a function`);
165
+ }
160
166
  const result = await browser[payload.commandName](...payload.args);
161
167
  const resultMsg = JSON.stringify(this.#commandResponse({ id: payload.id, result }));
162
168
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/vite/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE/D,wBAAsB,WAAW,CAAE,OAAO,EAAE,WAAW,CAAC,oBAAoB,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,mBA6D3G;AAED,wBAAsB,kBAAkB,CAAE,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,MAAM,gBAa9E;AAED,wBAAgB,gBAAgB,CAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,UAU/D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/vite/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE/D,wBAAsB,WAAW,CAAE,OAAO,EAAE,WAAW,CAAC,oBAAoB,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,mBAoE3G;AAED,wBAAsB,kBAAkB,CAAE,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,MAAM,gBAa9E;AAED,wBAAgB,gBAAgB,CAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,UAU/D"}
@@ -51,6 +51,13 @@ export async function getTemplate(options, env, spec) {
51
51
  filename: ev.filename,
52
52
  message: ev.message
53
53
  }))
54
+ /**
55
+ * mock process
56
+ */
57
+ window.process = {
58
+ platform: 'browser',
59
+ env: {}
60
+ }
54
61
  </script>
55
62
  ${vueDeps}
56
63
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/browser-runner",
3
- "version": "8.2.3",
3
+ "version": "8.2.6",
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",
@@ -28,11 +28,10 @@
28
28
  "typeScriptVersion": "3.8.3",
29
29
  "dependencies": {
30
30
  "@babel/plugin-proposal-class-properties": "^7.18.6",
31
- "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
32
31
  "@originjs/vite-plugin-commonjs": "^1.0.3",
33
32
  "@types/node": "^18.11.18",
34
- "@wdio/globals": "8.2.3",
35
- "@wdio/local-runner": "8.2.3",
33
+ "@wdio/globals": "8.2.6",
34
+ "@wdio/local-runner": "8.2.6",
36
35
  "@wdio/logger": "8.1.0",
37
36
  "@wdio/mocha-framework": "8.2.3",
38
37
  "@wdio/protocols": "8.2.0",
@@ -47,7 +46,7 @@
47
46
  "vite": "^4.0.4",
48
47
  "vite-plugin-top-level-await": "^1.2.2",
49
48
  "webdriver": "8.2.3",
50
- "webdriverio": "8.2.3",
49
+ "webdriverio": "8.2.6",
51
50
  "ws": "^8.12.0"
52
51
  },
53
52
  "scripts": {
@@ -58,7 +57,7 @@
58
57
  },
59
58
  "devDependencies": {
60
59
  "@types/ws": "^8.5.4",
61
- "@wdio/runner": "8.2.3"
60
+ "@wdio/runner": "8.2.6"
62
61
  },
63
- "gitHead": "a2b32de5459e815ff2ca6db923386d345acdc084"
62
+ "gitHead": "82c01b9fcf03c477505fd3afed777ce7b227567b"
64
63
  }