diff --git a/test/e2e/browser.test.ts b/test/e2e/browser.test.ts index 27e2f165..978c403d 100644 --- a/test/e2e/browser.test.ts +++ b/test/e2e/browser.test.ts @@ -7,7 +7,7 @@ describe("Browser gutcheck", () => { await jestPlaywright.resetBrowser() }) - test("should display correct browser", async () => { + test("should display correct browser based on userAgent", async () => { const displayNames = { chromium: "Chrome", firefox: "Firefox", @@ -15,11 +15,15 @@ describe("Browser gutcheck", () => { } const userAgent = await page.evaluate("navigator.userAgent") + if (browserName === "chromium") { + expect(userAgent).toContain(displayNames[browserName]) + } + if (browserName === "firefox") { expect(userAgent).toContain(displayNames[browserName]) } - if (browserName === "chromium") { + if (browserName === "webkit") { expect(userAgent).toContain(displayNames[browserName]) } }) diff --git a/test/e2e/e2e.test.ts b/test/e2e/e2e.test.ts deleted file mode 100644 index 4e60c6eb..00000000 --- a/test/e2e/e2e.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { chromium, Page, Browser } from "playwright" -import { CODE_SERVER_ADDRESS } from "../utils/constants" - -let browser: Browser -let page: Page - -beforeAll(async () => { - browser = await chromium.launch() -}) -afterAll(async () => { - await browser.close() -}) -beforeEach(async () => { - page = await browser.newPage() -}) -afterEach(async () => { - await page.close() -}) - -it("should see the login page", async () => { - await page.goto(CODE_SERVER_ADDRESS) - // It should send us to the login page - expect(await page.title()).toBe("code-server login") -}) diff --git a/test/e2e/loginPage.test.ts b/test/e2e/loginPage.test.ts new file mode 100644 index 00000000..ef85f8fc --- /dev/null +++ b/test/e2e/loginPage.test.ts @@ -0,0 +1,15 @@ +/// + +import { CODE_SERVER_ADDRESS } from "../utils/constants" + +describe("login page", () => { + beforeEach(async () => { + await jestPlaywright.resetContext() + await page.goto(CODE_SERVER_ADDRESS) + }) + + it("should see the login page", async () => { + // It should send us to the login page + expect(await page.title()).toBe("code-server login") + }) +}) diff --git a/test/jest.e2e.config.ts b/test/jest.e2e.config.ts index dd7af6f6..66653441 100644 --- a/test/jest.e2e.config.ts +++ b/test/jest.e2e.config.ts @@ -9,9 +9,11 @@ const config: Config.InitialOptions = { globalSetup: "/utils/globalSetup.ts", testEnvironmentOptions: { "jest-playwright": { - // TODO enable on webkit as well - // waiting on https://github.com/playwright-community/jest-playwright/issues/659 - browsers: ["chromium", "firefox"], + // TODO(@jsjoeio) enable on webkit and firefox + // waiting on next playwright release + // - https://github.com/microsoft/playwright/issues/6009#event-4536210890 + // - https://github.com/microsoft/playwright/issues/6020 + browsers: ["chromium"], // If there's a page error, we don't exit // i.e. something logged in the console exitOnPageError: false,