From d9c016ba1add532eb082c27006915ead3c8b5cd8 Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:02:40 +0100 Subject: [PATCH] Log page output --- tests/test-sites.spec.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test-sites.spec.ts b/tests/test-sites.spec.ts index 43eecf2..fda9b90 100644 --- a/tests/test-sites.spec.ts +++ b/tests/test-sites.spec.ts @@ -1,6 +1,11 @@ import { test, expect, TestInfo, Page } from "@playwright/test"; test.beforeEach(async ({ page }) => { + /** Bind the console to the Playwright test runner, rather than the browser */ + const logOuter = console.log; + page.on("console", msg => { + logOuter(`[console.${msg.type()}] ${msg.text()}`); + }); page.on("pageerror", msg => { expect.soft(false, `Error thrown:\n${msg.message}`).toBeTruthy(); });