Repository navigation
Expand file tree
/
Copy pathplaywright.config.js
More file actions
108 lines (90 loc) · 3.63 KB
/
Copy pathplaywright.config.js
File metadata and controls
108 lines (90 loc) · 3.63 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { defineConfig, devices } from '@playwright/test';
/**
* Playwright configuration for Poweradmin E2E tests
*
* Isolation rules: writes go to throwaway objects (tempZone / useFileZone() fixtures,
* createTempZone, uniqueName in playwright/helpers/zones.js); seeded data
* (fixtures/zones.json, users.json) is read-only; never assert exact counts on
* shared pages, scope to your own object; clean up in teardown; every spec file
* must pass alone and when rerun without a data reset. Details: fixtures/test-fixtures.js.
* @see https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
// Global setup to ensure test data exists before all tests run
globalSetup: './playwright/global-setup.js',
testDir: './playwright/tests',
// Maximum time one test can run for
timeout: 30 * 1000,
// Test match pattern
testMatch: /.*\.spec\.js/,
// Allow parallel test execution - read-only tests benefit from this
// Write tests are marked with test.describe.configure({ mode: 'serial' }) in their files
fullyParallel: true,
// Fail the build on CI if you accidentally left test.only in the source code
forbidOnly: !!process.env.CI,
// One local retry absorbs rare load flakes in parallel runs
retries: process.env.CI ? 2 : 1,
// 2 workers locally for parallel file execution, 1 on CI for stability.
// Workers never share sessions (each has its own cookie jar and PHP session);
// the constraint is shared zone data, contained by per-file serial mode.
workers: process.env.CI ? 1 : 2,
// Reporter to use
reporter: [
['html', { outputFolder: 'playwright-report' }],
['list'],
['json', { outputFile: 'playwright-report/results.json' }]
],
// Shared settings for all the projects below
use: {
// Base URL to use in actions like `await page.goto('/')`
// Default to MySQL instance (port 8080). Override with BASE_URL env var for other databases:
// - MySQL: BASE_URL=http://localhost:8080 (default)
// - PostgreSQL: BASE_URL=http://localhost:8081
// - SQLite: BASE_URL=http://localhost:8082
baseURL: process.env.BASE_URL || 'http://localhost:8080',
// Disable heavy features on CI for performance
// Re-enable locally by setting CI=false or when investigating failures
trace: process.env.CI ? 'off' : 'on-first-retry',
screenshot: process.env.CI ? 'off' : 'only-on-failure',
video: process.env.CI ? 'off' : 'retain-on-failure',
// Maximum time each action such as `click()` can take
actionTimeout: 10 * 1000,
// Navigation timeout
navigationTimeout: 15 * 1000,
},
// Configure projects for major browsers
// Default command (npm run test:e2e) runs Chromium only for fast local feedback
// Use --project=firefox or --project=webkit to test other browsers
// Uncomment additional browsers below to run them by default
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
// Uncomment to enable Firefox tests by default
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
// Uncomment to enable WebKit tests by default
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
// Mobile viewports for responsive testing
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
],
// Run your local dev server before starting the tests
// webServer: {
// command: 'npm run start',
// url: 'http://localhost:8080',
// reuseExistingServer: !process.env.CI,
// },
});