Archived
1
0
This repository has been archived on 2024-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
code-server/test/e2e/browser.test.ts

36 lines
988 B
TypeScript
Raw Normal View History

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