From dd80eed5b04ac96175321a8e030520939802d2f5 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Fri, 2 Apr 2021 16:49:01 -0700 Subject: [PATCH] feat: add logger to tests --- test/e2e/browser.test.ts | 7 ++++++- test/e2e/globalSetup.test.ts | 8 +++++++- test/e2e/login.test.ts | 7 ++++++- test/e2e/loginPage.test.ts | 7 ++++++- test/e2e/logout.test.ts | 7 ++++++- test/e2e/openHelpAbout.test.ts | 8 +++++++- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/test/e2e/browser.test.ts b/test/e2e/browser.test.ts index 978c403d..642ff7a5 100644 --- a/test/e2e/browser.test.ts +++ b/test/e2e/browser.test.ts @@ -4,7 +4,12 @@ // tests are running in multiple browsers describe("Browser gutcheck", () => { 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 () => { diff --git a/test/e2e/globalSetup.test.ts b/test/e2e/globalSetup.test.ts index 6d4982b6..18be48b7 100644 --- a/test/e2e/globalSetup.test.ts +++ b/test/e2e/globalSetup.test.ts @@ -8,7 +8,13 @@ describe("globalSetup", () => { // Create a new context with the saved storage state // so we don't have to logged in 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" }) }) diff --git a/test/e2e/login.test.ts b/test/e2e/login.test.ts index 29a23235..bf274932 100644 --- a/test/e2e/login.test.ts +++ b/test/e2e/login.test.ts @@ -3,7 +3,12 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants" describe("login", () => { 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" }) }) diff --git a/test/e2e/loginPage.test.ts b/test/e2e/loginPage.test.ts index eee4ae3a..9016ded4 100644 --- a/test/e2e/loginPage.test.ts +++ b/test/e2e/loginPage.test.ts @@ -4,7 +4,12 @@ import { CODE_SERVER_ADDRESS } from "../utils/constants" describe("login page", () => { 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" }) }) diff --git a/test/e2e/logout.test.ts b/test/e2e/logout.test.ts index 6ffce5ca..b88c0963 100644 --- a/test/e2e/logout.test.ts +++ b/test/e2e/logout.test.ts @@ -3,7 +3,12 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants" describe("logout", () => { 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" }) }) diff --git a/test/e2e/openHelpAbout.test.ts b/test/e2e/openHelpAbout.test.ts index fd63766d..38ac4e21 100644 --- a/test/e2e/openHelpAbout.test.ts +++ b/test/e2e/openHelpAbout.test.ts @@ -6,7 +6,13 @@ describe("Open Help > About", () => { // Create a new context with the saved storage state // so we don't have to logged in 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" }) })