code-server/test/e2e/browser.test.ts

23 lines
604 B
TypeScript
Raw Normal View History

import { test, expect } from "@playwright/test"
2021-03-30 18:35:36 +00:00
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")
if (browserName === "chromium") {
expect(userAgent).toContain(displayNames[browserName])
}
2021-03-30 18:35:36 +00:00
if (browserName === "firefox") {
expect(userAgent).toContain(displayNames[browserName])
}
2021-03-30 23:07:51 +00:00
if (browserName === "webkit") {
expect(userAgent).toContain(displayNames[browserName])
}
2021-03-30 18:35:36 +00:00
})