Archived
1
0

refactor: use playwright-test syntax for e2e tests

This commit is contained in:
Joe Previte
2021-04-13 12:02:52 -07:00
parent 08cd2d8191
commit 52586706c4
6 changed files with 47 additions and 69 deletions

View File

@ -1,35 +1,22 @@
/// <reference types="jest-playwright-preset" />
import { test, expect } from "@playwright/test"
// This test is for nothing more than to make sure
// tests are running in multiple browsers
describe("Browser gutcheck", () => {
beforeEach(async () => {
await jestPlaywright.resetBrowser({
logger: {
isEnabled: (name) => name === "browser",
log: (name, severity, message, args) => console.log(`${name} ${message}`),
},
})
})
test("should display correct browser based on userAgent", async ({ page, browserName }) => {
const displayNames = {
chromium: "Chrome",
firefox: "Firefox",
webkit: "Safari",
}
const userAgent = await page.evaluate("navigator.userAgent")
test("should display correct browser based on userAgent", async () => {
const displayNames = {
chromium: "Chrome",
firefox: "Firefox",
webkit: "Safari",
}
const userAgent = await page.evaluate("navigator.userAgent")
if (browserName === "chromium") {
expect(userAgent).toContain(displayNames[browserName])
}
if (browserName === "chromium") {
expect(userAgent).toContain(displayNames[browserName])
}
if (browserName === "firefox") {
expect(userAgent).toContain(displayNames[browserName])
}
if (browserName === "firefox") {
expect(userAgent).toContain(displayNames[browserName])
}
if (browserName === "webkit") {
expect(userAgent).toContain(displayNames[browserName])
}
})
if (browserName === "webkit") {
expect(userAgent).toContain(displayNames[browserName])
}
})