-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
40 lines (36 loc) · 805 Bytes
/
playwright.config.ts
File metadata and controls
40 lines (36 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { defineConfig, devices } from '@playwright/test';
const isProd = process.env.TEST_ENV === 'prod';
const localURL = 'http://localhost:4321';
function getBaseURL(): string {
if (!isProd) return localURL;
if (!process.env.PROD_SERVER_URL) {
throw new Error('PROD_SERVER_URL env var is required when running test-e2e-prod');
}
return process.env.PROD_SERVER_URL;
}
const baseURL = getBaseURL();
export default defineConfig({
testDir: './tests/e2e',
outputDir: './temp/playwright-results',
timeout: 15_000,
retries: 3,
reporter: 'list',
use: {
baseURL,
...devices['Desktop Chrome'],
},
projects: [
{
name: 'chromium',
},
],
...(isProd
? {}
: {
webServer: {
command: 'pnpm astro preview',
url: localURL,
reuseExistingServer: true,
},
}),
});