-
Notifications
You must be signed in to change notification settings - Fork 181
Expand file tree
/
Copy pathplaywright.ci.config.ts
More file actions
66 lines (62 loc) · 1.74 KB
/
playwright.ci.config.ts
File metadata and controls
66 lines (62 loc) · 1.74 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
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
// Reduce timeout for CI
timeout: 30 * 1000,
expect: {
// Reduce expect timeout for faster failures
timeout: 5000
},
// Run tests in files in parallel
fullyParallel: true,
// Fail the build on CI if you accidentally left test.only in the source code
forbidOnly: true,
// Reduce retries to save time
retries: 1,
// Use more workers on CI for parallel execution
workers: 2,
// Reporter optimized for CI
reporter: [
['list'],
['github'],
['html', { open: 'never' }]
],
use: {
// Base URL to use in actions like await page.goto('/')
baseURL: 'http://localhost:4521',
// Collect trace only on failure to save time
trace: 'retain-on-failure',
// Take screenshot on failure
screenshot: 'only-on-failure',
// Reduce viewport for faster rendering
viewport: { width: 1280, height: 720 },
// Disable animations for faster tests
launchOptions: {
args: ['--disable-gpu', '--disable-dev-shm-usage', '--disable-setuid-sandbox', '--no-sandbox'],
},
},
// Configure projects for major browsers
projects: [
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
// Disable GPU for CI
launchOptions: {
args: ['--disable-gpu', '--disable-dev-shm-usage', '--disable-setuid-sandbox', '--no-sandbox'],
},
},
},
],
// Run your local dev server before starting the tests
webServer: {
command: 'pnpm electron-dev',
port: 4521,
reuseExistingServer: false,
timeout: 60 * 1000, // Reduce from 120s to 60s
env: {
DISPLAY: ':99',
ELECTRON_DISABLE_SANDBOX: '1',
},
},
});