-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
55 lines (51 loc) · 1.73 KB
/
Copy pathplaywright.config.ts
File metadata and controls
55 lines (51 loc) · 1.73 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 { currentsReporter } from '@currents/playwright'
import { defineConfig, devices } from '@playwright/test'
const isRunningOnCI = Boolean(process.env.CI)
const webServerPort = isRunningOnCI ? 4173 : 3000
const webServerUrl = `http://localhost:${webServerPort}`
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './e2e',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: isRunningOnCI,
/* Retry on CI only */
retries: isRunningOnCI ? 2 : 0,
/* Limit the number of workers on CI, use default locally */
workers: isRunningOnCI ? '50%' : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: isRunningOnCI
? [['github'], currentsReporter()] // GitHub for PRs annotations, and Currents for Playwright dashboard
: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL: webServerUrl,
trace: isRunningOnCI
? 'on' // necessary for Currents integration
: 'on-first-retry',
video: isRunningOnCI
? 'on' // necessary for Currents integration
: undefined,
screenshot: isRunningOnCI
? 'on' // necessary for Currents integration
: undefined,
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
/* Run local dev server before starting the tests */
webServer: {
command: isRunningOnCI
? `pnpm run preview --host 0.0.0.0 --port ${webServerPort}` // `pnpm run build` must be run beforehand
: 'pnpm run dev:mock',
url: webServerUrl,
reuseExistingServer: !isRunningOnCI,
},
})