From 0390d98a4ea45bab45c8d304414b45931fa5bbc6 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 3 Aug 2021 09:10:47 +0200 Subject: [PATCH] web tests - print page errors to console //cc @lramos15 this would have detected the missing module --- test/automation/src/playwrightDriver.ts | 7 +++++++ test/integration/browser/src/index.ts | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/test/automation/src/playwrightDriver.ts b/test/automation/src/playwrightDriver.ts index 2d4bd6ba372..af37c135dde 100644 --- a/test/automation/src/playwrightDriver.ts +++ b/test/automation/src/playwrightDriver.ts @@ -188,6 +188,13 @@ export function connect(options: Options = {}): Promise<{ client: IDisposable, d await context.tracing.start({ screenshots: true, snapshots: true }); const page = await context.newPage(); await page.setViewportSize({ width, height }); + page.on('pageerror', async error => console.error(`Playwright ERROR: page error: ${error}`)); + page.on('crash', page => console.error('Playwright ERROR: page crash')); + page.on('response', async response => { + if (response.status() >= 400) { + console.error(`Playwright ERROR: HTTP status ${response.status()} for ${response.url()}`); + } + }); const payloadParam = `[["enableProposedApi",""],["skipWelcome","true"]]`; await page.goto(`${endpoint}&folder=vscode-remote://localhost:9888${URI.file(workspacePath!).path}&payload=${payloadParam}`); const result = { diff --git a/test/integration/browser/src/index.ts b/test/integration/browser/src/index.ts index 0285d6bb547..8755974374a 100644 --- a/test/integration/browser/src/index.ts +++ b/test/integration/browser/src/index.ts @@ -38,6 +38,14 @@ async function runTestsInBrowser(browserType: BrowserType, endpoint: url.UrlWith const page = await context.newPage(); await page.setViewportSize({ width, height }); + page.on('pageerror', async error => console.error(`Playwright ERROR: page error: ${error}`)); + page.on('crash', page => console.error('Playwright ERROR: page crash')); + page.on('response', async response => { + if (response.status() >= 400) { + console.error(`Playwright ERROR: HTTP status ${response.status()} for ${response.url()}`); + } + }); + const host = endpoint.host; const protocol = 'vscode-remote';