diff --git a/test/e2e/routes.test.ts b/test/e2e/routes.test.ts index c15b9f712..b93618bc2 100644 --- a/test/e2e/routes.test.ts +++ b/test/e2e/routes.test.ts @@ -17,7 +17,7 @@ describe("VS Code Routes", ["--disable-workspace-trust"], {}, async () => { const url = new URL(codeServerPage.page.url()) expect(url.pathname).toBe(route) - // TODO@jsjoeio + // TODO@jsjoeio // now that we are in a proper browser instead of scraping the HTML we // could possibly intercept requests to make sure assets are loading from // the right spot. @@ -73,43 +73,33 @@ describe( }, ) -describe( - "VS Code Routes with no workspace or folder", - ["--disable-workspace-trust"], - {}, - async () => { - test("should redirect to last query folder/workspace", async ({ codeServerPage }) => { - const folder = process.env.CODE_FOLDER_DIR - const workspace = process.env.CODE_WORKSPACE_DIR - await codeServerPage.navigate(`/?folder=${folder}&workspace=${workspace}`) +describe("VS Code Routes with no workspace or folder", ["--disable-workspace-trust"], {}, async () => { + test("should redirect to last query folder/workspace", async ({ codeServerPage }) => { + const folder = process.env.CODE_FOLDER_DIR + const workspace = process.env.CODE_WORKSPACE_DIR + await codeServerPage.navigate(`/?folder=${folder}&workspace=${workspace}`) - // If you visit again without query parameters it will re-attach them by - // redirecting. It should always redirect to the same route. - for (const route of routes) { - await codeServerPage.navigate(route) - const url = new URL(codeServerPage.page.url()) - expect(url.pathname).toBe(route) - expect(url.search).toBe(`?folder=${folder}&workspace=${workspace}`) - } - }) - }, -) + // If you visit again without query parameters it will re-attach them by + // redirecting. It should always redirect to the same route. + for (const route of routes) { + await codeServerPage.navigate(route) + const url = new URL(codeServerPage.page.url()) + expect(url.pathname).toBe(route) + expect(url.search).toBe(`?folder=${folder}&workspace=${workspace}`) + } + }) +}) -describe( - "VS Code Routes with no workspace or folder", - ["--disable-workspace-trust"], - {}, - async () => { - test("should not redirect if ew passed in", async ({ codeServerPage }) => { - const folder = process.env.CODE_FOLDER_DIR - const workspace = process.env.CODE_WORKSPACE_DIR - await codeServerPage.navigate(`/?folder=${folder}&workspace=${workspace}`) +describe("VS Code Routes with no workspace or folder", ["--disable-workspace-trust"], {}, async () => { + test("should not redirect if ew passed in", async ({ codeServerPage }) => { + const folder = process.env.CODE_FOLDER_DIR + const workspace = process.env.CODE_WORKSPACE_DIR + await codeServerPage.navigate(`/?folder=${folder}&workspace=${workspace}`) - // Closing the folder should stop the redirecting. - await codeServerPage.navigate("/?ew=true") - let url = new URL(codeServerPage.page.url()) - expect(url.pathname).toBe("/") - expect(url.search).toBe("?ew=true") - }) - }, -) \ No newline at end of file + // Closing the folder should stop the redirecting. + await codeServerPage.navigate("/?ew=true") + let url = new URL(codeServerPage.page.url()) + expect(url.pathname).toBe("/") + expect(url.search).toBe("?ew=true") + }) +})