From bb24ce48126bdb8b099bb8c7b5fc8744290c855f Mon Sep 17 00:00:00 2001 From: Manvel Saroyan Date: Sun, 30 Apr 2023 17:14:49 +0400 Subject: [PATCH] issue #112 - updated puppeteer version and fixed BG page retrieval --- package.json | 2 +- tests/main.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 4bb960b..b9cf561 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "cba-components": "github:browser-automation/cba-components#master", "copy-webpack-plugin": "^11.0.0", "csso": "^5.0.5", - "puppeteer": "^5.3.0", + "puppeteer": "^19.11.1", "webextension-polyfill": "^0.10.0", "webpack": "^5.80.0" }, diff --git a/tests/main.js b/tests/main.js index 962b157..9a503ea 100644 --- a/tests/main.js +++ b/tests/main.js @@ -40,9 +40,11 @@ function run() "--no-sandbox" ]}); page = await browser.newPage(); - const extensionName = "Chromium browser automation"; const targets = await browser.targets(); - const backgroundPageTarget = targets.find(({ _targetInfo }) => _targetInfo.title.startsWith(extensionName) && _targetInfo.type === "background_page"); + const backgroundPageTarget = targets.find((target) => + target.url().startsWith("chrome-extension://") && target.type() === "background_page" + ); + backgroundPage = await backgroundPageTarget.page(); const [,, extensionID] = backgroundPage.url().split('/');