refactor: move test dir to jest e2e config
This commit is contained in:
@ -1,16 +1,26 @@
|
||||
/// <reference types="jest-playwright-preset" />
|
||||
|
||||
beforeAll(async () => {
|
||||
await page.goto("https://whatismybrowser.com/")
|
||||
})
|
||||
// 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 browser = await page.$eval(".string-major", (el) => el.innerHTML)
|
||||
test("should display correct browser", async () => {
|
||||
const displayNames = {
|
||||
chromium: "Chrome",
|
||||
firefox: "Firefox",
|
||||
webkit: "Safari",
|
||||
}
|
||||
const userAgent = await page.evaluate("navigator.userAgent")
|
||||
|
||||
const displayNames = {
|
||||
chromium: "Chrome",
|
||||
firefox: "Firefox",
|
||||
webkit: "Safari",
|
||||
}
|
||||
expect(browser).toContain(displayNames[browserName])
|
||||
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 },
|
||||
})
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user