@wdio/browser-runner 9.0.0-alpha.9 → 9.0.0
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.
- package/build/browser/driver.d.ts +1 -1
- package/build/browser/driver.d.ts.map +1 -1
- package/build/browser/driver.js +249 -177
- package/build/browser/expect.js +107 -148
- package/build/browser/frameworks/mocha.d.ts.map +1 -1
- package/build/browser/integrations/stencil.js +370 -407
- package/build/browser/mock.d.ts +3 -2
- package/build/browser/mock.d.ts.map +1 -1
- package/build/browser/mock.js +78 -34
- package/build/browser/setup.js +313 -37
- package/build/browser/spy.d.ts.map +1 -1
- package/build/browser/spy.js +29 -40
- package/build/browser/utils.d.ts +7 -0
- package/build/browser/utils.d.ts.map +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1465 -171
- package/build/types.d.ts +19 -2
- package/build/types.d.ts.map +1 -1
- package/build/utils.d.ts +3 -3
- package/build/utils.d.ts.map +1 -1
- package/build/vite/constants.d.ts +3 -0
- package/build/vite/constants.d.ts.map +1 -1
- package/build/vite/frameworks/stencil.d.ts.map +1 -1
- package/build/vite/plugins/esbuild.d.ts.map +1 -1
- package/build/vite/plugins/testrunner.d.ts.map +1 -1
- package/build/vite/server.d.ts +0 -1
- package/build/vite/server.d.ts.map +1 -1
- package/build/vite/utils.d.ts.map +1 -1
- package/package.json +68 -37
- package/build/browser/commands/debug.js +0 -6
- package/build/browser/frameworks/mocha.js +0 -320
- package/build/browser/utils.js +0 -61
- package/build/communicator.js +0 -82
- package/build/constants.js +0 -89
- package/build/types.js +0 -1
- package/build/utils.js +0 -86
- package/build/vite/constants.js +0 -55
- package/build/vite/frameworks/index.js +0 -19
- package/build/vite/frameworks/nuxt.js +0 -61
- package/build/vite/frameworks/stencil.js +0 -156
- package/build/vite/frameworks/tailwindcss.js +0 -28
- package/build/vite/mock.js +0 -50
- package/build/vite/plugins/esbuild.js +0 -25
- package/build/vite/plugins/mockHoisting.js +0 -312
- package/build/vite/plugins/testrunner.js +0 -152
- package/build/vite/plugins/worker.js +0 -12
- package/build/vite/server.js +0 -104
- package/build/vite/types.js +0 -1
- package/build/vite/utils.js +0 -223
- /package/{LICENSE-MIT → LICENSE} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default class ProxyDriver {
|
|
2
2
|
#private;
|
|
3
|
-
static newSession(params: any, modifier: never, userPrototype: Record<string, PropertyDescriptor>, commandWrapper: any): any
|
|
3
|
+
static newSession(params: any, modifier: never, userPrototype: Record<string, PropertyDescriptor>, commandWrapper: any): Promise<any>;
|
|
4
4
|
}
|
|
5
5
|
//# sourceMappingURL=driver.d.ts.map
|
|
@@ -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":"AA6BA,MAAM,CAAC,OAAO,OAAO,WAAW;;WAGf,UAAU,CACnB,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,KAAK,EACf,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACjD,cAAc,EAAE,GAAG;CA0P1B"}
|
package/build/browser/driver.js
CHANGED
|
@@ -1,185 +1,257 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
prev[commandName] = {
|
|
37
|
-
value: this.#getMockedCommand(commandName)
|
|
38
|
-
};
|
|
39
|
-
return prev;
|
|
40
|
-
}, {});
|
|
41
|
-
/**
|
|
42
|
-
* handle certain commands on the server side
|
|
43
|
-
*/
|
|
44
|
-
delete userPrototype.debug;
|
|
45
|
-
delete userPrototype.saveScreenshot;
|
|
46
|
-
delete userPrototype.savePDF;
|
|
47
|
-
const prototype = {
|
|
48
|
-
/**
|
|
49
|
-
* custom protocol commands that communicate with Vite
|
|
50
|
-
*/
|
|
51
|
-
...protocolCommands,
|
|
52
|
-
/**
|
|
53
|
-
* environment flags
|
|
54
|
-
*/
|
|
55
|
-
...environmentPrototype,
|
|
56
|
-
/**
|
|
57
|
-
* unmodified WebdriverIO commands
|
|
58
|
-
*/
|
|
59
|
-
...userPrototype
|
|
60
|
-
};
|
|
61
|
-
prototype.emit = { writable: true, value: () => { } };
|
|
62
|
-
prototype.on = { writable: true, value: () => { } };
|
|
63
|
-
/**
|
|
64
|
-
* register helper function to pass command execution into Node.js context
|
|
65
|
-
*/
|
|
66
|
-
globalThis.wdio = {
|
|
67
|
-
execute: (commandName, ...args) => {
|
|
68
|
-
return this.#getMockedCommand(commandName)(...args);
|
|
69
|
-
},
|
|
70
|
-
executeWithScope: (commandName, scope, ...args) => {
|
|
71
|
-
return this.#getMockedCommand(commandName, scope)(...args);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
const monad = webdriverMonad(params, modifier, prototype);
|
|
75
|
-
return monad(window.__wdioEnv__.sessionId, commandWrapper);
|
|
1
|
+
var __typeError = (msg) => {
|
|
2
|
+
throw TypeError(msg);
|
|
3
|
+
};
|
|
4
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
5
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
7
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
8
|
+
|
|
9
|
+
// src/browser/driver.ts
|
|
10
|
+
import { commands } from "virtual:wdio";
|
|
11
|
+
import { webdriverMonad, sessionEnvironmentDetector } from "@wdio/utils";
|
|
12
|
+
import { getEnvironmentVars, initiateBidi, parseBidiMessage } from "webdriver";
|
|
13
|
+
import { MESSAGE_TYPES } from "@wdio/types";
|
|
14
|
+
import { browser } from "@wdio/globals";
|
|
15
|
+
import safeStringify from "safe-stringify";
|
|
16
|
+
import EventEmitter from "events";
|
|
17
|
+
|
|
18
|
+
// src/browser/utils.ts
|
|
19
|
+
function getCID() {
|
|
20
|
+
var _a;
|
|
21
|
+
const urlParamString = new URLSearchParams(window.location.search);
|
|
22
|
+
const cid = (
|
|
23
|
+
// initial request contains cid as query parameter
|
|
24
|
+
urlParamString.get("cid") || // if not provided check for document cookie, set by `@wdio/runner` package
|
|
25
|
+
((_a = (document.cookie.split(";") || []).find((c) => c.includes("WDIO_CID"))) == null ? void 0 : _a.trim().split("=").pop())
|
|
26
|
+
);
|
|
27
|
+
if (!cid) {
|
|
28
|
+
throw new Error('"cid" query parameter is missing');
|
|
29
|
+
}
|
|
30
|
+
return cid;
|
|
31
|
+
}
|
|
32
|
+
function sanitizeConsoleArgs(args) {
|
|
33
|
+
return args.map((arg) => {
|
|
34
|
+
if (arg === void 0) {
|
|
35
|
+
return "undefined";
|
|
76
36
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
console.log(...(isDebugCommand
|
|
92
|
-
? ['[WDIO] %cDebug Mode Enabled', 'background: #ea5906; color: #fff; padding: 3px; border-radius: 5px;']
|
|
93
|
-
: [`[WDIO] ${(new Date()).toISOString()} - id: ${id} - COMMAND: ${commandName}(${args.join(', ')})`]));
|
|
94
|
-
if (HIDE_REPORTER_FOR_COMMANDS.includes(commandName) && mochaFramework) {
|
|
95
|
-
mochaFramework.setAttribute('style', 'display: none');
|
|
96
|
-
}
|
|
97
|
-
const cid = getCID();
|
|
98
|
-
import.meta.hot.send(WDIO_EVENT_NAME, this.#commandRequest({
|
|
99
|
-
commandName,
|
|
100
|
-
cid,
|
|
101
|
-
id,
|
|
102
|
-
args,
|
|
103
|
-
scope
|
|
104
|
-
}));
|
|
105
|
-
return new Promise((resolve, reject) => {
|
|
106
|
-
let commandTimeout;
|
|
107
|
-
if (!isDebugCommand) {
|
|
108
|
-
commandTimeout = setTimeout(() => reject(new Error(`Command "${commandName}" timed out`)), COMMAND_TIMEOUT);
|
|
109
|
-
}
|
|
110
|
-
this.#commandMessages.set(id, { resolve, reject, commandTimeout, commandName });
|
|
111
|
-
});
|
|
112
|
-
};
|
|
37
|
+
try {
|
|
38
|
+
if (arg && typeof arg.selector === "string" && arg.error) {
|
|
39
|
+
return 'WebdriverIO.Element<"'.concat(arg.selector, '">');
|
|
40
|
+
}
|
|
41
|
+
if (arg && typeof arg.selector === "string" && typeof arg.length === "number") {
|
|
42
|
+
return "WebdriverIO.ElementArray<".concat(arg.length, 'x "').concat(arg.selector, '">');
|
|
43
|
+
}
|
|
44
|
+
if (arg && typeof arg.selector === "string") {
|
|
45
|
+
return 'WebdriverIO.Element<"'.concat(arg.selector, '">');
|
|
46
|
+
}
|
|
47
|
+
if (arg && typeof arg.sessionId === "string") {
|
|
48
|
+
return "WebdriverIO.Browser<".concat(arg.capabilities.browserName, ">");
|
|
49
|
+
}
|
|
50
|
+
} catch (err) {
|
|
113
51
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return this.#handleCommandResponse(payload.value);
|
|
117
|
-
}
|
|
118
|
-
if (payload.type === MESSAGE_TYPES.initiateBrowserStateResponse) {
|
|
119
|
-
return this.#handleBrowserInitiation(payload.value);
|
|
120
|
-
}
|
|
52
|
+
if (arg instanceof HTMLElement || arg && typeof arg === "object" && typeof arg.then === "function" || typeof arg === "function") {
|
|
53
|
+
return arg.toString();
|
|
121
54
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return console.error(`Message without id: ${JSON.stringify(value)}`);
|
|
125
|
-
}
|
|
126
|
-
const commandMessage = this.#commandMessages.get(value.id);
|
|
127
|
-
if (!commandMessage) {
|
|
128
|
-
return console.error(`Unknown command id "${value.id}"`);
|
|
129
|
-
}
|
|
130
|
-
if (HIDE_REPORTER_FOR_COMMANDS.includes(commandMessage.commandName) && mochaFramework) {
|
|
131
|
-
mochaFramework.removeAttribute('style');
|
|
132
|
-
}
|
|
133
|
-
if (value.error) {
|
|
134
|
-
console.log(`[WDIO] ${(new Date()).toISOString()} - id: ${value.id} - ERROR: ${JSON.stringify(value.error.message)}`);
|
|
135
|
-
return commandMessage.reject(new Error(value.error.message || 'unknown error'));
|
|
136
|
-
}
|
|
137
|
-
if (commandMessage.commandTimeout) {
|
|
138
|
-
clearTimeout(commandMessage.commandTimeout);
|
|
139
|
-
}
|
|
140
|
-
console.log(`[WDIO] ${(new Date()).toISOString()} - id: ${value.id} - RESULT: ${JSON.stringify(value.result)}`);
|
|
141
|
-
commandMessage.resolve(value.result);
|
|
142
|
-
this.#commandMessages.delete(value.id);
|
|
55
|
+
if (arg instanceof Error) {
|
|
56
|
+
return arg.stack;
|
|
143
57
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
58
|
+
return arg;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/constants.ts
|
|
63
|
+
var WDIO_EVENT_NAME = "wdio:workerMessage";
|
|
64
|
+
|
|
65
|
+
// src/browser/driver.ts
|
|
66
|
+
var COMMAND_TIMEOUT = 30 * 1e3;
|
|
67
|
+
var CONSOLE_METHODS = ["log", "info", "warn", "error", "debug"];
|
|
68
|
+
var HIDE_REPORTER_FOR_COMMANDS = ["saveScreenshot", "savePDF"];
|
|
69
|
+
var mochaFramework = document.querySelector("mocha-framework");
|
|
70
|
+
var id = 0;
|
|
71
|
+
var _commandMessages, _ProxyDriver_static, getMockedCommand_fn, handleServerMessage_fn, handleCommandResponse_fn, handleBrowserInitiation_fn, wrapConsolePrototype_fn, commandRequest_fn, consoleMessage_fn;
|
|
72
|
+
var ProxyDriver = class {
|
|
73
|
+
static async newSession(params, modifier, userPrototype, commandWrapper) {
|
|
74
|
+
var _a, _b, _c;
|
|
75
|
+
const cid = getCID();
|
|
76
|
+
__privateMethod(this, _ProxyDriver_static, wrapConsolePrototype_fn).call(this, cid);
|
|
77
|
+
(_a = import.meta.hot) == null ? void 0 : _a.on(WDIO_EVENT_NAME, (payload) => {
|
|
78
|
+
try {
|
|
79
|
+
__privateMethod(this, _ProxyDriver_static, handleServerMessage_fn).call(this, payload);
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.error("Error in handling message: ".concat(err.stack));
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const environment = sessionEnvironmentDetector({ capabilities: params.capabilities, requestedCapabilities: {} });
|
|
85
|
+
const environmentPrototype = getEnvironmentVars(environment);
|
|
86
|
+
const commandsProcessedInNodeWorld = [...commands, "debug", "saveScreenshot", "savePDF", "emulate", "restore"];
|
|
87
|
+
const protocolCommands = commandsProcessedInNodeWorld.reduce((prev, commandName) => {
|
|
88
|
+
prev[commandName] = {
|
|
89
|
+
value: __privateMethod(this, _ProxyDriver_static, getMockedCommand_fn).call(this, commandName)
|
|
90
|
+
};
|
|
91
|
+
return prev;
|
|
92
|
+
}, {});
|
|
93
|
+
delete userPrototype.debug;
|
|
94
|
+
delete userPrototype.saveScreenshot;
|
|
95
|
+
delete userPrototype.savePDF;
|
|
96
|
+
const bidiPrototype = {};
|
|
97
|
+
const webSocketUrl = "alwaysMatch" in params.capabilities ? (_b = params.capabilities.alwaysMatch) == null ? void 0 : _b.webSocketUrl : params.capabilities.webSocketUrl;
|
|
98
|
+
if (webSocketUrl) {
|
|
99
|
+
Object.assign(bidiPrototype, initiateBidi(webSocketUrl));
|
|
158
100
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
101
|
+
const ee = new EventEmitter();
|
|
102
|
+
const eventPrototype = {
|
|
103
|
+
emit: { value: ee.emit.bind(ee) },
|
|
104
|
+
on: { value: ee.on.bind(ee) },
|
|
105
|
+
once: { value: ee.once.bind(ee) },
|
|
106
|
+
removeListener: { value: ee.removeListener.bind(ee) },
|
|
107
|
+
removeAllListeners: { value: ee.removeAllListeners.bind(ee) },
|
|
108
|
+
off: { value: ee.off.bind(ee) }
|
|
109
|
+
};
|
|
110
|
+
const prototype = {
|
|
111
|
+
/**
|
|
112
|
+
* custom protocol commands that communicate with Vite
|
|
113
|
+
*/
|
|
114
|
+
...protocolCommands,
|
|
115
|
+
/**
|
|
116
|
+
* environment flags
|
|
117
|
+
*/
|
|
118
|
+
...environmentPrototype,
|
|
119
|
+
/**
|
|
120
|
+
* unmodified WebdriverIO commands
|
|
121
|
+
*/
|
|
122
|
+
...userPrototype,
|
|
123
|
+
/**
|
|
124
|
+
* Bidi commands
|
|
125
|
+
*/
|
|
126
|
+
...bidiPrototype,
|
|
127
|
+
/**
|
|
128
|
+
* event emitter commands
|
|
129
|
+
*/
|
|
130
|
+
...eventPrototype
|
|
131
|
+
};
|
|
132
|
+
globalThis.wdio = {
|
|
133
|
+
execute: (commandName, ...args) => {
|
|
134
|
+
return __privateMethod(this, _ProxyDriver_static, getMockedCommand_fn).call(this, commandName)(...args);
|
|
135
|
+
},
|
|
136
|
+
executeWithScope: (commandName, scope, ...args) => {
|
|
137
|
+
return __privateMethod(this, _ProxyDriver_static, getMockedCommand_fn).call(this, commandName, scope)(...args);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const monad = webdriverMonad(params, modifier, prototype);
|
|
141
|
+
const client = monad(window.__wdioEnv__.sessionId, commandWrapper);
|
|
142
|
+
if (params.capabilities.webSocketUrl && client._bidiHandler) {
|
|
143
|
+
await client._bidiHandler.connect();
|
|
144
|
+
client._bidiHandler.socket.on("message", parseBidiMessage.bind(client));
|
|
172
145
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
146
|
+
(_c = import.meta.hot) == null ? void 0 : _c.send(WDIO_EVENT_NAME, {
|
|
147
|
+
type: MESSAGE_TYPES.initiateBrowserStateRequest,
|
|
148
|
+
value: { cid }
|
|
149
|
+
});
|
|
150
|
+
return client;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
_commandMessages = new WeakMap();
|
|
154
|
+
_ProxyDriver_static = new WeakSet();
|
|
155
|
+
getMockedCommand_fn = function(commandName, scope) {
|
|
156
|
+
const isDebugCommand = commandName === "debug";
|
|
157
|
+
return async (...args) => {
|
|
158
|
+
if (!import.meta.hot) {
|
|
159
|
+
throw new Error("Could not connect to testrunner");
|
|
178
160
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
};
|
|
161
|
+
id++;
|
|
162
|
+
console.log(...isDebugCommand ? ["[WDIO] %cDebug Mode Enabled", "background: #ea5906; color: #fff; padding: 3px; border-radius: 5px;"] : ["[WDIO] ".concat((/* @__PURE__ */ new Date()).toISOString(), " - id: ").concat(id, " - COMMAND: ").concat(commandName, "(").concat(args.join(", "), ")")]);
|
|
163
|
+
if (HIDE_REPORTER_FOR_COMMANDS.includes(commandName) && mochaFramework) {
|
|
164
|
+
mochaFramework.setAttribute("style", "display: none");
|
|
184
165
|
}
|
|
185
|
-
|
|
166
|
+
const cid = getCID();
|
|
167
|
+
import.meta.hot.send(WDIO_EVENT_NAME, __privateMethod(this, _ProxyDriver_static, commandRequest_fn).call(this, {
|
|
168
|
+
commandName,
|
|
169
|
+
cid,
|
|
170
|
+
id,
|
|
171
|
+
args,
|
|
172
|
+
scope
|
|
173
|
+
}));
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
175
|
+
let commandTimeout;
|
|
176
|
+
if (!isDebugCommand) {
|
|
177
|
+
commandTimeout = setTimeout(
|
|
178
|
+
() => reject(new Error('Command "'.concat(commandName, '" timed out'))),
|
|
179
|
+
COMMAND_TIMEOUT
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
__privateGet(this, _commandMessages).set(id, { resolve, reject, commandTimeout, commandName });
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
handleServerMessage_fn = function(payload) {
|
|
187
|
+
if (payload.type === MESSAGE_TYPES.commandResponseMessage) {
|
|
188
|
+
return __privateMethod(this, _ProxyDriver_static, handleCommandResponse_fn).call(this, payload.value);
|
|
189
|
+
}
|
|
190
|
+
if (payload.type === MESSAGE_TYPES.initiateBrowserStateResponse) {
|
|
191
|
+
return __privateMethod(this, _ProxyDriver_static, handleBrowserInitiation_fn).call(this, payload.value);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
handleCommandResponse_fn = function(value) {
|
|
195
|
+
if (!value.id) {
|
|
196
|
+
return console.error("Message without id: ".concat(JSON.stringify(value)));
|
|
197
|
+
}
|
|
198
|
+
const commandMessage = __privateGet(this, _commandMessages).get(value.id);
|
|
199
|
+
if (!commandMessage) {
|
|
200
|
+
return console.error('Unknown command id "'.concat(value.id, '"'));
|
|
201
|
+
}
|
|
202
|
+
if (HIDE_REPORTER_FOR_COMMANDS.includes(commandMessage.commandName) && mochaFramework) {
|
|
203
|
+
mochaFramework.removeAttribute("style");
|
|
204
|
+
}
|
|
205
|
+
if (value.error) {
|
|
206
|
+
console.log("[WDIO] ".concat((/* @__PURE__ */ new Date()).toISOString(), " - id: ").concat(value.id, " - ERROR: ").concat(JSON.stringify(value.error.message)));
|
|
207
|
+
value.error.message = value.error.message || "unknown error";
|
|
208
|
+
return commandMessage.reject(value.error);
|
|
209
|
+
}
|
|
210
|
+
if (commandMessage.commandTimeout) {
|
|
211
|
+
clearTimeout(commandMessage.commandTimeout);
|
|
212
|
+
}
|
|
213
|
+
console.log("[WDIO] ".concat((/* @__PURE__ */ new Date()).toISOString(), " - id: ").concat(value.id, " - RESULT: ").concat(JSON.stringify(value.result)));
|
|
214
|
+
commandMessage.resolve(value.result);
|
|
215
|
+
__privateGet(this, _commandMessages).delete(value.id);
|
|
216
|
+
};
|
|
217
|
+
handleBrowserInitiation_fn = function(value) {
|
|
218
|
+
const cid = getCID();
|
|
219
|
+
if (!cid) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
for (const commandName of value.customCommands) {
|
|
223
|
+
browser.addCommand(commandName, __privateMethod(this, _ProxyDriver_static, getMockedCommand_fn).call(this, commandName));
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
wrapConsolePrototype_fn = function(cid) {
|
|
227
|
+
for (const method of CONSOLE_METHODS) {
|
|
228
|
+
const origCommand = console[method].bind(console);
|
|
229
|
+
console[method] = (...args) => {
|
|
230
|
+
var _a;
|
|
231
|
+
(_a = import.meta.hot) == null ? void 0 : _a.send(WDIO_EVENT_NAME, __privateMethod(this, _ProxyDriver_static, consoleMessage_fn).call(this, {
|
|
232
|
+
name: "consoleEvent",
|
|
233
|
+
type: method,
|
|
234
|
+
args: JSON.parse(safeStringify(sanitizeConsoleArgs(args))),
|
|
235
|
+
cid
|
|
236
|
+
}));
|
|
237
|
+
origCommand(...args);
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
commandRequest_fn = function(value) {
|
|
242
|
+
return {
|
|
243
|
+
type: MESSAGE_TYPES.commandRequestMessage,
|
|
244
|
+
value
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
consoleMessage_fn = function(value) {
|
|
248
|
+
return {
|
|
249
|
+
type: MESSAGE_TYPES.consoleMessage,
|
|
250
|
+
value
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
__privateAdd(ProxyDriver, _ProxyDriver_static);
|
|
254
|
+
__privateAdd(ProxyDriver, _commandMessages, /* @__PURE__ */ new Map());
|
|
255
|
+
export {
|
|
256
|
+
ProxyDriver as default
|
|
257
|
+
};
|