|
1 | 1 | import { PlaywrightTestConfig } from "@playwright/test"
|
2 |
| -import * as path from "path" |
3 |
| -import { basePort } from "./constants" |
| 2 | +import path from "path" |
| 3 | +import { defaultPort } from "./constants" |
| 4 | + |
| 5 | +const port = process.env.CODER_E2E_PORT |
| 6 | + ? Number(process.env.CODER_E2E_PORT) |
| 7 | + : defaultPort |
| 8 | + |
| 9 | +const coderMain = path.join(__dirname, "../../enterprise/cmd/coder/main.go") |
4 | 10 |
|
5 | 11 | const config: PlaywrightTestConfig = {
|
6 | 12 | testDir: "tests",
|
7 | 13 | globalSetup: require.resolve("./globalSetup"),
|
8 |
| - |
9 |
| - // Create junit report file for upload to DataDog |
10 |
| - reporter: [["junit", { outputFile: "test-results/junit.xml" }]], |
11 |
| - |
12 |
| - // NOTE: if Playwright complains about the port being taken |
13 |
| - // do not change the basePort (it must match our api server). |
14 |
| - // Instead, simply run the test suite without running our local server. |
15 | 14 | use: {
|
16 |
| - baseURL: `http://localhost:${basePort}`, |
| 15 | + baseURL: `http://localhost:${port}`, |
17 | 16 | video: "retain-on-failure",
|
18 | 17 | },
|
19 |
| - |
20 |
| - // `webServer` tells Playwright to launch a test server - more details here: |
21 |
| - // https://playwright.dev/docs/test-advanced#launching-a-development-web-server-during-the-tests |
22 | 18 | webServer: {
|
23 |
| - // Run the coder daemon directly. |
24 |
| - command: `go run -tags embed ${path.join( |
25 |
| - __dirname, |
26 |
| - "../../enterprise/cmd/coder/main.go", |
27 |
| - )} server --in-memory --access-url http://127.0.0.1:${basePort}`, |
28 |
| - port: basePort, |
29 |
| - timeout: 120 * 10000, |
| 19 | + command: `go run -tags embed ${coderMain} server --global-config $(mktemp -d -t e2e-XXXXXXXXXX)`, |
| 20 | + port, |
30 | 21 | reuseExistingServer: false,
|
31 | 22 | },
|
32 | 23 | }
|
|
0 commit comments