brave-real-playwright-core 1.56.1 → 1.57.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/README.md +5 -5
- package/advanced-stealth.js +1 -1
- package/lib/cli/program.js +14 -57
- package/lib/client/api.js +0 -3
- package/lib/client/browserContext.js +22 -4
- package/lib/client/consoleMessage.js +5 -1
- package/lib/client/electron.js +1 -1
- package/lib/client/events.js +2 -1
- package/lib/client/locator.js +4 -1
- package/lib/client/page.js +2 -5
- package/lib/client/playwright.js +1 -5
- package/lib/client/tracing.js +6 -4
- package/lib/client/worker.js +22 -0
- package/lib/generated/clockSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +1 -1
- package/lib/inProcessFactory.js +0 -2
- package/lib/protocol/validator.js +24 -46
- package/lib/server/android/android.js +1 -1
- package/lib/server/bidi/bidiBrowser.js +26 -11
- package/lib/server/bidi/bidiChromium.js +1 -1
- package/lib/server/bidi/bidiFirefox.js +1 -1
- package/lib/server/bidi/bidiPage.js +25 -5
- package/lib/server/browserContext.js +9 -10
- package/lib/server/chromium/chromium.js +12 -1
- package/lib/server/chromium/chromiumSwitches.js +11 -2
- package/lib/server/chromium/crBrowser.js +8 -0
- package/lib/server/chromium/crPage.js +7 -7
- package/lib/server/chromium/crServiceWorker.js +16 -5
- package/lib/server/chromium/videoRecorder.js +14 -12
- package/lib/server/console.js +5 -1
- package/lib/server/deviceDescriptorsSource.json +56 -56
- package/lib/server/dispatchers/browserContextDispatcher.js +23 -6
- package/lib/server/dispatchers/pageDispatcher.js +10 -22
- package/lib/server/dispatchers/playwrightDispatcher.js +0 -4
- package/lib/server/electron/electron.js +1 -1
- package/lib/server/firefox/ffPage.js +3 -6
- package/lib/server/firefox/firefox.js +12 -1
- package/lib/server/frameSelectors.js +2 -4
- package/lib/server/frames.js +10 -3
- package/lib/server/input.js +7 -3
- package/lib/server/localUtils.js +4 -8
- package/lib/server/page.js +54 -40
- package/lib/server/playwright.js +2 -4
- package/lib/server/recorder/recorderApp.js +1 -1
- package/lib/server/recorder.js +3 -2
- package/lib/server/registry/index.js +113 -47
- package/lib/server/registry/oopDownloadBrowserMain.js +6 -2
- package/lib/server/socksClientCertificatesInterceptor.js +1 -1
- package/lib/server/trace/recorder/tracing.js +2 -0
- package/lib/server/trace/viewer/traceViewer.js +37 -36
- package/lib/server/utils/comparators.js +3 -25
- package/lib/server/utils/hostPlatform.js +15 -3
- package/lib/server/utils/imageUtils.js +141 -0
- package/lib/server/utils/network.js +22 -16
- package/lib/server/webkit/webkit.js +1 -10
- package/lib/server/webkit/wkPage.js +1 -5
- package/lib/server/webkit/wkWorkers.js +2 -1
- package/lib/utils/isomorphic/ariaSnapshot.js +5 -0
- package/lib/utils/isomorphic/locatorGenerators.js +24 -8
- package/lib/utils/isomorphic/mimeType.js +1 -1
- package/lib/utils/isomorphic/protocolFormatter.js +3 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +2 -1
- package/lib/utils/isomorphic/urlMatch.js +19 -5
- package/lib/utils.js +2 -0
- package/lib/utilsBundle.js +6 -3
- package/lib/utilsBundleImpl/index.js +171 -171
- package/lib/vite/htmlReport/index.html +18 -18
- package/lib/vite/recorder/assets/codeMirrorModule-BoWUGj0J.js +25 -0
- package/lib/vite/recorder/assets/{index-Y-X2TGJv.js → index-DJqDAOZp.js} +32 -32
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-Bucv2d7q.js +25 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-BEpdCv1S.js +266 -0
- package/lib/vite/traceViewer/defaultSettingsView.ConWv5KN.css +1 -0
- package/lib/vite/traceViewer/index.BxQ34UMZ.js +2 -0
- package/lib/vite/traceViewer/index.C4Y3Aw8n.css +1 -0
- package/lib/vite/traceViewer/index.html +6 -6
- package/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/lib/vite/traceViewer/snapshot.html +3 -3
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/{uiMode.DRQ310U5.js → uiMode.BWTwXl41.js} +3 -3
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/package.json +9 -9
- package/lib/client/accessibility.js +0 -49
- package/lib/server/accessibility.js +0 -69
- package/lib/server/chromium/crAccessibility.js +0 -263
- package/lib/server/firefox/ffAccessibility.js +0 -238
- package/lib/server/webkit/wkAccessibility.js +0 -237
- package/lib/server/webkit/wsl/webkit-wsl-transport-client.js +0 -74
- package/lib/server/webkit/wsl/webkit-wsl-transport-server.js +0 -113
- package/lib/vite/recorder/assets/codeMirrorModule-RJCXzfmE.js +0 -24
- package/lib/vite/traceViewer/assets/codeMirrorModule-eyVcHN77.js +0 -24
- package/lib/vite/traceViewer/assets/defaultSettingsView-w0zYjHsW.js +0 -265
- package/lib/vite/traceViewer/defaultSettingsView.TQ8_7ybu.css +0 -1
- package/lib/vite/traceViewer/index.Bx16ehp1.js +0 -2
- package/lib/vite/traceViewer/index.I8N9v4jT.css +0 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var imageUtils_exports = {};
|
|
20
|
+
__export(imageUtils_exports, {
|
|
21
|
+
padImageToSize: () => padImageToSize,
|
|
22
|
+
scaleImageToSize: () => scaleImageToSize
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(imageUtils_exports);
|
|
25
|
+
function padImageToSize(image, size) {
|
|
26
|
+
if (image.width === size.width && image.height === size.height)
|
|
27
|
+
return image;
|
|
28
|
+
const buffer = new Uint8Array(size.width * size.height * 4);
|
|
29
|
+
for (let y = 0; y < size.height; y++) {
|
|
30
|
+
for (let x = 0; x < size.width; x++) {
|
|
31
|
+
const to = (y * size.width + x) * 4;
|
|
32
|
+
if (y < image.height && x < image.width) {
|
|
33
|
+
const from = (y * image.width + x) * 4;
|
|
34
|
+
buffer[to] = image.data[from];
|
|
35
|
+
buffer[to + 1] = image.data[from + 1];
|
|
36
|
+
buffer[to + 2] = image.data[from + 2];
|
|
37
|
+
buffer[to + 3] = image.data[from + 3];
|
|
38
|
+
} else {
|
|
39
|
+
buffer[to] = 0;
|
|
40
|
+
buffer[to + 1] = 0;
|
|
41
|
+
buffer[to + 2] = 0;
|
|
42
|
+
buffer[to + 3] = 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { data: Buffer.from(buffer), width: size.width, height: size.height };
|
|
47
|
+
}
|
|
48
|
+
function scaleImageToSize(image, size) {
|
|
49
|
+
const { data: src, width: w1, height: h1 } = image;
|
|
50
|
+
const w2 = Math.max(1, Math.floor(size.width));
|
|
51
|
+
const h2 = Math.max(1, Math.floor(size.height));
|
|
52
|
+
if (w1 === w2 && h1 === h2)
|
|
53
|
+
return image;
|
|
54
|
+
if (w1 <= 0 || h1 <= 0)
|
|
55
|
+
throw new Error("Invalid input image");
|
|
56
|
+
if (size.width <= 0 || size.height <= 0 || !isFinite(size.width) || !isFinite(size.height))
|
|
57
|
+
throw new Error("Invalid output dimensions");
|
|
58
|
+
const clamp = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
|
|
59
|
+
const weights = (t, o) => {
|
|
60
|
+
const t2 = t * t, t3 = t2 * t;
|
|
61
|
+
o[0] = -0.5 * t + 1 * t2 - 0.5 * t3;
|
|
62
|
+
o[1] = 1 - 2.5 * t2 + 1.5 * t3;
|
|
63
|
+
o[2] = 0.5 * t + 2 * t2 - 1.5 * t3;
|
|
64
|
+
o[3] = -0.5 * t2 + 0.5 * t3;
|
|
65
|
+
};
|
|
66
|
+
const srcRowStride = w1 * 4;
|
|
67
|
+
const dstRowStride = w2 * 4;
|
|
68
|
+
const xOff = new Int32Array(w2 * 4);
|
|
69
|
+
const xW = new Float32Array(w2 * 4);
|
|
70
|
+
const wx = new Float32Array(4);
|
|
71
|
+
const xScale = w1 / w2;
|
|
72
|
+
for (let x = 0; x < w2; x++) {
|
|
73
|
+
const sx = (x + 0.5) * xScale - 0.5;
|
|
74
|
+
const sxi = Math.floor(sx);
|
|
75
|
+
const t = sx - sxi;
|
|
76
|
+
weights(t, wx);
|
|
77
|
+
const b = x * 4;
|
|
78
|
+
const i0 = clamp(sxi - 1, 0, w1 - 1);
|
|
79
|
+
const i1 = clamp(sxi + 0, 0, w1 - 1);
|
|
80
|
+
const i2 = clamp(sxi + 1, 0, w1 - 1);
|
|
81
|
+
const i3 = clamp(sxi + 2, 0, w1 - 1);
|
|
82
|
+
xOff[b + 0] = i0 << 2;
|
|
83
|
+
xOff[b + 1] = i1 << 2;
|
|
84
|
+
xOff[b + 2] = i2 << 2;
|
|
85
|
+
xOff[b + 3] = i3 << 2;
|
|
86
|
+
xW[b + 0] = wx[0];
|
|
87
|
+
xW[b + 1] = wx[1];
|
|
88
|
+
xW[b + 2] = wx[2];
|
|
89
|
+
xW[b + 3] = wx[3];
|
|
90
|
+
}
|
|
91
|
+
const yRow = new Int32Array(h2 * 4);
|
|
92
|
+
const yW = new Float32Array(h2 * 4);
|
|
93
|
+
const wy = new Float32Array(4);
|
|
94
|
+
const yScale = h1 / h2;
|
|
95
|
+
for (let y = 0; y < h2; y++) {
|
|
96
|
+
const sy = (y + 0.5) * yScale - 0.5;
|
|
97
|
+
const syi = Math.floor(sy);
|
|
98
|
+
const t = sy - syi;
|
|
99
|
+
weights(t, wy);
|
|
100
|
+
const b = y * 4;
|
|
101
|
+
const j0 = clamp(syi - 1, 0, h1 - 1);
|
|
102
|
+
const j1 = clamp(syi + 0, 0, h1 - 1);
|
|
103
|
+
const j2 = clamp(syi + 1, 0, h1 - 1);
|
|
104
|
+
const j3 = clamp(syi + 2, 0, h1 - 1);
|
|
105
|
+
yRow[b + 0] = j0 * srcRowStride;
|
|
106
|
+
yRow[b + 1] = j1 * srcRowStride;
|
|
107
|
+
yRow[b + 2] = j2 * srcRowStride;
|
|
108
|
+
yRow[b + 3] = j3 * srcRowStride;
|
|
109
|
+
yW[b + 0] = wy[0];
|
|
110
|
+
yW[b + 1] = wy[1];
|
|
111
|
+
yW[b + 2] = wy[2];
|
|
112
|
+
yW[b + 3] = wy[3];
|
|
113
|
+
}
|
|
114
|
+
const dst = new Uint8Array(w2 * h2 * 4);
|
|
115
|
+
for (let y = 0; y < h2; y++) {
|
|
116
|
+
const yb = y * 4;
|
|
117
|
+
const rb0 = yRow[yb + 0], rb1 = yRow[yb + 1], rb2 = yRow[yb + 2], rb3 = yRow[yb + 3];
|
|
118
|
+
const wy0 = yW[yb + 0], wy1 = yW[yb + 1], wy2 = yW[yb + 2], wy3 = yW[yb + 3];
|
|
119
|
+
const dstBase = y * dstRowStride;
|
|
120
|
+
for (let x = 0; x < w2; x++) {
|
|
121
|
+
const xb = x * 4;
|
|
122
|
+
const xo0 = xOff[xb + 0], xo1 = xOff[xb + 1], xo2 = xOff[xb + 2], xo3 = xOff[xb + 3];
|
|
123
|
+
const wx0 = xW[xb + 0], wx1 = xW[xb + 1], wx2 = xW[xb + 2], wx3 = xW[xb + 3];
|
|
124
|
+
const di = dstBase + (x << 2);
|
|
125
|
+
for (let c = 0; c < 4; c++) {
|
|
126
|
+
const r0 = src[rb0 + xo0 + c] * wx0 + src[rb0 + xo1 + c] * wx1 + src[rb0 + xo2 + c] * wx2 + src[rb0 + xo3 + c] * wx3;
|
|
127
|
+
const r1 = src[rb1 + xo0 + c] * wx0 + src[rb1 + xo1 + c] * wx1 + src[rb1 + xo2 + c] * wx2 + src[rb1 + xo3 + c] * wx3;
|
|
128
|
+
const r2 = src[rb2 + xo0 + c] * wx0 + src[rb2 + xo1 + c] * wx1 + src[rb2 + xo2 + c] * wx2 + src[rb2 + xo3 + c] * wx3;
|
|
129
|
+
const r3 = src[rb3 + xo0 + c] * wx0 + src[rb3 + xo1 + c] * wx1 + src[rb3 + xo2 + c] * wx2 + src[rb3 + xo3 + c] * wx3;
|
|
130
|
+
const v = r0 * wy0 + r1 * wy1 + r2 * wy2 + r3 * wy3;
|
|
131
|
+
dst[di + c] = v < 0 ? 0 : v > 255 ? 255 : v | 0;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return { data: Buffer.from(dst.buffer), width: w2, height: h2 };
|
|
136
|
+
}
|
|
137
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
138
|
+
0 && (module.exports = {
|
|
139
|
+
padImageToSize,
|
|
140
|
+
scaleImageToSize
|
|
141
|
+
});
|
|
@@ -58,18 +58,18 @@ function httpRequest(params, onResponse, onError) {
|
|
|
58
58
|
options.rejectUnauthorized = params.rejectUnauthorized;
|
|
59
59
|
const proxyURL = (0, import_utilsBundle.getProxyForUrl)(params.url);
|
|
60
60
|
if (proxyURL) {
|
|
61
|
-
const parsedProxyURL = import_url.default.parse(proxyURL);
|
|
62
61
|
if (params.url.startsWith("http:")) {
|
|
62
|
+
const parsedProxyURL = import_url.default.parse(proxyURL);
|
|
63
63
|
options = {
|
|
64
64
|
path: parsedUrl.href,
|
|
65
65
|
host: parsedProxyURL.hostname,
|
|
66
66
|
port: parsedProxyURL.port,
|
|
67
|
+
protocol: parsedProxyURL.protocol || "http:",
|
|
67
68
|
headers: options.headers,
|
|
68
69
|
method: options.method
|
|
69
70
|
};
|
|
70
71
|
} else {
|
|
71
|
-
|
|
72
|
-
options.agent = new import_utilsBundle.HttpsProxyAgent(parsedProxyURL);
|
|
72
|
+
options.agent = new import_utilsBundle.HttpsProxyAgent(normalizeProxyURL(proxyURL));
|
|
73
73
|
options.rejectUnauthorized = false;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -134,27 +134,33 @@ function shouldBypassProxy(url2, bypass) {
|
|
|
134
134
|
const domain = "." + url2.hostname;
|
|
135
135
|
return domains.some((d) => domain.endsWith(d));
|
|
136
136
|
}
|
|
137
|
+
function normalizeProxyURL(proxy) {
|
|
138
|
+
proxy = proxy.trim();
|
|
139
|
+
if (!/^\w+:\/\//.test(proxy))
|
|
140
|
+
proxy = "http://" + proxy;
|
|
141
|
+
return new URL(proxy);
|
|
142
|
+
}
|
|
137
143
|
function createProxyAgent(proxy, forUrl) {
|
|
138
144
|
if (!proxy)
|
|
139
145
|
return;
|
|
140
146
|
if (forUrl && proxy.bypass && shouldBypassProxy(forUrl, proxy.bypass))
|
|
141
147
|
return;
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
const proxyURL = normalizeProxyURL(proxy.server);
|
|
149
|
+
if (proxyURL.protocol?.startsWith("socks")) {
|
|
150
|
+
if (proxyURL.protocol === "socks5:")
|
|
151
|
+
proxyURL.protocol = "socks5h:";
|
|
152
|
+
else if (proxyURL.protocol === "socks4:")
|
|
153
|
+
proxyURL.protocol = "socks4a:";
|
|
154
|
+
return new import_utilsBundle.SocksProxyAgent(proxyURL);
|
|
155
|
+
}
|
|
156
|
+
if (proxy.username) {
|
|
157
|
+
proxyURL.username = proxy.username;
|
|
158
|
+
proxyURL.password = proxy.password || "";
|
|
151
159
|
}
|
|
152
|
-
if (proxy.username)
|
|
153
|
-
proxyOpts.auth = `${proxy.username}:${proxy.password || ""}`;
|
|
154
160
|
if (forUrl && ["ws:", "wss:"].includes(forUrl.protocol)) {
|
|
155
|
-
return new import_utilsBundle.HttpsProxyAgent(
|
|
161
|
+
return new import_utilsBundle.HttpsProxyAgent(proxyURL);
|
|
156
162
|
}
|
|
157
|
-
return new import_utilsBundle.HttpsProxyAgent(
|
|
163
|
+
return new import_utilsBundle.HttpsProxyAgent(proxyURL);
|
|
158
164
|
}
|
|
159
165
|
function createHttpServer(...args) {
|
|
160
166
|
const server = import_http.default.createServer(...args);
|
|
@@ -38,7 +38,6 @@ var import_ascii = require("../utils/ascii");
|
|
|
38
38
|
var import_browserType = require("../browserType");
|
|
39
39
|
var import_wkBrowser = require("../webkit/wkBrowser");
|
|
40
40
|
var import_spawnAsync = require("../utils/spawnAsync");
|
|
41
|
-
var import_registry = require("../registry");
|
|
42
41
|
class WebKit extends import_browserType.BrowserType {
|
|
43
42
|
constructor(parent) {
|
|
44
43
|
super(parent, "webkit");
|
|
@@ -49,8 +48,7 @@ class WebKit extends import_browserType.BrowserType {
|
|
|
49
48
|
amendEnvironment(env, userDataDir, isPersistent, options) {
|
|
50
49
|
return {
|
|
51
50
|
...env,
|
|
52
|
-
CURL_COOKIE_JAR_PATH: process.platform === "win32" && isPersistent ? import_path.default.join(userDataDir, "cookiejar.db") : void 0
|
|
53
|
-
WEBKIT_EXECUTABLE: options.channel === "webkit-wsl" ? import_registry.registry.findExecutable("webkit-wsl").wslExecutablePath : void 0
|
|
51
|
+
CURL_COOKIE_JAR_PATH: process.platform === "win32" && isPersistent ? import_path.default.join(userDataDir, "cookiejar.db") : void 0
|
|
54
52
|
};
|
|
55
53
|
}
|
|
56
54
|
doRewriteStartupLog(error) {
|
|
@@ -71,13 +69,6 @@ class WebKit extends import_browserType.BrowserType {
|
|
|
71
69
|
if (args.find((arg) => !arg.startsWith("-")))
|
|
72
70
|
throw new Error("Arguments can not specify page to be opened");
|
|
73
71
|
const webkitArguments = ["--inspector-pipe"];
|
|
74
|
-
if (options.channel === "webkit-wsl") {
|
|
75
|
-
if (options.executablePath)
|
|
76
|
-
throw new Error('Cannot specify executablePath when using the "webkit-wsl" channel.');
|
|
77
|
-
webkitArguments.unshift(
|
|
78
|
-
import_path.default.join(__dirname, "wsl/webkit-wsl-transport-server.js")
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
72
|
if (process.platform === "win32" && options.channel !== "webkit-wsl")
|
|
82
73
|
webkitArguments.push("--disable-accelerated-compositing");
|
|
83
74
|
if (headless)
|
|
@@ -45,7 +45,6 @@ var import_errors = require("../errors");
|
|
|
45
45
|
var import_helper = require("../helper");
|
|
46
46
|
var network = __toESM(require("../network"));
|
|
47
47
|
var import_page = require("../page");
|
|
48
|
-
var import_wkAccessibility = require("./wkAccessibility");
|
|
49
48
|
var import_wkConnection = require("./wkConnection");
|
|
50
49
|
var import_wkExecutionContext = require("./wkExecutionContext");
|
|
51
50
|
var import_wkInput = require("./wkInput");
|
|
@@ -519,7 +518,7 @@ class WKPage {
|
|
|
519
518
|
location
|
|
520
519
|
} = this._lastConsoleMessage;
|
|
521
520
|
for (let i = count; i < event.count; ++i)
|
|
522
|
-
this._page.addConsoleMessage(derivedType, handles, location, handles.length ? void 0 : text);
|
|
521
|
+
this._page.addConsoleMessage(null, derivedType, handles, location, handles.length ? void 0 : text);
|
|
523
522
|
this._lastConsoleMessage.count = event.count;
|
|
524
523
|
}
|
|
525
524
|
}
|
|
@@ -902,9 +901,6 @@ class WKPage {
|
|
|
902
901
|
throw new Error(dom.kUnableToAdoptErrorMessage);
|
|
903
902
|
return (0, import_wkExecutionContext.createHandle)(to, result.object);
|
|
904
903
|
}
|
|
905
|
-
async getAccessibilityTree(needle) {
|
|
906
|
-
return (0, import_wkAccessibility.getAccessibilityTree)(this._session, needle);
|
|
907
|
-
}
|
|
908
904
|
async inputActionEpilogue() {
|
|
909
905
|
}
|
|
910
906
|
async resetForReuse(progress) {
|
|
@@ -47,6 +47,7 @@ class WKWorkers {
|
|
|
47
47
|
});
|
|
48
48
|
this._workerSessions.set(event.workerId, workerSession);
|
|
49
49
|
worker.createExecutionContext(new import_wkExecutionContext.WKExecutionContext(workerSession, void 0));
|
|
50
|
+
worker.workerScriptLoaded();
|
|
50
51
|
this._page.addWorker(event.workerId, worker);
|
|
51
52
|
workerSession.on("Console.messageAdded", (event2) => this._onConsoleMessage(worker, event2));
|
|
52
53
|
Promise.all([
|
|
@@ -95,7 +96,7 @@ class WKWorkers {
|
|
|
95
96
|
lineNumber: (lineNumber || 1) - 1,
|
|
96
97
|
columnNumber: (columnNumber || 1) - 1
|
|
97
98
|
};
|
|
98
|
-
this._page.addConsoleMessage(derivedType, handles, location, handles.length ? void 0 : text);
|
|
99
|
+
this._page.addConsoleMessage(worker, derivedType, handles, location, handles.length ? void 0 : text);
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -20,11 +20,15 @@ var ariaSnapshot_exports = {};
|
|
|
20
20
|
__export(ariaSnapshot_exports, {
|
|
21
21
|
KeyParser: () => KeyParser,
|
|
22
22
|
ParserError: () => ParserError,
|
|
23
|
+
ariaPropsEqual: () => ariaPropsEqual,
|
|
23
24
|
parseAriaSnapshot: () => parseAriaSnapshot,
|
|
24
25
|
parseAriaSnapshotUnsafe: () => parseAriaSnapshotUnsafe,
|
|
25
26
|
textValue: () => textValue
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(ariaSnapshot_exports);
|
|
29
|
+
function ariaPropsEqual(a, b) {
|
|
30
|
+
return a.active === b.active && a.checked === b.checked && a.disabled === b.disabled && a.expanded === b.expanded && a.selected === b.selected && a.level === b.level && a.pressed === b.pressed;
|
|
31
|
+
}
|
|
28
32
|
function parseAriaSnapshotUnsafe(yaml, text, options = {}) {
|
|
29
33
|
const result = parseAriaSnapshot(yaml, text, options);
|
|
30
34
|
if (result.errors.length)
|
|
@@ -386,6 +390,7 @@ class ParserError extends Error {
|
|
|
386
390
|
0 && (module.exports = {
|
|
387
391
|
KeyParser,
|
|
388
392
|
ParserError,
|
|
393
|
+
ariaPropsEqual,
|
|
389
394
|
parseAriaSnapshot,
|
|
390
395
|
parseAriaSnapshotUnsafe,
|
|
391
396
|
textValue
|
|
@@ -25,7 +25,8 @@ __export(locatorGenerators_exports, {
|
|
|
25
25
|
PythonLocatorFactory: () => PythonLocatorFactory,
|
|
26
26
|
asLocator: () => asLocator,
|
|
27
27
|
asLocatorDescription: () => asLocatorDescription,
|
|
28
|
-
asLocators: () => asLocators
|
|
28
|
+
asLocators: () => asLocators,
|
|
29
|
+
locatorCustomDescription: () => locatorCustomDescription
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(locatorGenerators_exports);
|
|
31
32
|
var import_selectorParser = require("./selectorParser");
|
|
@@ -33,17 +34,31 @@ var import_stringUtils = require("./stringUtils");
|
|
|
33
34
|
function asLocatorDescription(lang, selector) {
|
|
34
35
|
try {
|
|
35
36
|
const parsed = (0, import_selectorParser.parseSelector)(selector);
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
if (typeof description === "string")
|
|
40
|
-
return description;
|
|
41
|
-
}
|
|
37
|
+
const customDescription = parseCustomDescription(parsed);
|
|
38
|
+
if (customDescription)
|
|
39
|
+
return customDescription;
|
|
42
40
|
return innerAsLocators(new generators[lang](), parsed, false, 1)[0];
|
|
43
41
|
} catch (e) {
|
|
44
42
|
return selector;
|
|
45
43
|
}
|
|
46
44
|
}
|
|
45
|
+
function locatorCustomDescription(selector) {
|
|
46
|
+
try {
|
|
47
|
+
const parsed = (0, import_selectorParser.parseSelector)(selector);
|
|
48
|
+
return parseCustomDescription(parsed);
|
|
49
|
+
} catch (e) {
|
|
50
|
+
return void 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function parseCustomDescription(parsed) {
|
|
54
|
+
const lastPart = parsed.parts[parsed.parts.length - 1];
|
|
55
|
+
if (lastPart?.name === "internal:describe") {
|
|
56
|
+
const description = JSON.parse(lastPart.body);
|
|
57
|
+
if (typeof description === "string")
|
|
58
|
+
return description;
|
|
59
|
+
}
|
|
60
|
+
return void 0;
|
|
61
|
+
}
|
|
47
62
|
function asLocator(lang, selector, isFrameLocator = false) {
|
|
48
63
|
return asLocators(lang, selector, isFrameLocator, 1)[0];
|
|
49
64
|
}
|
|
@@ -669,5 +684,6 @@ function isRegExp(obj) {
|
|
|
669
684
|
PythonLocatorFactory,
|
|
670
685
|
asLocator,
|
|
671
686
|
asLocatorDescription,
|
|
672
|
-
asLocators
|
|
687
|
+
asLocators,
|
|
688
|
+
locatorCustomDescription
|
|
673
689
|
});
|
|
@@ -437,7 +437,7 @@ const types = /* @__PURE__ */ new Map([
|
|
|
437
437
|
["jpgm", "video/jpm"],
|
|
438
438
|
["mj2", "video/mj2"],
|
|
439
439
|
["mjp2", "video/mj2"],
|
|
440
|
-
["ts", "
|
|
440
|
+
["ts", "application/typescript"],
|
|
441
441
|
["mp4", "video/mp4"],
|
|
442
442
|
["mp4v", "video/mp4"],
|
|
443
443
|
["mpg4", "video/mp4"],
|
|
@@ -25,6 +25,9 @@ __export(protocolFormatter_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(protocolFormatter_exports);
|
|
26
26
|
var import_protocolMetainfo = require("./protocolMetainfo");
|
|
27
27
|
function formatProtocolParam(params, alternatives) {
|
|
28
|
+
return _formatProtocolParam(params, alternatives)?.replaceAll("\n", "\\n");
|
|
29
|
+
}
|
|
30
|
+
function _formatProtocolParam(params, alternatives) {
|
|
28
31
|
if (!params)
|
|
29
32
|
return void 0;
|
|
30
33
|
for (const name of alternatives.split("|")) {
|
|
@@ -67,6 +67,7 @@ const methodMetainfo = /* @__PURE__ */ new Map([
|
|
|
67
67
|
["EventTarget.waitForEventInfo", { title: 'Wait for event "{info.event}"', snapshot: true }],
|
|
68
68
|
["BrowserContext.waitForEventInfo", { title: 'Wait for event "{info.event}"', snapshot: true }],
|
|
69
69
|
["Page.waitForEventInfo", { title: 'Wait for event "{info.event}"', snapshot: true }],
|
|
70
|
+
["Worker.waitForEventInfo", { title: 'Wait for event "{info.event}"', snapshot: true }],
|
|
70
71
|
["WebSocket.waitForEventInfo", { title: 'Wait for event "{info.event}"', snapshot: true }],
|
|
71
72
|
["ElectronApplication.waitForEventInfo", { title: 'Wait for event "{info.event}"', snapshot: true }],
|
|
72
73
|
["AndroidDevice.waitForEventInfo", { title: 'Wait for event "{info.event}"', snapshot: true }],
|
|
@@ -132,7 +133,6 @@ const methodMetainfo = /* @__PURE__ */ new Map([
|
|
|
132
133
|
["Page.mouseClick", { title: "Click", slowMo: true, snapshot: true, pausesBeforeAction: true }],
|
|
133
134
|
["Page.mouseWheel", { title: "Mouse wheel", slowMo: true, snapshot: true, pausesBeforeAction: true }],
|
|
134
135
|
["Page.touchscreenTap", { title: "Tap", slowMo: true, snapshot: true, pausesBeforeAction: true }],
|
|
135
|
-
["Page.accessibilitySnapshot", { title: "Accessibility snapshot", group: "getter" }],
|
|
136
136
|
["Page.pageErrors", { title: "Get page errors", group: "getter" }],
|
|
137
137
|
["Page.pdf", { title: "PDF" }],
|
|
138
138
|
["Page.requests", { title: "Get network requests", group: "getter" }],
|
|
@@ -192,6 +192,7 @@ const methodMetainfo = /* @__PURE__ */ new Map([
|
|
|
192
192
|
["Frame.expect", { title: 'Expect "{expression}"', snapshot: true, pausesBeforeAction: true }],
|
|
193
193
|
["Worker.evaluateExpression", { title: "Evaluate" }],
|
|
194
194
|
["Worker.evaluateExpressionHandle", { title: "Evaluate" }],
|
|
195
|
+
["Worker.updateSubscription", { internal: true }],
|
|
195
196
|
["JSHandle.dispose", { internal: true }],
|
|
196
197
|
["ElementHandle.dispose", { internal: true }],
|
|
197
198
|
["JSHandle.evaluateExpression", { title: "Evaluate", snapshot: true, pausesBeforeAction: true }],
|
|
@@ -38,15 +38,26 @@ function globToRegexPattern(glob) {
|
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
40
|
if (c === "*") {
|
|
41
|
+
const charBefore = glob[i - 1];
|
|
41
42
|
let starCount = 1;
|
|
42
43
|
while (glob[i + 1] === "*") {
|
|
43
44
|
starCount++;
|
|
44
45
|
i++;
|
|
45
46
|
}
|
|
46
|
-
if (starCount > 1)
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
if (starCount > 1) {
|
|
48
|
+
const charAfter = glob[i + 1];
|
|
49
|
+
if (charAfter === "/") {
|
|
50
|
+
if (charBefore === "/")
|
|
51
|
+
tokens.push("((.+/)|)");
|
|
52
|
+
else
|
|
53
|
+
tokens.push("(.*/)");
|
|
54
|
+
++i;
|
|
55
|
+
} else {
|
|
56
|
+
tokens.push("(.*)");
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
49
59
|
tokens.push("([^/]*)");
|
|
60
|
+
}
|
|
50
61
|
continue;
|
|
51
62
|
}
|
|
52
63
|
switch (c) {
|
|
@@ -123,8 +134,11 @@ function resolveGlobBase(baseURL, match) {
|
|
|
123
134
|
const relativePath = match.split("/").map((token, index) => {
|
|
124
135
|
if (token === "." || token === ".." || token === "")
|
|
125
136
|
return token;
|
|
126
|
-
if (index === 0 && token.endsWith(":"))
|
|
127
|
-
|
|
137
|
+
if (index === 0 && token.endsWith(":")) {
|
|
138
|
+
if (token.indexOf("*") !== -1 || token.indexOf("{") !== -1)
|
|
139
|
+
return mapToken2(token, "http:");
|
|
140
|
+
return token;
|
|
141
|
+
}
|
|
128
142
|
const questionIndex = token.indexOf("?");
|
|
129
143
|
if (questionIndex === -1)
|
|
130
144
|
return mapToken2(token, `$_${index}_$`);
|
package/lib/utils.js
CHANGED
|
@@ -50,6 +50,7 @@ __reExport(utils_exports, require("./server/utils/expectUtils"), module.exports)
|
|
|
50
50
|
__reExport(utils_exports, require("./server/utils/fileUtils"), module.exports);
|
|
51
51
|
__reExport(utils_exports, require("./server/utils/hostPlatform"), module.exports);
|
|
52
52
|
__reExport(utils_exports, require("./server/utils/httpServer"), module.exports);
|
|
53
|
+
__reExport(utils_exports, require("./server/utils/imageUtils"), module.exports);
|
|
53
54
|
__reExport(utils_exports, require("./server/utils/network"), module.exports);
|
|
54
55
|
__reExport(utils_exports, require("./server/utils/nodePlatform"), module.exports);
|
|
55
56
|
__reExport(utils_exports, require("./server/utils/processLauncher"), module.exports);
|
|
@@ -93,6 +94,7 @@ var import_utilsBundle = require("./utilsBundle");
|
|
|
93
94
|
...require("./server/utils/fileUtils"),
|
|
94
95
|
...require("./server/utils/hostPlatform"),
|
|
95
96
|
...require("./server/utils/httpServer"),
|
|
97
|
+
...require("./server/utils/imageUtils"),
|
|
96
98
|
...require("./server/utils/network"),
|
|
97
99
|
...require("./server/utils/nodePlatform"),
|
|
98
100
|
...require("./server/utils/processLauncher"),
|
package/lib/utilsBundle.js
CHANGED
|
@@ -39,7 +39,8 @@ __export(utilsBundle_exports, {
|
|
|
39
39
|
wsReceiver: () => wsReceiver,
|
|
40
40
|
wsSender: () => wsSender,
|
|
41
41
|
wsServer: () => wsServer,
|
|
42
|
-
yaml: () => yaml
|
|
42
|
+
yaml: () => yaml,
|
|
43
|
+
zod: () => zod
|
|
43
44
|
});
|
|
44
45
|
module.exports = __toCommonJS(utilsBundle_exports);
|
|
45
46
|
const colors = require("./utilsBundleImpl").colors;
|
|
@@ -58,11 +59,12 @@ const program = require("./utilsBundleImpl").program;
|
|
|
58
59
|
const ProgramOption = require("./utilsBundleImpl").ProgramOption;
|
|
59
60
|
const progress = require("./utilsBundleImpl").progress;
|
|
60
61
|
const SocksProxyAgent = require("./utilsBundleImpl").SocksProxyAgent;
|
|
61
|
-
const yaml = require("./utilsBundleImpl").yaml;
|
|
62
62
|
const ws = require("./utilsBundleImpl").ws;
|
|
63
63
|
const wsServer = require("./utilsBundleImpl").wsServer;
|
|
64
64
|
const wsReceiver = require("./utilsBundleImpl").wsReceiver;
|
|
65
65
|
const wsSender = require("./utilsBundleImpl").wsSender;
|
|
66
|
+
const yaml = require("./utilsBundleImpl").yaml;
|
|
67
|
+
const zod = require("./utilsBundleImpl").zod;
|
|
66
68
|
function ms(ms2) {
|
|
67
69
|
if (!isFinite(ms2))
|
|
68
70
|
return "-";
|
|
@@ -105,5 +107,6 @@ function ms(ms2) {
|
|
|
105
107
|
wsReceiver,
|
|
106
108
|
wsSender,
|
|
107
109
|
wsServer,
|
|
108
|
-
yaml
|
|
110
|
+
yaml,
|
|
111
|
+
zod
|
|
109
112
|
});
|