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

Skip to content

chore: adding some quality of life Playwright comments #2726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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