-
Notifications
You must be signed in to change notification settings - Fork 573
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
55 lines (53 loc) · 1.77 KB
/
playwright.config.ts
File metadata and controls
55 lines (53 loc) · 1.77 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
/** Unified Playwright config
* - Runs tests in tests/playwright
* - Starts WebSSH2 via webServer
* - If ENABLE_E2E_SSH=1, starts containerized sshd in global setup and stops in teardown
*/
import { defineConfig, devices } from '@playwright/test'
import { WEB_PORT, BASE_URL, TIMEOUTS, SSH_PORT, SSH_HOST, USERNAME, PASSWORD } from './tests/playwright/constants.js'
const enableE2E = process.env.ENABLE_E2E_SSH === '1'
export default defineConfig({
testDir: './tests/playwright',
testIgnore: '**/debug/**',
timeout: 60_000,
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: 2,
reporter: [['list']],
use: {
baseURL: BASE_URL,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
actionTimeout: TIMEOUTS.ACTION,
navigationTimeout: TIMEOUTS.NAVIGATION,
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
],
webServer: {
// Keep server logs quiet by default; opt-in with E2E_DEBUG
command: 'tsx ./tests/playwright/scripts/start-server.ts',
url: `${BASE_URL}/ssh`,
reuseExistingServer: true,
timeout: TIMEOUTS.WEB_SERVER,
env: {
DEBUG: process.env.E2E_DEBUG ?? '',
WEBSSH2_LISTEN_PORT: String(WEB_PORT),
E2E_SSH_HOST: SSH_HOST,
E2E_SSH_PORT: String(SSH_PORT),
E2E_SSH_USER: USERNAME,
E2E_SSH_PASS: PASSWORD,
WEBSSH2_SSH_READY_TIMEOUT: '10000' // Faster timeout for test suite
},
},
// Always run global teardown to clean up config.json
// Only run global setup when E2E SSH tests are enabled (to start the container)
globalTeardown: './tests/playwright/global-teardown.ts',
...(enableE2E
? {
globalSetup: './tests/playwright/global-setup.ts',
}
: {}),
})