Skip to content

Commit

Permalink
test: update ext-id finding #1051
Browse files Browse the repository at this point in the history
  • Loading branch information
escapedcat committed Jul 13, 2022
1 parent 7cd1349 commit 7167385
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions tests/e2e/helpers/loadExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,17 @@ export const loadExtension = async () => {

// trick to bring the new welcome page to the front
await delay(1000);

const page = await browser.newPage();
await page.setViewport({ width: 1366, height: 768 });

// get extensionId
// https://github.com/microsoft/playwright/issues/5593#issuecomment-949813218
await page.goto("chrome://inspect/#extensions");
// https://techoverflow.net/2019/01/26/puppeteer-get-text-content-inner-html-of-an-element/
// TODO: check if just `page.$('...') will work because it should:
// https://puppeteer.github.io/puppeteer/docs/puppeteer.elementhandle
const url = await page.evaluate(
() =>
(
document.querySelector(
'#extensions-list div[class="url"]'
) as HTMLElement
).innerText
const targets = await browser.targets();
const albyExtensionServiceWorkerTarget = targets.find(
(target) => target.url().indexOf("chrome-extension") > -1
);
if (!albyExtensionServiceWorkerTarget) return;

const url = albyExtensionServiceWorkerTarget.url();
const [, , extensionId] = url.split("/");

const extensionOptionHtml = "welcome.html";
Expand Down

0 comments on commit 7167385

Please sign in to comment.