1 import { chromium, firefox, webkit } from 'playwright';
2 import { strict as assert } from 'assert';
4 for (const browserType of [chromium, firefox]) { // We'd like to test webkit, but playwright doesn't support it on Debian (?!)
6 if (browserType == chromium)
7 browser = await browserType.launch(["--js-flags=\"--expose-gc\""]);
9 browser = await browserType.launch();
10 const context = await browser.newContext();
11 const page = await context.newPage();
12 page.on('console', async msg => {
15 for (const arg of msg.args())
16 values.push(await arg.jsonValue());
17 console.log(...values);
18 } catch (_) { /* sometimes this gets hit if we're logging while the browser shuts down */ }
20 await page.goto('http://localhost:8000/test/index.html');
22 // On chromium we expose the GC and can run it manually, otherwise we really can't leak-check
23 if (browserType == chromium) {
24 ret = await page.evaluate(() => { return test_runner('../liblightningjs.wasm', true); });
26 ret = await page.evaluate(() => { return test_runner('../liblightningjs.wasm', false); });
30 await browser.close();