refactor: add note to test.sh about --home
This commit is contained in:
parent
2dc56ad4d7
commit
d0eece3d8f
@ -17,7 +17,8 @@ main() {
|
||||
echo " \$PASSWORD"
|
||||
echo " \$CODE_SERVER_ADDRESS"
|
||||
echo -e "\n"
|
||||
echo "Please make sure you have code-server running locally."
|
||||
echo "Please make sure you have code-server running locally with the flag:"
|
||||
echo " --home \$CODE_SERVER_ADDRESS/healthz "
|
||||
echo -e "\n"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -140,8 +140,8 @@ export interface Cookie {
|
||||
* Checks if a cookie exists in array of cookies
|
||||
*/
|
||||
export function checkForCookie(cookies: Array<Cookie>, key: string): boolean {
|
||||
// Check for at least one cookie where the name is equal to key
|
||||
return cookies.filter((cookie) => cookie.name === key).length > 0
|
||||
// Check for a cookie where the name is equal to key
|
||||
return Boolean(cookies.find((cookie) => cookie.name === key))
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,6 @@ describe("login", () => {
|
||||
// Create a new context with the saved storage state
|
||||
const storageState = JSON.parse(process.env.STORAGE || "")
|
||||
|
||||
//
|
||||
const cookieToStore = {
|
||||
sameSite: "Lax" as const,
|
||||
name: "key",
|
||||
@ -61,16 +60,20 @@ describe("login", () => {
|
||||
|
||||
// NOTE: this test will fail if you do not run code-server with --home $CODE_SERVER_ADDRESS/healthz
|
||||
it("should see a 'Go Home' button in the Application Menu that goes to /healthz", async (done) => {
|
||||
let requestedGoHomeUrl = false
|
||||
// Ideally, this test should pass and finish before the timeout set in the Jest config
|
||||
// However, if it doesn't, we don't want a memory leak so we set this backup timeout
|
||||
// Otherwise Jest may throw this error
|
||||
// "Jest did not exit one second after the test run has completed.
|
||||
// This usually means that there are asynchronous operations that weren't stopped in your tests.
|
||||
// Consider running Jest with `--detectOpenHandles` to troubleshoot this issue."
|
||||
const backupTimeout = setTimeout(() => done(), 20000)
|
||||
const backupTimeout = setTimeout(() => {
|
||||
// If it's not true by this point then the test should fail
|
||||
expect(requestedGoHomeUrl).toBeTruthy()
|
||||
done()
|
||||
}, 20000)
|
||||
|
||||
const GO_HOME_URL = `${process.env.CODE_SERVER_ADDRESS}/healthz`
|
||||
let requestedGoHomeUrl = false
|
||||
page.on("request", (request) => {
|
||||
// This ensures that we did make a request to the GO_HOME_URL
|
||||
// Most reliable way to test button
|
||||
|
Loading…
Reference in New Issue
Block a user