Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #786 #787

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion tests/e2e/utils/extension-path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@
*/
export const getChromeExtensionPath = async (browser: WebdriverIO.Browser) => {
await browser.url('chrome://extensions/');
const extensionItem = await $('extensions-item').getElement();
/**
* https://webdriver.io/docs/extension-testing/web-extensions/#test-popup-modal-in-chrome
* ```ts
* const extensionItem = await $('extensions-item').getElement();
* ```
* The above code is not working. I guess it's because the shadow root is not accessible.
* So I used the following code to access the shadow root manually.
*
* @url https://github.com/webdriverio/webdriverio/issues/13521
* @url https://github.com/Jonghakseo/chrome-extension-boilerplate-react-vite/issues/786
*/
const extensionItem = await (async () => {
const extensionsManager = await $('extensions-manager').getElement();
const itemList = await extensionsManager.shadow$('#container > #viewManager > extensions-item-list');
return await itemList.shadow$('extensions-item');
})();

const extensionId = await extensionItem.getAttribute('id');

if (!extensionId) {
Expand Down
Loading