From: Matt Corallo Date: Mon, 17 Jan 2022 13:04:40 +0000 (+0000) Subject: [TS] Log console messages in browser tests via playwright X-Git-Tag: v0.0.105.0~4^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=commitdiff_plain;h=0ec2f12b9af8bd4f17570d87c10e52d3de6cf153 [TS] Log console messages in browser tests via playwright --- diff --git a/ts/test/browser.mjs b/ts/test/browser.mjs index 03b51414..0d9e9dd9 100644 --- a/ts/test/browser.mjs +++ b/ts/test/browser.mjs @@ -5,6 +5,12 @@ for (const browserType of [chromium, firefox]) { // We'd like to test webkit, bu const browser = await browserType.launch(); const context = await browser.newContext(); const page = await context.newPage(); + page.on('console', async msg => { + const values = []; + for (const arg of msg.args()) + values.push(await arg.jsonValue()); + console.log(...values); + }); await page.goto('http://localhost:8000/test/index.html'); const ret = await page.evaluate(() => { return test_runner('../liblightningjs.wasm');