@@ -3,14 +3,6 @@ import { createCookieIfDoesntExist } from "../src/common/util"
33import { hash } from "../src/node/util"
44import { CODE_SERVER_ADDRESS , PASSWORD , STORAGE } from "./constants"
55
6- async function setTimeoutPromise ( milliseconds : number ) : Promise < void > {
7- return new Promise ( ( resolve , _ ) => {
8- setTimeout ( ( ) => {
9- resolve ( )
10- } , milliseconds )
11- } )
12- }
13-
146describe ( "go home" , ( ) => {
157 let browser : Browser
168 let page : Page
@@ -71,18 +63,7 @@ describe("go home", () => {
7163
7264 // NOTE: this test will fail if you do not run code-server with --home $CODE_SERVER_ADDRESS/healthz
7365 it ( "should see a 'Go Home' button in the Application Menu that goes to /healthz" , async ( ) => {
74- let requestedGoHomeUrl = false
75-
7666 const GO_HOME_URL = `${ CODE_SERVER_ADDRESS } /healthz`
77- page . on ( "request" , ( request ) => {
78- // This ensures that we did make a request to the GO_HOME_URL
79- // Most reliable way to test button
80- // because we don't care if the request has a response
81- // only that it was made
82- if ( request . url ( ) === GO_HOME_URL ) {
83- requestedGoHomeUrl = true
84- }
85- } )
8667 // Sometimes a dialog shows up when you navigate
8768 // asking if you're sure you want to leave
8869 // so we listen if it comes, we accept it
@@ -101,10 +82,7 @@ describe("go home", () => {
10182 // Click it and navigate to /healthz
10283 // NOTE: ran into issues of it failing intermittently
10384 // without having button: "middle"
104- await Promise . all ( [
105- page . waitForNavigation ( ) ,
106- page . click ( goHomeButton , { button : "middle" } )
107- ] )
85+ await Promise . all ( [ page . waitForNavigation ( ) , page . click ( goHomeButton , { button : "middle" } ) ] )
10886 expect ( page . url ( ) ) . toBe ( GO_HOME_URL )
10987 } )
11088} )
0 commit comments