[TS] Log console messages in browser tests via playwright
[ldk-java] / ts / test / browser.mjs
index 03b5141415f860e53d4cdc9b31c1bfbdf0e1e086..0d9e9dd9ec414854fe42a7189046190c0f830914 100644 (file)
@@ -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');