Skip to content

Commit

Permalink
test: bring page to front to ensure chrome picks it as active
Browse files Browse the repository at this point in the history
  • Loading branch information
ruifigueira committed Sep 30, 2024
1 parent 4442175 commit f2052db
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/crx/crxRecorderTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ export const test = crxTest.extend<{
let recorderPage = context.pages().find(p => p.url().startsWith(`chrome-extension://${extensionId}`));
const recorderPagePromise = recorderPage ? undefined : context.waitForEvent('page');

await extensionServiceWorker.evaluate(async (url) => {
await page.bringToFront();
await extensionServiceWorker.evaluate(async () => {
// ensure we're in test mode
_setUnderTest();
const [tab] = await chrome.tabs.query({ url, active: true, currentWindow: true });
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
await attach(tab);
}, page.url());
});

recorderPage = recorderPage ?? (await recorderPagePromise)!;

Expand Down

0 comments on commit f2052db

Please sign in to comment.