Repository navigation
Expand file tree
/
Copy pathplaywright.config.js
More file actions
90 lines (72 loc) · 2.72 KB
/
Copy pathplaywright.config.js
File metadata and controls
90 lines (72 loc) · 2.72 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
79
80
81
82
83
84
85
86
87
88
89
90
/**
* Playwright Configuration for StratoSort Electron E2E Testing
*
* This configuration sets up Playwright to test the Electron application.
* It uses the _electron fixture to launch and control the app.
*
* Prerequisites:
* - `globalSetup` runs `npm run build:main:dev` when `dist/preload.js` is missing or stale
* - Run `npm run build:dev` if renderer assets in `dist/` are missing
* - Models should be available for AI-related tests (optional)
*
* Running tests:
* - `npm run test:e2e` - Run all E2E tests in headless mode
* - `npm run test:e2e:headed` - Run tests with visible Electron window
* - `npm run test:e2e:debug` - Run tests in debug mode with Playwright Inspector
*/
const { defineConfig } = require('@playwright/test');
const path = require('path');
module.exports = defineConfig({
// Directory containing E2E test files. Specs are grouped by product area in
// subfolders (app/, setup/, discover/, ...); see test/e2e/README.md for the index.
testDir: './test/e2e',
// Test file pattern (recursive, so every area folder is picked up)
testMatch: '**/*.spec.js',
// Maximum time one test can run (3 minutes for analysis tests)
timeout: 180000,
// Maximum time for expect() assertions (30 seconds)
expect: {
timeout: 30000
},
// Fail the build on CI if test.only is accidentally left in source code
forbidOnly: !!process.env.CI,
// Retry failed tests (more retries on CI)
retries: process.env.CI ? 2 : 1,
// Run tests serially in Electron - parallel execution can cause issues
workers: 1,
// Shared settings for all projects
use: {
// Trace on first retry for better debugging
trace: 'on-first-retry',
// Screenshot on failure
screenshot: 'only-on-failure',
// Video recording on retry
video: 'on-first-retry',
// Timeout for actions like click, fill, etc.
actionTimeout: 15000,
// Navigation timeout
navigationTimeout: 30000
},
// Output folder for test artifacts (screenshots, videos, traces)
outputDir: './test-results/e2e',
// Reporter configuration
reporter: [
['list'],
['html', { outputFolder: './test-results/e2e-report', open: 'never' }],
...(process.env.CI ? [['github']] : [])
],
// Rebuild dist/preload.js when source changed (Electron loads preload from dist/)
globalSetup: path.join(__dirname, 'test/e2e/helpers/globalSetup.js'),
// Global teardown
globalTeardown: path.join(__dirname, 'test/e2e/helpers/globalTeardown.js'),
// Projects configuration - Electron doesn't use browser projects
// but we define one for consistency with Playwright conventions
projects: [
{
name: 'electron',
use: {
// No browser launch options needed - we launch Electron directly
}
}
]
});