-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplaywright.config.js
More file actions
68 lines (55 loc) · 1.83 KB
/
playwright.config.js
File metadata and controls
68 lines (55 loc) · 1.83 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
import { defineConfig, devices } from '@playwright/test';
import path from 'path';
import dotenv from 'dotenv';
// Load from project root so both main and worker processes get env (workers may have different __dirname)
dotenv.config({ path: path.resolve(process.cwd(), '.playwright.env') });
export default defineConfig({
// Test directory
testDir: './tests/e2e',
// Test file pattern
testMatch: '**/*.spec.js',
// Parallel execution
fullyParallel: true,
// Fail fast on CI
forbidOnly: !!process.env.CI,
// Retries
retries: process.env.CI ? 2 : 0,
// Reporters (HTML in playwright-report/ to avoid clashing with test-results/)
reporter: [
['list'],
['json', { outputFile: './test-results/playwright-results.json' }],
['html', { outputFolder: './playwright-report' }],
],
// Shared settings for all tests
use: {
// Base URL (dev server must be running)
baseURL: 'http://localhost:3232',
// Collect trace on failure
trace: 'on-first-retry',
// Screenshot on failure
screenshot: 'only-on-failure',
// Video: 'on' = record and keep for every test; 'retain-on-failure' = keep only when test fails
video: 'on',
},
// Browser projects (skip WebKit on macOS - headless often hits Bus error: 10; run with --project=webkit to try)
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
...(process.platform === 'darwin'
? []
: [{ name: 'webkit', use: { ...devices['Desktop Safari'] } }]),
],
// Dev server configuration
webServer: {
command: 'aem up --port 3232', // Project uses AEM CLI, not npm start
url: 'http://localhost:3232',
reuseExistingServer: !process.env.CI,
timeout: 120000, // 2 minutes for server startup
},
});