Archived
1
0

refactor: move test dir to jest e2e config

This commit is contained in:
Joe Previte
2021-03-30 12:24:51 -07:00
parent 6b3db06c7a
commit bd55cb94be
5 changed files with 32 additions and 18 deletions

View File

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