-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
57 lines (54 loc) · 2.1 KB
/
Copy pathplaywright.config.ts
File metadata and controls
57 lines (54 loc) · 2.1 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { defineConfig, devices } from '@playwright/test';
const PORT = 3000;
const baseURL = `http://localhost:${PORT}`;
// Dummy API endpoints for E2E. The app's HTTP clients read these at build/load
// time (services/index.ts → import.meta.env.VITE_*). Pointing them at the
// `api.test` host means every API call is interceptable by page.route() and
// can never reach a real backend. See test/e2e/fixtures.ts.
const E2E_ENV = {
VITE_API_URL: 'http://api.test/',
VITE_NEW_API_URL: 'http://api.test/',
VITE_TDEI_API_URL: 'http://api.test/tdei/',
VITE_TDEI_USER_API_URL: 'http://api.test/tdei-user/',
VITE_OSM_URL: 'http://api.test/osm/',
VITE_RAPID_URL: 'http://api.test/rapid/',
VITE_RAPID3_URL: 'http://api.test/rapid3/',
VITE_PATHWAYS_EDITOR_URL: 'http://api.test/pathways/',
VITE_IMAGERY_SCHEMA: 'http://api.test/imagery-schema.json',
VITE_IMAGERY_EXAMPLE_URL: 'http://api.test/imagery-example',
VITE_LONG_FORM_QUEST_SCHEMA: 'http://api.test/quest-schema.json',
VITE_LONG_FORM_QUEST_EXAMPLE_URL: 'http://api.test/quest-example'
};
export default defineConfig({
testDir: './test/e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
// In CI: 'github' annotates the Actions log, and 'html' writes the
// playwright-report/ dir that the CI workflow uploads as an artifact.
reporter: process.env.CI
? [['github'], ['html', { open: 'never' }]]
: 'list',
// The Nuxt dev server compiles routes lazily on first hit, so a cold parallel
// request can take several seconds to render. A roomy expect timeout absorbs
// that without masking real failures. (Run E2E against `nuxt build && preview`
// instead if you want production-fast, fully pre-compiled routes.)
expect: {
timeout: 10_000,
toHaveScreenshot: { maxDiffPixelRatio: 0.02 }
},
use: {
baseURL,
trace: 'on-first-retry'
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }
],
webServer: {
command: 'npm run dev',
url: baseURL,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
env: { ...E2E_ENV, ENV: 'local' }
}
});