Skip to content

Commit

Permalink
clean up injected js and try more gpu info
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Jul 2, 2024
1 parent ef736f4 commit ca51657
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions test/puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion test/tests/gpu-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit ca51657

Please sign in to comment.