test: base playwrignt setup for firefox and chrome
This commit is contained in:
+47
-3
@@ -1,10 +1,54 @@
|
||||
import { defineConfig } from '@playwright/test';
|
||||
import {
|
||||
defineConfig,
|
||||
devices,
|
||||
} from '@playwright/test';
|
||||
|
||||
/**
|
||||
* E2E config. Tests run against the production build via `vite preview` on port 4173.
|
||||
* Locally: all three browser engines run in parallel.
|
||||
* CI: chromium only, workers=1 — the runner has 6GB RAM and `yarn build` already
|
||||
* spikes 1–2GB, so we keep the E2E peak bounded.
|
||||
*/
|
||||
const isCI = !!process.env.CI;
|
||||
|
||||
export default defineConfig({
|
||||
testDir: 'e2e',
|
||||
testMatch: /.*\.test\.ts$/,
|
||||
|
||||
fullyParallel: true,
|
||||
forbidOnly: isCI,
|
||||
retries: isCI ? 2 : 0,
|
||||
workers: isCI ? 1 : undefined,
|
||||
|
||||
reporter: isCI
|
||||
? [['html', { open: 'never' }], ['github']]
|
||||
: [['html', { open: 'on-failure' }], ['list']],
|
||||
|
||||
use: {
|
||||
baseURL: 'http://localhost:4173',
|
||||
trace: 'on-first-retry',
|
||||
screenshot: 'only-on-failure',
|
||||
video: 'retain-on-failure',
|
||||
},
|
||||
|
||||
projects: isCI
|
||||
? [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }]
|
||||
: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'firefox',
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
],
|
||||
webServer: {
|
||||
command: 'yarn build && yarn preview',
|
||||
port: 4173,
|
||||
reuseExistingServer: true,
|
||||
reuseExistingServer: !isCI,
|
||||
timeout: 120_000,
|
||||
},
|
||||
testDir: 'e2e',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user