-
-
Notifications
You must be signed in to change notification settings - Fork 275
Expand file tree
/
Copy pathplaywright.config.js
More file actions
88 lines (75 loc) · 2.36 KB
/
Copy pathplaywright.config.js
File metadata and controls
88 lines (75 loc) · 2.36 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
// @ts-check
const { defineConfig, devices } = require('@playwright/test');
/**
* PWB E2E Testing Configuration
* @see https://playwright.dev/docs/test-configuration
*
* Before running tests, ensure the e2e database is set up:
* RAILS_ENV=e2e bin/rails playwright:reset
*
* Start the e2e server:
* RAILS_ENV=e2e bin/rails playwright:server
*/
module.exports = defineConfig({
testDir: './tests/e2e',
// Global setup - verifies e2e database is properly initialized
globalSetup: './tests/e2e/global-setup.js',
// Run tests in files in parallel
fullyParallel: true,
// 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
workers: process.env.CI ? 1 : undefined,
// Reporter to use
reporter: [
['html', { outputFolder: 'playwright-report' }],
['list']
],
// Shared settings for all the projects below
use: {
// Base URL for tests (e2e environment runs on 3001)
baseURL: 'http://tenant-a.e2e.localhost:3001',
// Collect trace when retrying the failed test
trace: 'on-first-retry',
// Screenshot on failure
screenshot: 'only-on-failure',
// Video on retry
video: 'on-first-retry',
},
// Configure projects for major browsers
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
// Exclude admin tests - they run in a separate serial project
testIgnore: '**/admin/**',
},
{
// Admin tests modify shared state and must run serially
name: 'chromium-admin',
use: { ...devices['Desktop Chrome'] },
testMatch: '**/admin/**',
fullyParallel: false,
},
// Uncomment for additional browser testing
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
],
// Note: The Rails server should be started manually using:
// RAILS_ENV=e2e bin/rails playwright:server
// This is preferred over webServer config for Rails apps
// webServer: {
// command: 'RAILS_ENV=e2e bin/rails server -p 3001',
// url: 'http://tenant-a.e2e.localhost:3001',
// reuseExistingServer: !process.env.CI,
// timeout: 120 * 1000,
// },
});