Skip to content

Commit

Permalink
chore: adding some quality of life Playwright comments (#2726)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kira-Pilot committed Jun 29, 2022
1 parent d9668f7 commit 03fd063
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions site/e2e/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Our base port. It's important to run on 3000,
// which matches our api server
export const basePort = 3000

// Credentials for the default user when running in dev mode.
export const username = "developer"
export const password = "password"
Expand Down
2 changes: 1 addition & 1 deletion site/e2e/globalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { postFirstUser } from "../src/api/api"
import * as constants from "./constants"

const globalSetup = async (): Promise<void> => {
axios.defaults.baseURL = "http://localhost:3000"
axios.defaults.baseURL = `http://localhost:${constants.basePort}`
await postFirstUser({
email: constants.email,
organization: constants.organization,
Expand Down
8 changes: 6 additions & 2 deletions site/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PlaywrightTestConfig } from "@playwright/test"
import * as path from "path"
import { basePort } from "./constants"

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

// NOTE: if Playwright complains about the port being taken
// do not change the basePort (it must match our api server).
// Instead, simply run the test suite without running our local server.
use: {
baseURL: "http://localhost:3000",
baseURL: `http://localhost:${basePort}`,
video: "retain-on-failure",
},

Expand All @@ -21,7 +25,7 @@ const config: PlaywrightTestConfig = {
__dirname,
"../../cmd/coder/main.go",
)} server --in-memory`,
port: 3000,
port: basePort,
timeout: 120 * 10000,
reuseExistingServer: false,
},
Expand Down

0 comments on commit 03fd063

Please sign in to comment.