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