chore: adding some quality of life Playwright comments (#2726)

This commit is contained in:
Kira Pilot
2022-06-29 14:25:56 -04:00
committed by GitHub
parent d9668f7a4e
commit 03fd063d20
3 changed files with 11 additions and 3 deletions
+4
View File
@@ -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"
+1 -1
View File
@@ -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,
+6 -2
View File
@@ -1,5 +1,6 @@
import { PlaywrightTestConfig } from "@playwright/test"
import * as path from "path"
import { basePort } from "./constants"
const config: PlaywrightTestConfig = {
testDir: "tests",
@@ -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",
},
@@ -21,7 +25,7 @@ const config: PlaywrightTestConfig = {
__dirname,
"../../cmd/coder/main.go",
)} server --in-memory`,
port: 3000,
port: basePort,
timeout: 120 * 10000,
reuseExistingServer: false,
},