-
Notifications
You must be signed in to change notification settings - Fork 56
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
request: APIs and infrastructure to simplify cross-browser automated testing of extensions #19
Comments
I’m especially interested in this as we’re currently working on ways to implement automated testing on browser extensions, feel free to reach out to me and we can discuss our respective strategies.
Jon…
…Sent from my iPhone
On 23 Jun 2021, at 18:37, Todd Schiller ***@***.***> wrote:
Context
Automated testing tools, e.g., Selenium, Cypress, Puppeteer, and Playwright are invaluable for cross browser web application testing. There's limited support for them for testing browser extensions
There are mocks (e.g,. jest-chrome) for unit testing, but these don't capture the complexity of extension communication and browser quirks
Automated cross-browser testing will be important for checking the progress of the browsers vs. this w3c groups proposals.
Request
I don't have a clear recommendation for what's needed here. My goal is to get the conversation kicked off (with people more knowledgable than me!) On the PixieBrix project, we're just now trying to set up our cross-browser browser automated testing infrastructure
I suspect there's needs to be some mix of:
Exposing new APIs: e.g., for error detection, for adjusting permissions without user interaction, etc.
The extension community contributing to the automated testing tool projects (code and documentation)
Providing examples of testing different features across browsers
Related context:
pixiebrix/pixiebrix-extension#534
https://groups.google.com/a/chromium.org/g/chromium-extensions/c/2GU7e-OKwtQ/m/CeLBiMe_BwAJ
puppeteer/puppeteer#5532 (comment)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
At Privacy Badger, we use Selenium to continuously test functionality in Chrome and Firefox. The benefit of Selenium is that we exercise the actual extension in an actual browser. Off the top of my head, we wish we had the ability to interact with browser chrome, in particular programmatically open the browser popup. As is, we have to resort to various hacks (examples: opening the popup, opening new browser windows). |
I’m interested in digging in here to better understand how automated end to end and unit testing of browser extensions can be improved. At the moment the biggest gap I know of is the highlighted by @ghostwords - there’s no way in WebDriver or Chrome DevTools Protocol to trigger a browser action. What other gaps are there? |
@dotproto it seems that no tool currently allows running code in specific contexts, for example in the background page/worker, a devtool_page, or a content script. From what I gather, the only way to do so currently is to:
This means that in order to run test code in one of these contexts, the code needs to exist in the extension itself — at least during the testing phase. Privacy Badger above seems to use Most guides online focus on loading the extension in the browser, but there's almost nothing about actually running extension code. |
@dotproto Yes the main issue is about the Popup (or any browser chrome UI that can display an extension, like the Sidebar in Firefox). Without a command to trigger the browser action, and open the Popup, usually the workaround for extension developers is to load the Popup page in a new tab using an extension URL (like The problem with this method, is that it makes irrelevant any tests about features that access information about the current tab. Because extension URLs ( |
What cases are those? Are you mixing up unit testing with functional testing? |
I have several npm modules for WebExtensions so it'd be great that they are tested against real browsers and not just against mocks, which don't reflect the continuous changes, bugfixes and regressions that browsers get. One explicit example:
But also:
|
Last week I opened issue 3848 on the ChromeDriver project. My understanding at the time was that WebDriver was a better fit for this capability than CDP, but, as noted in that issue, after some discussion with the relevant team it seems like Chrome may experiment with this request in the Chrome DevTools Protocol. |
I would prefer we tackle this in WebDriver, since that is more at the browser level than the dev tool protocol level. |
For reference, the «8. Testing Extensions with WebDriver» section of the draft of the previous CG: |
@xeenon, for clarity, are you referring to information gathering or where these features would be implemented? For information gathering, I think the WECG may be a good place to discuss use cases that are not well served today, to discuss potential solutions, and potentially even draft suggestions for consideration by other WGs. On the other hand if you meant that it should be implemented in WebDriver, I don't disagree. The idea of using Chrome DevTools Protocol (CDP) was for experimentation, not as a long term solution. As I understand it, the Chrome DevTools team maintains CDP and may also be taking over ChromeDriver. Since CDP is a browser-specific feature, Puppeteer is built on CDP & is used in automated testing workflows, and that team has relevant expertise with both, it seemed like a good opportunity to explore concrete ways of addressing extension testing gaps, then bringing those findings to the WebDriver WG for discussion. |
I just want to mention that there’s webextensions-api-mock who’s using the JSON schema used internally in Chrome and Firefox to automatically mock the whole APIs, and unit testing is a thing that should be taken into consideration also. |
The nature of browser extensions is that most of them intend to cause side-effects within the environment in which they're intended to run. Therefore, for most extensions, end-to-end testing is overwhelmingly preferred, as they're the often the only test cases that prove anything meaningful. |
This morning I attended the Browser Tools and Testing Working Group's monthly WebDriver BiDi meeting (minutes). My goal in attending was to better understand the group's current focus, raise the feature requests we've seen (namely #19 and #140), and get an initial impression on how to proceed. WG FeedbackInitial feedback from the group indicates that there are currently two incarnations of WebDriver: Classic and BiDi (bi-directional). Classic is primarily focused on interacting with web content and is no longer being actively developed. The WG is currently focusing on BiDi; this specification is likely the right target for deeper integrations with the browser and new, low-level testing capabilities. In both cases, the WebDriver specs both support the concept of extensions provided by browser vendors or other specifications (Classic, BiDi). It will most likely be best for us to create a Classic or BiDi extension to provide the capabilities extension developers would like to see. The Testing & Tools WG obviously has expertise here and indicated that they are open to reviewing and contributing to our extension specifications. Next stepsGiven this context, it looks like we'll will need to create and maintain our own specification(s) to address the needs of WebExtension authors. Our next steps are roughly…
Additional links / notesMeeting attendees shared a handful of links that may be useful as we proceed with specifying WebDriver extensions.
There were also a couple other points came up that I wanted to quickly highlight.
|
Context
Automated testing tools, e.g., Selenium, Cypress, Puppeteer, and Playwright are invaluable for cross browser web application testing. There's limited support for them for testing browser extensions
There are mocks (e.g,. jest-chrome) for unit testing, but these don't capture the complexity of extension communication and browser quirks
Automated cross-browser testing will be valuable for checking the progress of the browsers vs. this w3c group's proposals.
Request
I don't have a clear recommendation for what's needed here. My goal is to get the conversation kicked off (with people more knowledgable than me!) On the PixieBrix project, we're just now trying to set up our cross-browser browser automated testing infrastructure
I suspect there's needs to be some mix of:
Related context:
The text was updated successfully, but these errors were encountered: