-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathplaywright.config.js
More file actions
72 lines (59 loc) · 1.9 KB
/
playwright.config.js
File metadata and controls
72 lines (59 loc) · 1.9 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
// @ts-check
const { defineConfig, devices } = require('@playwright/test');
const path = require('path');
const isCI = !!process.env.CI;
const isWindows = process.platform === 'win32';
/**
* Playwright configuration for Chrome Extension E2E testing
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
testDir: './test/e2e',
// Maximum time one test can run for
timeout: 60 * 1000,
// Test execution settings
fullyParallel: false, // Extensions can't run fully parallel easily
forbidOnly: isCI,
retries: isCI ? 2 : 0,
workers: 1, // Run tests sequentially for extensions
// Reporter to use
reporter: [
['html', { outputFolder: 'playwright-report' }],
['list']
],
// Shared settings for all the projects below
use: {
// Base URL for testing (points to test pages)
baseURL: 'http://localhost:8000/test/e2e/test-pages',
// Collect trace when retrying the failed test
trace: 'on-first-retry',
// Screenshot on failure
screenshot: 'only-on-failure',
// Video on failure
video: 'retain-on-failure',
// Slower actions for better stability with extensions
actionTimeout: 10 * 1000,
headless: true, // Uses --headless=new which supports extensions (Chrome 109+)
},
// Configure projects for major browsers
projects: [
{
name: 'chromium-extension',
use: {
...devices['Desktop Chrome'],
// In CI (Linux), use plain chromium; locally on Windows/macOS use msedge
...(isCI ? {} : { channel: 'msedge' }),
// Note: Extension loading happens in test setup via helper functions
},
},
],
// Run your local dev server before starting the tests
webServer: {
command: isWindows
? 'powershell -File ./start_test_server.ps1'
: 'python3 -m http.server 8000',
url: 'http://localhost:8000',
reuseExistingServer: !isCI,
timeout: 10 * 1000,
},
});