1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-26 12:15:26 +00:00

refactor: rename e2e test to loginPage

This commit is contained in:
Joe Previte 2021-03-30 16:07:51 -07:00
parent bd55cb94be
commit 1782f2a239
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24
4 changed files with 26 additions and 29 deletions

View File

@ -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])
}
})

View File

@ -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")
})

View 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")
})
})

View File

@ -9,9 +9,11 @@ const config: Config.InitialOptions = {
globalSetup: "<rootDir>/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,