test(workbench): add browser regression coverage
This commit is contained in:
1 parent
2fb9db65e5
commit
fcb07b8396
6 files changed
+230
-1
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
function cachedChromium() {
|
||||
if (process.env.PLAYWRIGHT_EXECUTABLE_PATH) return process.env.PLAYWRIGHT_EXECUTABLE_PATH;
|
||||
const cache =
|
||||
process.env.PLAYWRIGHT_BROWSERS_PATH || path.join(process.env.HOME || '', 'Library/Caches/ms-playwright');
|
||||
if (!fs.existsSync(cache)) return undefined;
|
||||
const candidates = fs
|
||||
.readdirSync(cache)
|
||||
.filter((name) => name.startsWith('chromium_headless_shell-'))
|
||||
.sort()
|
||||
.reverse()
|
||||
.map((name) => path.join(cache, name, 'chrome-headless-shell-mac-x64', 'chrome-headless-shell'));
|
||||
return candidates.find((candidate) => fs.existsSync(candidate));
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './test/e2e',
|
||||
fullyParallel: false,
|
||||
forbidOnly: Boolean(process.env.CI),
|
||||
reporter: process.env.CI ? 'line' : 'list',
|
||||
use: {
|
||||
baseURL: 'http://127.0.0.1:8899',
|
||||
trace: 'retain-on-failure',
|
||||
screenshot: 'only-on-failure',
|
||||
},
|
||||
webServer: {
|
||||
command: 'node test/e2e-server.js',
|
||||
url: 'http://127.0.0.1:8899/',
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 30_000,
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'], launchOptions: { executablePath: cachedChromium() } },
|
||||
},
|
||||
],
|
||||
});
|
||||
Reference in new issue
Block a user