Archived
1
0

feat: add logger to tests

This commit is contained in:
Joe Previte 2021-04-02 16:49:01 -07:00
parent f241e38907
commit dd80eed5b0
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24
6 changed files with 38 additions and 6 deletions

View File

@ -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 () => {

View File

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

View File

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

View File

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

View File

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

View File

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