@lvce-editor/test-with-playwright-worker 22.20.0 → 22.22.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/dist/workerMain.js +17 -2
- package/package.json +1 -1
package/dist/workerMain.js
CHANGED
|
@@ -34,8 +34,21 @@ const after = ` _onWebSocketOpened(event) {
|
|
|
34
34
|
this._page.frameManager.onWebSocketRequest(webSocketId(event.frameId, event.wsid), request2.headers);
|
|
35
35
|
this._page.frameManager.onWebSocketResponse(webSocketId(event.frameId, event.wsid), response2.status, response2.statusText, response2.headers);
|
|
36
36
|
}`;
|
|
37
|
+
const upstreamFix = ` _onWebSocketOpened(event) {
|
|
38
|
+
const socketId = webSocketId(event.frameId, event.wsid);
|
|
39
|
+
const request2 = this._webSocketRequests.get(event.requestId);
|
|
40
|
+
const response2 = this._webSocketResponses.get(event.requestId);
|
|
41
|
+
if (!request2 || !response2) {
|
|
42
|
+
this._page.frameManager.onWebSocketRequest(socketId);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this._webSocketRequests.delete(event.requestId);
|
|
46
|
+
this._webSocketResponses.delete(event.requestId);
|
|
47
|
+
this._page.frameManager.onWebSocketRequest(socketId, request2);
|
|
48
|
+
this._page.frameManager.onWebSocketResponse(socketId, response2);
|
|
49
|
+
}`;
|
|
37
50
|
const patchCoreBundleContent = content => {
|
|
38
|
-
if (content.includes(after)) {
|
|
51
|
+
if (content.includes(after) || content.includes(upstreamFix)) {
|
|
39
52
|
return content;
|
|
40
53
|
}
|
|
41
54
|
if (!content.includes(before)) {
|
|
@@ -1045,6 +1058,8 @@ const Cli = 6001;
|
|
|
1045
1058
|
|
|
1046
1059
|
const browserScriptCache = {};
|
|
1047
1060
|
const fileExtensionRegex = /\.[^.]+$/;
|
|
1061
|
+
const generatedMaskIconClassRegex = /\bMaskIconCustomView[a-z0-9]+\b/g;
|
|
1062
|
+
const localServerUrlRegex = /http:\/\/localhost:\d+/g;
|
|
1048
1063
|
const tagBoundaryRegex = />\s*</g;
|
|
1049
1064
|
const getBrowserScriptCandidates = () => {
|
|
1050
1065
|
return [fileURLToPath(new URL('svgScreenshot.js', import.meta.url)), fileURLToPath(new URL('../../../../../dist/test-with-playwright-worker/dist/svgScreenshot.js', import.meta.url))];
|
|
@@ -1076,7 +1091,7 @@ const capture = async (page, selector) => {
|
|
|
1076
1091
|
}, selector);
|
|
1077
1092
|
};
|
|
1078
1093
|
const formatSvg = svg => {
|
|
1079
|
-
return `${svg.replaceAll(tagBoundaryRegex, '>\n<').trim()}\n`;
|
|
1094
|
+
return `${svg.replaceAll(localServerUrlRegex, 'http://localhost:PORT').replaceAll(generatedMaskIconClassRegex, 'MaskIconCustomView').replaceAll(tagBoundaryRegex, '>\n<').trim()}\n`;
|
|
1080
1095
|
};
|
|
1081
1096
|
const getSnapshotName = (test, name) => {
|
|
1082
1097
|
const fileName = basename(test).replace(fileExtensionRegex, '');
|