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 978c403d5..642ff7a5d 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 6d4982b63..18be48b70 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 29a232351..bf2749326 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 eee4ae3a2..9016ded47 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 6ffce5ca9..b88c0963c 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 fd63766d3..38ac4e215 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" }) })