-
-
Notifications
You must be signed in to change notification settings - Fork 257
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
72 lines (57 loc) · 2.31 KB
/
playwright.config.ts
File metadata and controls
72 lines (57 loc) · 2.31 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
import { defineConfig, devices } from '@playwright/test';
/**
* Playwright configuration for Ben Balter's website
* Tests the Astro build
*
* Performance optimizations:
* - Increased workers for parallel test execution
* - Disabled video recording (screenshots provide sufficient debugging info)
* - Reduced retries (static sites have fewer flaky tests)
* - Optimized timeouts for static site performance
*/
export default defineConfig({
testDir: './e2e',
/* Maximum time one test can run for. */
timeout: 30 * 1000,
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only - reduced from 2 to 1 since static sites have fewer flaky tests */
retries: process.env.CI ? 1 : 0,
/* Increased workers for faster parallel execution on CI */
workers: process.env.CI ? '50%' : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: process.env.CI
? [['html', { open: 'never' }], ['list'], ['github']]
: [['html', { open: 'never' }], ['list']],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: process.env.BASE_URL || 'http://localhost:4321',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
/* Screenshot on failure - provides sufficient debugging info */
screenshot: 'only-on-failure',
/* Video disabled for performance - screenshots are sufficient for debugging */
video: 'off',
/* Reduced timeout for actions - most actions complete quickly */
actionTimeout: 5000,
/* Reduced timeout for navigation - static site loads fast */
navigationTimeout: 15000,
},
/* Configure projects for cross-browser testing */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
/* Run your local dev server before starting the tests */
webServer: process.env.CI ? undefined : {
command: 'npm run dev',
url: 'http://localhost:4321',
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
});