[Feature] Support testing Chrome extensions that utilize the Chrome side panel #26693
Description
Hi, my company's product is a Chrome extension that renders UI inside the Chrome side panel, using the chrome.sidePanel
API. I'm attaching a screenshot of our Chrome extension's UI, in case you are not familiar with the Chrome side panel.
My feature request is: Can you make it so Playwright can open the Chrome side panel and interact with the webpage that is rendered inside it?
This would allow us (and other Chrome extension authors) to create fully end-to-end tests for our extensions using Playwright.
I have reviewed the Playwright docs and API, and could not find a way to open the Chrome side panel. It is not possible to open the side panel programmatically from the extension service worker, as far as I know. The user has to click the extension icon. (If the user already has the side panel open, e.g. to view their bookmarks, they can also get to our extension's page using the dropdown at the top of the side panel.)
Once the side panel is open, we would need a way to get access to its Page
object from our Playwright test code.
Workaround for the time being
Our current plan for testing the application is to have Playwright interact directly with the extension service worker. We can use Playwright's ability to execute JavaScript in the service worker's context to mimic the communication the service worker normally receives from the side panel.
This will give us test coverage of our service worker and content scripts, which is much better than nothing. That said, ideally we would like a true end-to-end test that also covers the UI we render in the side panel.
Thank you for this awesome library!!!
Screenshot of our application in the Chrome side panel: