11import { chromium , Page , Browser , BrowserContext , Cookie } from "playwright"
22import { createCookieIfDoesntExist } from "../src/common/util"
33import { hash } from "../src/node/util"
4+ import { CODE_SERVER_ADDRESS , PASSWORD , STORAGE } from "./constants"
45
56async function setTimeoutPromise ( milliseconds : number ) : Promise < void > {
67 return new Promise ( ( resolve , _ ) => {
@@ -18,12 +19,12 @@ describe("go home", () => {
1819 beforeAll ( async ( ) => {
1920 browser = await chromium . launch ( )
2021 // Create a new context with the saved storage state
21- const storageState = JSON . parse ( process . env . STORAGE || "{}" )
22+ const storageState = JSON . parse ( STORAGE ) || { }
2223
2324 const cookieToStore = {
2425 sameSite : "Lax" as const ,
2526 name : "key" ,
26- value : hash ( process . env . PASSWORD || "" ) ,
27+ value : hash ( PASSWORD ) ,
2728 domain : "localhost" ,
2829 path : "/" ,
2930 expires : - 1 ,
@@ -72,7 +73,7 @@ describe("go home", () => {
7273 it ( "should see a 'Go Home' button in the Application Menu that goes to /healthz" , async ( ) => {
7374 let requestedGoHomeUrl = false
7475
75- const GO_HOME_URL = `${ process . env . CODE_SERVER_ADDRESS } /healthz`
76+ const GO_HOME_URL = `${ CODE_SERVER_ADDRESS } /healthz`
7677 page . on ( "request" , ( request ) => {
7778 // This ensures that we did make a request to the GO_HOME_URL
7879 // Most reliable way to test button
@@ -89,7 +90,7 @@ describe("go home", () => {
8990
9091 // waitUntil: "domcontentloaded"
9192 // In case the page takes a long time to load
92- await page . goto ( process . env . CODE_SERVER_ADDRESS || "http://localhost:8080" , { waitUntil : "domcontentloaded" } )
93+ await page . goto ( CODE_SERVER_ADDRESS , { waitUntil : "domcontentloaded" } )
9394
9495 // Click the Home menu
9596 await page . click ( ".home-bar ul[aria-label='Home'] li" )
0 commit comments