File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 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.
26export const username = "developer"
37export const password = "password"
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { postFirstUser } from "../src/api/api"
33import * as constants from "./constants"
44
55const 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 ,
Original file line number Diff line number Diff line change 11import { PlaywrightTestConfig } from "@playwright/test"
22import * as path from "path"
3+ import { basePort } from "./constants"
34
45const 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 } ,
You can’t perform that action at this time.
0 commit comments