diff --git a/test/puppeteer.js b/test/puppeteer.js index ab96b54..b05a206 100755 --- a/test/puppeteer.js +++ b/test/puppeteer.js @@ -75,9 +75,9 @@ async function test(port) { for (const {url, js, screenshot} of testPages) { waitingPromiseInfo = makePromiseInfo(); console.log(`===== [ ${url} ] =====`); - if (js) { - await page.evaluateOnNewDocument(js); - } + const id = js + ? await page.evaluateOnNewDocument(js) + : undefined; await page.goto(url); await page.waitForNetworkIdle(); if (js) { @@ -95,6 +95,9 @@ async function test(port) { const path = `${dir}/${name}.png`; await page.screenshot({path}); } + if (js) { + await page.removeScriptToEvaluateOnNewDocument(id.identifier); + } } await browser.close(); diff --git a/test/tests/gpu-info.js b/test/tests/gpu-info.js index c738721..720953d 100644 --- a/test/tests/gpu-info.js +++ b/test/tests/gpu-info.js @@ -10,7 +10,7 @@ function objLikeToObj(objLike) { export async function getInfo() { const adapter = await navigator.gpu.requestAdapter(); - const info = adapter?.info ?? await adapter?.requestAdapterInfo() ?? {}; + const info = adapter?.info || await adapter?.requestAdapterInfo() || {error: 'no info'}; const title = JSON.stringify(objLikeToObj(info), null, 2); describe('gpu info', () => {