refactor: move test dir to jest e2e config
This commit is contained in:
parent
6b3db06c7a
commit
bd55cb94be
|
@ -1,16 +1,26 @@
|
|||
/// <reference types="jest-playwright-preset" />
|
||||
|
||||
beforeAll(async () => {
|
||||
await page.goto("https://whatismybrowser.com/")
|
||||
})
|
||||
|
||||
test("should display correct browser", async () => {
|
||||
const browser = await page.$eval(".string-major", (el) => el.innerHTML)
|
||||
// This test is for nothing more than to make sure
|
||||
// tests are running in multiple browsers
|
||||
describe("Browser gutcheck", () => {
|
||||
beforeEach(async () => {
|
||||
await jestPlaywright.resetBrowser()
|
||||
})
|
||||
|
||||
test("should display correct browser", async () => {
|
||||
const displayNames = {
|
||||
chromium: "Chrome",
|
||||
firefox: "Firefox",
|
||||
webkit: "Safari",
|
||||
}
|
||||
expect(browser).toContain(displayNames[browserName])
|
||||
const userAgent = await page.evaluate("navigator.userAgent")
|
||||
|
||||
if (browserName === "firefox") {
|
||||
expect(userAgent).toContain(displayNames[browserName])
|
||||
}
|
||||
|
||||
if (browserName === "chromium") {
|
||||
expect(userAgent).toContain(displayNames[browserName])
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { chromium, Page, Browser, BrowserContext } from "playwright"
|
||||
import { CODE_SERVER_ADDRESS, PASSWORD, E2E_VIDEO_DIR } from "../utils/constants"
|
||||
import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
|
||||
|
||||
describe("logout", () => {
|
||||
let browser: Browser
|
||||
|
@ -8,9 +8,7 @@ describe("logout", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
browser = await chromium.launch()
|
||||
context = await browser.newContext({
|
||||
recordVideo: { dir: E2E_VIDEO_DIR },
|
||||
})
|
||||
context = await browser.newContext()
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { chromium, Page, Browser, BrowserContext, Cookie } from "playwright"
|
||||
import { hash } from "../../src/node/util"
|
||||
import { CODE_SERVER_ADDRESS, PASSWORD, STORAGE, E2E_VIDEO_DIR } from "../utils/constants"
|
||||
import { CODE_SERVER_ADDRESS, PASSWORD, STORAGE } from "../utils/constants"
|
||||
import { createCookieIfDoesntExist } from "../utils/helpers"
|
||||
|
||||
describe("Open Help > About", () => {
|
||||
|
@ -45,7 +45,6 @@ describe("Open Help > About", () => {
|
|||
|
||||
context = await browser.newContext({
|
||||
storageState: { cookies: maybeUpdatedCookies },
|
||||
recordVideo: { dir: E2E_VIDEO_DIR },
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -12,6 +12,14 @@ const config: Config.InitialOptions = {
|
|||
// TODO enable on webkit as well
|
||||
// waiting on https://github.com/playwright-community/jest-playwright/issues/659
|
||||
browsers: ["chromium", "firefox"],
|
||||
// If there's a page error, we don't exit
|
||||
// i.e. something logged in the console
|
||||
exitOnPageError: false,
|
||||
contextOptions: {
|
||||
recordVideo: {
|
||||
dir: "./test/e2e/videos",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
testPathIgnorePatterns: ["/node_modules/", "/lib/", "/out/", "test/unit"],
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
export const CODE_SERVER_ADDRESS = process.env.CODE_SERVER_ADDRESS || "http://localhost:8080"
|
||||
export const PASSWORD = process.env.PASSWORD || "e45432jklfdsab"
|
||||
export const STORAGE = process.env.STORAGE || ""
|
||||
export const E2E_VIDEO_DIR = "./test/e2e/videos"
|
||||
|
|
Loading…
Reference in New Issue