Skip to content

Commit 721483f

Browse files
committed
finetune playwright configs
1 parent 677e414 commit 721483f

File tree

2 files changed

+34
-20
lines changed

2 files changed

+34
-20
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
${{ runner.os }}-playwright-${{ matrix.browser }}-
8282
${{ runner.os }}-playwright-v2-
8383
# Browser-specific installation strategy
84-
- name: Install Playwright browsers (optimized)
84+
- name: Install Playwright browsers
8585
working-directory: ./react-example
8686
run: |
8787
echo "📥 Installing ${{ matrix.browser }} browser..."

react-example/playwright.config.ts

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export default defineConfig({
1818
/* Retry on CI only */
1919
retries: process.env.CI ? 2 : 0,
2020
/* Optimized worker count for CI vs local development */
21-
workers: process.env.CI ? 2 : undefined,
22-
/* Global timeout - extended for CI stability */
23-
timeout: process.env.CI ? 60000 : 30000,
21+
workers: process.env.CI ? 4 : undefined,
22+
/* Global timeout - optimized for CI performance */
23+
timeout: process.env.CI ? 45000 : 30000,
2424
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
2525
reporter: [
2626
['html'],
@@ -42,38 +42,52 @@ export default defineConfig({
4242
/* Record video on test failure */
4343
video: 'on-first-retry',
4444

45-
/* Action timeout */
46-
actionTimeout: 10000,
45+
/* Action timeout - optimized for CI performance */
46+
actionTimeout: 8000,
4747

48-
/* Navigation timeout - increased for CI stability */
49-
navigationTimeout: 30000,
48+
/* Navigation timeout - optimized for CI performance */
49+
navigationTimeout: 25000,
5050

5151
/* Configure testIdAttribute for getByTestId() */
52-
testIdAttribute: 'data-test',
53-
54-
/* CI-specific browser launch options for better stability */
55-
launchOptions: process.env.CI
56-
? {
57-
args: ['--no-sandbox', '--disable-dev-shm-usage']
58-
}
59-
: undefined
52+
testIdAttribute: 'data-test'
6053
},
6154

62-
/* Configure projects for major browsers */
6355
projects: [
6456
{
6557
name: 'chromium',
66-
use: { ...devices['Desktop Chrome'] }
58+
use: {
59+
...devices['Desktop Chrome'],
60+
/* Minimal CI flags - only proven reliable ones */
61+
launchOptions: process.env.CI
62+
? {
63+
args: [
64+
'--no-sandbox', // Essential for CI
65+
'--disable-dev-shm-usage' // Prevent /dev/shm issues
66+
]
67+
}
68+
: undefined
69+
}
6770
},
6871

6972
{
7073
name: 'firefox',
71-
use: { ...devices['Desktop Firefox'] }
74+
use: {
75+
...devices['Desktop Firefox'],
76+
/* Firefox works well with minimal flags */
77+
launchOptions: process.env.CI
78+
? {
79+
args: ['--headless'] // Only flag needed for Firefox CI
80+
}
81+
: undefined
82+
}
7283
},
7384

7485
{
7586
name: 'webkit',
76-
use: { ...devices['Desktop Safari'] }
87+
use: {
88+
...devices['Desktop Safari']
89+
// WebKit works best with NO flags - prevents crashes
90+
}
7791
}
7892
]
7993
});

0 commit comments

Comments
 (0)