mirror of https://git.tuxpa.in/a/code-server.git
feat: add logger to tests
This commit is contained in:
parent
f241e38907
commit
dd80eed5b0
|
@ -4,7 +4,12 @@
|
||||||
// tests are running in multiple browsers
|
// tests are running in multiple browsers
|
||||||
describe("Browser gutcheck", () => {
|
describe("Browser gutcheck", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await jestPlaywright.resetBrowser()
|
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 () => {
|
test("should display correct browser based on userAgent", async () => {
|
||||||
|
|
|
@ -8,7 +8,13 @@ describe("globalSetup", () => {
|
||||||
// Create a new context with the saved storage state
|
// Create a new context with the saved storage state
|
||||||
// so we don't have to logged in
|
// so we don't have to logged in
|
||||||
const storageState = JSON.parse(STORAGE) || {}
|
const storageState = JSON.parse(STORAGE) || {}
|
||||||
await jestPlaywright.resetContext({ storageState })
|
await jestPlaywright.resetContext({
|
||||||
|
storageState,
|
||||||
|
logger: {
|
||||||
|
isEnabled: (name, severity) => name === "browser",
|
||||||
|
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||||
|
},
|
||||||
|
})
|
||||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,12 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
|
||||||
|
|
||||||
describe("login", () => {
|
describe("login", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await jestPlaywright.resetBrowser()
|
await jestPlaywright.resetBrowser({
|
||||||
|
logger: {
|
||||||
|
isEnabled: (name, severity) => name === "browser",
|
||||||
|
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||||
|
},
|
||||||
|
})
|
||||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,12 @@ import { CODE_SERVER_ADDRESS } from "../utils/constants"
|
||||||
|
|
||||||
describe("login page", () => {
|
describe("login page", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await jestPlaywright.resetContext()
|
await jestPlaywright.resetContext({
|
||||||
|
logger: {
|
||||||
|
isEnabled: (name, severity) => name === "browser",
|
||||||
|
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||||
|
},
|
||||||
|
})
|
||||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,12 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
|
||||||
|
|
||||||
describe("logout", () => {
|
describe("logout", () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await jestPlaywright.resetBrowser()
|
await jestPlaywright.resetBrowser({
|
||||||
|
logger: {
|
||||||
|
isEnabled: (name, severity) => name === "browser",
|
||||||
|
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||||
|
},
|
||||||
|
})
|
||||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,13 @@ describe("Open Help > About", () => {
|
||||||
// Create a new context with the saved storage state
|
// Create a new context with the saved storage state
|
||||||
// so we don't have to logged in
|
// so we don't have to logged in
|
||||||
const storageState = JSON.parse(STORAGE) || {}
|
const storageState = JSON.parse(STORAGE) || {}
|
||||||
await jestPlaywright.resetContext({ storageState })
|
await jestPlaywright.resetContext({
|
||||||
|
storageState,
|
||||||
|
logger: {
|
||||||
|
isEnabled: (name, severity) => name === "browser",
|
||||||
|
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||||
|
},
|
||||||
|
})
|
||||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue