mirror of
https://github.com/coder/code-server.git
synced 2024-12-23 09:42:24 +03:00
refactor: rename e2e test to loginPage
This commit is contained in:
parent
bd55cb94be
commit
1782f2a239
@ -7,7 +7,7 @@ describe("Browser gutcheck", () => {
|
|||||||
await jestPlaywright.resetBrowser()
|
await jestPlaywright.resetBrowser()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should display correct browser", async () => {
|
test("should display correct browser based on userAgent", async () => {
|
||||||
const displayNames = {
|
const displayNames = {
|
||||||
chromium: "Chrome",
|
chromium: "Chrome",
|
||||||
firefox: "Firefox",
|
firefox: "Firefox",
|
||||||
@ -15,11 +15,15 @@ describe("Browser gutcheck", () => {
|
|||||||
}
|
}
|
||||||
const userAgent = await page.evaluate("navigator.userAgent")
|
const userAgent = await page.evaluate("navigator.userAgent")
|
||||||
|
|
||||||
|
if (browserName === "chromium") {
|
||||||
|
expect(userAgent).toContain(displayNames[browserName])
|
||||||
|
}
|
||||||
|
|
||||||
if (browserName === "firefox") {
|
if (browserName === "firefox") {
|
||||||
expect(userAgent).toContain(displayNames[browserName])
|
expect(userAgent).toContain(displayNames[browserName])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browserName === "chromium") {
|
if (browserName === "webkit") {
|
||||||
expect(userAgent).toContain(displayNames[browserName])
|
expect(userAgent).toContain(displayNames[browserName])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -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")
|
|
||||||
})
|
|
15
test/e2e/loginPage.test.ts
Normal file
15
test/e2e/loginPage.test.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/// <reference types="jest-playwright-preset" />
|
||||||
|
|
||||||
|
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")
|
||||||
|
})
|
||||||
|
})
|
@ -9,9 +9,11 @@ const config: Config.InitialOptions = {
|
|||||||
globalSetup: "<rootDir>/utils/globalSetup.ts",
|
globalSetup: "<rootDir>/utils/globalSetup.ts",
|
||||||
testEnvironmentOptions: {
|
testEnvironmentOptions: {
|
||||||
"jest-playwright": {
|
"jest-playwright": {
|
||||||
// TODO enable on webkit as well
|
// TODO(@jsjoeio) enable on webkit and firefox
|
||||||
// waiting on https://github.com/playwright-community/jest-playwright/issues/659
|
// waiting on next playwright release
|
||||||
browsers: ["chromium", "firefox"],
|
// - 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
|
// If there's a page error, we don't exit
|
||||||
// i.e. something logged in the console
|
// i.e. something logged in the console
|
||||||
exitOnPageError: false,
|
exitOnPageError: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user