Skip to content

Commit b203b0a

Browse files
committed
Clean up the Playwright config file
1 parent 9e0455b commit b203b0a

File tree

1 file changed

+11
-68
lines changed

1 file changed

+11
-68
lines changed

playwright.config.ts

Lines changed: 11 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,23 @@
1-
import { defineConfig, devices } from '@playwright/test'
1+
import { defineConfig } from '@playwright/test'
22

3-
/**
4-
* Read environment variables from file.
5-
* https://github.com/motdotla/dotenv
6-
*/
7-
// require('dotenv').config();
3+
const baseUrl = process.env.BASE_URL || 'http://127.0.0.1:8888'
4+
const command = process.env.COMMAND || 'pnpm dev:full'
5+
const isCi = !!process.env.CI
86

9-
/**
10-
* See https://playwright.dev/docs/test-configuration.
11-
*/
127
export default defineConfig({
13-
testDir: './test/e2e',
14-
/* Run tests in files in parallel */
8+
forbidOnly: !!isCi,
159
fullyParallel: true,
16-
/* Fail the build on CI if you accidentally left test.only in the source code. */
17-
forbidOnly: !!process.env.CI,
18-
/* Retry on CI only */
19-
retries: process.env.CI ? 2 : 0,
20-
/* Opt out of parallel tests on CI. */
21-
workers: process.env.CI ? 1 : undefined,
22-
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
23-
reporter: 'html',
24-
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
10+
retries: isCi ? 2 : 0,
11+
testDir: './test/e2e',
2512
use: {
26-
/* Base URL to use in actions like `await page.goto('/')`. */
27-
baseURL: process.env.BASE_URL || 'http://127.0.0.1:8888',
28-
13+
baseURL: baseUrl,
2914
testIdAttribute: 'data-test-id',
30-
31-
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3215
trace: 'on-first-retry',
3316
video: 'retain-on-failure',
3417
},
35-
36-
/* Configure projects for major browsers */
37-
projects: [
38-
{
39-
name: 'chromium',
40-
use: { ...devices['Desktop Chrome'] },
41-
},
42-
43-
{
44-
name: 'firefox',
45-
use: { ...devices['Desktop Firefox'] },
46-
},
47-
48-
{
49-
name: 'webkit',
50-
use: { ...devices['Desktop Safari'] },
51-
},
52-
53-
/* Test against mobile viewports. */
54-
// {
55-
// name: 'Mobile Chrome',
56-
// use: { ...devices['Pixel 5'] },
57-
// },
58-
// {
59-
// name: 'Mobile Safari',
60-
// use: { ...devices['iPhone 12'] },
61-
// },
62-
63-
/* Test against branded browsers. */
64-
// {
65-
// name: 'Microsoft Edge',
66-
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
67-
// },
68-
// {
69-
// name: 'Google Chrome',
70-
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
71-
// },
72-
],
73-
74-
/* Run your local dev server before starting the tests */
7518
webServer: {
76-
command: 'pnpm dev:full',
77-
url: process.env.BASE_URL || 'http://127.0.0.1:8888',
78-
reuseExistingServer: !process.env.CI,
19+
command,
20+
reuseExistingServer: !isCi,
21+
url: baseUrl,
7922
},
8023
})

0 commit comments

Comments
 (0)