forked from frappe/wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
55 lines (50 loc) · 1.49 KB
/
playwright.config.ts
File metadata and controls
55 lines (50 loc) · 1.49 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
import { defineConfig, devices } from '@playwright/test';
// Auth state file path (added to .gitignore)
const authFile = 'e2e/.auth/user.json';
/**
* Playwright configuration for Wiki E2E tests.
*
* Uses the recommended "setup project" pattern for authentication:
* 1. Setup project runs first and saves auth state to file
* 2. Other projects depend on setup and reuse the stored auth state
*
* @see https://playwright.dev/docs/auth
* @see https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
testDir: './e2e/tests',
fullyParallel: false, // Sequential for Frappe state consistency
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1, // Single worker for Frappe session management
// Use multiple reporters in CI for both inline annotations and HTML artifacts
reporter: process.env.CI ? [['github'], ['html', { open: 'never' }]] : 'html',
timeout: 60000, // 60s per test
expect: {
timeout: 10000, // 10s for assertions
},
use: {
baseURL: process.env.BASE_URL || 'http://wiki.test:8000',
trace: 'on-first-retry',
video: 'retain-on-failure',
screenshot: 'only-on-failure',
actionTimeout: 15000,
navigationTimeout: 30000,
},
projects: [
// Setup project - authenticates and saves state
{
name: 'setup',
testMatch: /auth\.setup\.ts/,
},
// Main test project - uses stored auth state
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
storageState: authFile,
},
dependencies: ['setup'],
},
],
});