DEV Community


Discussion on: Browser extension - Deploy your extension

qmenoret profile image
Quentin Ménoret Author

It really depends on what the addon is for. For something as simple as the one I described here, I'd say unit tests are enough. But if your addon becomes complex, you'll have to go with e2e testing. And that's not exactly funny. Let's say you want to test on Chrome for instance. It's possible to load your extension, but not in headless mode. So if you want to run then on a CI you'll have to either use a platform such as BrowserStack, or setup a Xvfb (fake display server) to run an actual Chrome.
Then extensions mostly interact with other websites, but I'm not sure you actually wants the flakiness of opening actual websites in your tests? So maybe you'll mock them? But if you do so, you won't catch it when they update and break your extension?
So, to conclude: it's really hard to test, and going further than unit tests have a high cost IMO