Skip to content

Commit e39fe1f

Browse files
committed
refactor: rename e2e test to loginPage
1 parent f3c678f commit e39fe1f

File tree

4 files changed

+26
-29
lines changed

4 files changed

+26
-29
lines changed

test/e2e/browser.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@ describe("Browser gutcheck", () => {
77
await jestPlaywright.resetBrowser()
88
})
99

10-
test("should display correct browser", async () => {
10+
test("should display correct browser based on userAgent", async () => {
1111
const displayNames = {
1212
chromium: "Chrome",
1313
firefox: "Firefox",
1414
webkit: "Safari",
1515
}
1616
const userAgent = await page.evaluate("navigator.userAgent")
1717

18+
if (browserName === "chromium") {
19+
expect(userAgent).toContain(displayNames[browserName])
20+
}
21+
1822
if (browserName === "firefox") {
1923
expect(userAgent).toContain(displayNames[browserName])
2024
}
2125

22-
if (browserName === "chromium") {
26+
if (browserName === "webkit") {
2327
expect(userAgent).toContain(displayNames[browserName])
2428
}
2529
})

test/e2e/e2e.test.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/e2e/loginPage.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// <reference types="jest-playwright-preset" />
2+
3+
import { CODE_SERVER_ADDRESS } from "../utils/constants"
4+
5+
describe("login page", () => {
6+
beforeEach(async () => {
7+
await jestPlaywright.resetContext()
8+
await page.goto(CODE_SERVER_ADDRESS)
9+
})
10+
11+
it("should see the login page", async () => {
12+
// It should send us to the login page
13+
expect(await page.title()).toBe("code-server login")
14+
})
15+
})

test/jest.e2e.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ const config: Config.InitialOptions = {
99
globalSetup: "<rootDir>/utils/globalSetup.ts",
1010
testEnvironmentOptions: {
1111
"jest-playwright": {
12-
// TODO enable on webkit as well
13-
// waiting on https://github.com/playwright-community/jest-playwright/issues/659
14-
browsers: ["chromium", "firefox"],
12+
// TODO(@jsjoeio) enable on webkit and firefox
13+
// waiting on next playwright release
14+
// - https://github.com/microsoft/playwright/issues/6009#event-4536210890
15+
// - https://github.com/microsoft/playwright/issues/6020
16+
browsers: ["chromium"],
1517
// If there's a page error, we don't exit
1618
// i.e. something logged in the console
1719
exitOnPageError: false,

0 commit comments

Comments
 (0)