@lvce-editor/test-with-playwright-worker 22.38.3 → 22.38.4
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 +26 -3
- package/package.json +1 -1
package/dist/workerMain.js
CHANGED
|
@@ -3,10 +3,10 @@ import { readFile, writeFile, readdir, rm, mkdir, access, mkdtemp } from 'node:f
|
|
|
3
3
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
4
|
import net from 'node:net';
|
|
5
5
|
import os, { tmpdir } from 'node:os';
|
|
6
|
-
import { fork } from 'node:child_process';
|
|
7
6
|
import { createRequire } from 'node:module';
|
|
7
|
+
import { fork } from 'node:child_process';
|
|
8
8
|
|
|
9
|
-
const require$
|
|
9
|
+
const require$2 = createRequire(import.meta.url);
|
|
10
10
|
const before = ` _onWebSocketOpened(event) {
|
|
11
11
|
const request2 = this._webSocketRequests.get(event.requestId);
|
|
12
12
|
assert(request2);
|
|
@@ -61,7 +61,7 @@ const patchCoreBundleContent = content => {
|
|
|
61
61
|
return content.split(before).join(after);
|
|
62
62
|
};
|
|
63
63
|
const getCoreBundlePath = () => {
|
|
64
|
-
const packageJsonPath = require$
|
|
64
|
+
const packageJsonPath = require$2.resolve('playwright-core/package.json');
|
|
65
65
|
return join(dirname(packageJsonPath), 'lib', 'coreBundle.js');
|
|
66
66
|
};
|
|
67
67
|
const patchPlaywrightFirefoxWorkerWebSocket = async () => {
|
|
@@ -2263,6 +2263,28 @@ const getServerPath = async serverPath => {
|
|
|
2263
2263
|
throw new Error(`[test-with-playwright] server path not found`);
|
|
2264
2264
|
};
|
|
2265
2265
|
|
|
2266
|
+
const require$1 = createRequire(import.meta.url);
|
|
2267
|
+
const disabledFeaturesPrefix = '--disable-features=';
|
|
2268
|
+
const getBrowserLaunchArgs = (browser, platform = process.platform) => {
|
|
2269
|
+
if (browser !== 'chromium' || platform !== 'win32') {
|
|
2270
|
+
return [];
|
|
2271
|
+
}
|
|
2272
|
+
// SO_RANDOMIZE_PORT intermittently fails with WSAENOBUFS on Windows.
|
|
2273
|
+
// Read Playwright's defaults so this override preserves its other disabled features.
|
|
2274
|
+
const {
|
|
2275
|
+
server
|
|
2276
|
+
} = require$1('playwright-core/lib/coreBundle');
|
|
2277
|
+
const playwright = server.createPlaywright({
|
|
2278
|
+
sdkLanguage: 'javascript'
|
|
2279
|
+
});
|
|
2280
|
+
const defaultArgs = playwright.chromium._innerDefaultArgs({});
|
|
2281
|
+
const disabledFeatures = defaultArgs.find(argument => argument.startsWith(disabledFeaturesPrefix));
|
|
2282
|
+
if (!disabledFeatures) {
|
|
2283
|
+
throw new Error('Could not find Playwright Chromium disabled features');
|
|
2284
|
+
}
|
|
2285
|
+
return [`${disabledFeatures},TcpPortRandomizationWin`];
|
|
2286
|
+
};
|
|
2287
|
+
|
|
2266
2288
|
/**
|
|
2267
2289
|
*
|
|
2268
2290
|
* @param {{browser:'chromium'|'firefox'|'webkit', signal:AbortSignal, headless:boolean}} options
|
|
@@ -2293,6 +2315,7 @@ const startBrowser = async ({
|
|
|
2293
2315
|
}
|
|
2294
2316
|
const launcher = await getLauncher(browser);
|
|
2295
2317
|
const browserInstance = await launcher.launch({
|
|
2318
|
+
args: getBrowserLaunchArgs(browser),
|
|
2296
2319
|
headless
|
|
2297
2320
|
});
|
|
2298
2321
|
const page = await browserInstance.newPage();
|