-
Notifications
You must be signed in to change notification settings - Fork 13
Run integration tests on CI #55
Comments
I've been looking at what the major extensions like uBlock and AdBlockPlus and others do, they seem to have automation for building the extension and running unit tests but I'm not finding a ton on integration tests. The Lighthouse extension from Google does this, and uses Puppeteer with headless Chrome: GoogleChrome/lighthouse#4640 There are various examples of using Mocha with Puppeteer and Selenium. I'm still trying to understand the differences between the two, but it looks like Puppeteer might be easier to set up and provide nicer integration into various browser features so it's probably worth seriously considering since it supports Firefox as well, which was one of the big sticking points for using Selenium for a while. |
OK here's an example of using Puppeteer with
The I think Chrome doesn't allow extensions in headless mode, so we might have to run in "headfull" mode (which should be fine we can use a screen buffer or something). Chrome has a more direct way to load extensions vs. using |
So I think the remaining steps are:
|
Woha, this looks great and simple! |
Ugh, OK. One big stumbling block here for me is that Chrome extension install works very differently than Firefox in general, and Puppeteer doesn't really officially document (as far as I can find) how this should work not that Firefox support is official. It's kind of a weird trade-off, actually - Chrome has a command-line option to temp-install unsigned add-ons, but it does not work in headless mode which is rough. Back when Firefox support was experimental, this section of the doc existed which covered using web-ext: However that page has been changed to say that Firefox is no longer experimental and that section was removed. From github discussions it looks like this is still the only way forward so I'm going to forge ahead, but it sure is frustrating :) Outside of Mozilla's Firefox automation I haven't turned up much in the realm of official support for this sort of thing, which is frustrating. It's a different story for Chrome unsurprisingly. |
I wonder if Playwright would be any easier than Puppeteer. |
Eugh :( I understand your frustration here.
@pdehaan raises a good point! Maybe Playwright is worth trying: it seems to support easy integration with the Mocha testrunner. What do you think, @rhelmer ? |
@rhelmer @pdehaan I quickly experimented with Playwright. While it is super easy to setup and make it work (great job devs!), it does not support webextension testing. The devs are very explicitly stating it's out of scope for playwright. So this seems to be a no go. |
OK so the more I look into this, I'm not sure how useful puppeteer will be for testing the multi-addon flow that we need to... Puppeteer works by connecting to devtools (AFAICT) using a remote debugging protocol, and I don't think Chrome provides a way to do install extensions via this mechanism, we probably need to use some lower-level instrumentation. It's worth double-checking this assumption. Firefox does have a way to do this IIRC. The way I see other folks using Puppeteer here is to just pass the However, what we need to do is:
So I think that we need something like what we use for mochitests (Marionette I think?), since we need to interact with browser chrome. The higher-level API for this is WebDriver so I will dig into this a bit and see where I get. We also might want to consider foisting this off to a Firefox mochitest for expediency, especially if we're going to land the core add-on in Firefox then that's something we'll want anyway. Still worth investigating if we could use something like mocha there and look at what WebDriver lets us do on other browsers. Getting around signature verification on Chrome without using temporary add-ons might be a big issue there... |
@Dexterp37 given our time constraints, I think we should write a mochitest and run it in our CI (artifact build). This is something we've done in the past and it's Firefox only but it has Marionette etc. already set up. We should still work on getting a more browser-agnostic setup but since we need to interact with browser UI it's going to be more complex than we originally hoped, so I want to unblock us in the short term. wdyt? |
@rhelmer I think that's fair! |
This can be closed thanks to #212. |
In #16 we added running unit test coverage and linting for the addon on CircleCI.
We now need a way to run integration tests using real browsers (headless?).
The text was updated successfully, but these errors were encountered: