Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 03fd063

Browse files
authored
chore: adding some quality of life Playwright comments (#2726)
1 parent d9668f7 commit 03fd063

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

site/e2e/constants.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Our base port. It's important to run on 3000,
2+
// which matches our api server
3+
export const basePort = 3000
4+
15
// Credentials for the default user when running in dev mode.
26
export const username = "developer"
37
export const password = "password"

site/e2e/globalSetup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { postFirstUser } from "../src/api/api"
33
import * as constants from "./constants"
44

55
const globalSetup = async (): Promise<void> => {
6-
axios.defaults.baseURL = "http://localhost:3000"
6+
axios.defaults.baseURL = `http://localhost:${constants.basePort}`
77
await postFirstUser({
88
email: constants.email,
99
organization: constants.organization,

site/e2e/playwright.config.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { PlaywrightTestConfig } from "@playwright/test"
22
import * as path from "path"
3+
import { basePort } from "./constants"
34

45
const config: PlaywrightTestConfig = {
56
testDir: "tests",
@@ -8,8 +9,11 @@ const config: PlaywrightTestConfig = {
89
// Create junit report file for upload to DataDog
910
reporter: [["junit", { outputFile: "test-results/junit.xml" }]],
1011

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.
1115
use: {
12-
baseURL: "http://localhost:3000",
16+
baseURL: `http://localhost:${basePort}`,
1317
video: "retain-on-failure",
1418
},
1519

@@ -21,7 +25,7 @@ const config: PlaywrightTestConfig = {
2125
__dirname,
2226
"../../cmd/coder/main.go",
2327
)} server --in-memory`,
24-
port: 3000,
28+
port: basePort,
2529
timeout: 120 * 10000,
2630
reuseExistingServer: false,
2731
},

0 commit comments

Comments
 (0)