@wdio/browser-runner 8.16.0 → 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":"
|
|
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"}
|
package/build/browser/driver.js
CHANGED
|
@@ -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
|
|
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'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/browser-runner",
|
|
3
|
-
"version": "8.16.
|
|
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,8 +35,8 @@
|
|
|
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.16.
|
|
39
|
-
"@wdio/local-runner": "8.16.
|
|
38
|
+
"@wdio/globals": "8.16.2",
|
|
39
|
+
"@wdio/local-runner": "8.16.2",
|
|
40
40
|
"@wdio/logger": "8.11.0",
|
|
41
41
|
"@wdio/mocha-framework": "8.16.0",
|
|
42
42
|
"@wdio/protocols": "8.14.6",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"vite-plugin-istanbul": "^5.0.0",
|
|
62
62
|
"vite-plugin-top-level-await": "^1.3.0",
|
|
63
63
|
"webdriver": "8.16.0",
|
|
64
|
-
"webdriverio": "8.16.
|
|
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.16.
|
|
75
|
+
"@wdio/runner": "8.16.2"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "103470cf452a582f9a1f3678c260575e08bf6c37"
|
|
78
78
|
}
|