-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
79 lines (63 loc) · 1.97 KB
/
playwright.config.ts
File metadata and controls
79 lines (63 loc) · 1.97 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
/**
* Playwright Configuration for Browser Extension E2E Tests
*
* Tests the browser extension in Chrome with the extension loaded.
*/
import { defineConfig, devices } from '@playwright/test';
import path from 'path';
import { fileURLToPath } from 'url';
// ESM-compatible __dirname
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Path to the built extension
const EXTENSION_PATH = path.join(__dirname, 'dist', 'chrome');
export default defineConfig({
testDir: './tests/e2e',
/* Run tests in files in parallel */
fullyParallel: false, // Extensions often have state, run sequentially
/* Fail the build on CI if you accidentally left test.only in the source code */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI for extension testing */
workers: 1, // Single worker for extension testing
/* Reporter to use */
reporter: [
['html', { outputFolder: 'playwright-report' }],
['list'],
['json', { outputFile: 'playwright-results.json' }],
],
/* Shared settings for all the projects below */
use: {
/* Collect trace when retrying the failed test */
trace: 'on-first-retry',
/* Screenshots on failure */
screenshot: 'only-on-failure',
/* Video recording */
video: process.env.CI ? 'on-first-retry' : 'off',
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium-extension',
use: {
...devices['Desktop Chrome'],
// Load the extension
launchOptions: {
args: [
`--disable-extensions-except=${EXTENSION_PATH}`,
`--load-extension=${EXTENSION_PATH}`,
'--no-sandbox',
'--disable-setuid-sandbox',
],
},
},
},
],
/* Timeout for each test */
timeout: 60000,
/* Timeout for expect assertions */
expect: {
timeout: 10000,
},
});