@lvce-editor/test-with-playwright-worker 20.1.0 → 20.2.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 +15 -5
- package/package.json +1 -1
package/dist/workerMain.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join, basename } from 'node:path';
|
|
2
2
|
import { readdir } from 'node:fs/promises';
|
|
3
|
-
import { expect, firefox, chromium } from '@playwright/test';
|
|
3
|
+
import { expect, webkit, firefox, chromium } from '@playwright/test';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import net from 'node:net';
|
|
6
6
|
import os from 'node:os';
|
|
@@ -1367,15 +1367,25 @@ const getServerPath = async serverPath => {
|
|
|
1367
1367
|
|
|
1368
1368
|
/**
|
|
1369
1369
|
*
|
|
1370
|
-
* @param {{browser:'chromium'|'firefox', signal:AbortSignal, headless:boolean}} options
|
|
1370
|
+
* @param {{browser:'chromium'|'firefox'|'webkit', signal:AbortSignal, headless:boolean}} options
|
|
1371
1371
|
* @returns
|
|
1372
1372
|
*/
|
|
1373
|
+
const getLauncher = browser => {
|
|
1374
|
+
switch (browser) {
|
|
1375
|
+
case 'chromium':
|
|
1376
|
+
return chromium;
|
|
1377
|
+
case 'firefox':
|
|
1378
|
+
return firefox;
|
|
1379
|
+
case 'webkit':
|
|
1380
|
+
return webkit;
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1373
1383
|
const startBrowser = async ({
|
|
1374
1384
|
browser,
|
|
1375
1385
|
headless,
|
|
1376
1386
|
signal
|
|
1377
1387
|
}) => {
|
|
1378
|
-
const launcher = browser
|
|
1388
|
+
const launcher = getLauncher(browser);
|
|
1379
1389
|
const browserInstance = await launcher.launch({
|
|
1380
1390
|
headless
|
|
1381
1391
|
});
|
|
@@ -1431,7 +1441,7 @@ const startServer = async ({
|
|
|
1431
1441
|
|
|
1432
1442
|
/**
|
|
1433
1443
|
*
|
|
1434
|
-
* @param {{browser:'chromium'|'firefox', signal:AbortSignal, headless: boolean, onlyExtension:string, testPath:string}} options
|
|
1444
|
+
* @param {{browser:'chromium'|'firefox'|'webkit', signal:AbortSignal, headless: boolean, onlyExtension:string, testPath:string}} options
|
|
1435
1445
|
* @returns
|
|
1436
1446
|
*/
|
|
1437
1447
|
const setupTests = async ({
|
|
@@ -1661,7 +1671,7 @@ const tearDownTests = async ({
|
|
|
1661
1671
|
* @param {string} extensionPath
|
|
1662
1672
|
* @param {string} testPath
|
|
1663
1673
|
* @param {string} cwd
|
|
1664
|
-
* @param {'chromium'|'firefox'} browser
|
|
1674
|
+
* @param {'chromium'|'firefox'|'webkit'} browser
|
|
1665
1675
|
* @param {boolean} headless
|
|
1666
1676
|
* @param {number} timeout
|
|
1667
1677
|
* @param {string} serverPath
|