Hey everyone,
I’m stuck with a problem in my automation test suite. It uses a Chrome extension, but I need to run it in GitLab CI. The issue is that headless Chrome doesn’t seem to support extensions.
I can’t switch to Firefox because our extension isn’t compatible. I tried using Xvfb virtual display, but no luck there either. I’m not even sure if it’s the right approach for GitLab.
Does anyone have experience with this? How can I run tests that need a Chrome extension in GitLab CI? Any workarounds or alternatives you can suggest?
I’d really appreciate any help or advice. This is holding up our CI pipeline, and I’m out of ideas. Thanks!
Have you considered using Selenium Grid with a node that has Chrome and your extension installed? This setup can be dockerized and integrated into GitLab CI. You’d run your tests against this remote node, effectively bypassing the headless Chrome limitation.
Another option is to use a cloud-based testing service like BrowserStack or Sauce Labs. They often support running tests with custom extensions. You’d need to upload your extension to their platform, but it could save you the hassle of managing the infrastructure yourself.
If those don’t work, you might need to rethink your testing strategy. Could you split your tests, running extension-specific ones locally and the rest in CI? It’s not ideal, but it could be a temporary solution while you work on a more permanent fix.
hey mate, have u tried puppeteer? it’s got some neat tricks for runnin chrome with extensions in headless mode. might be worth a shot. u could setup a custom docker image with puppeteer and ur extension, then use that in ur gitlab CI. just an idea, hope it helps!
I’ve encountered a similar challenge in my CI pipeline before. One workaround that worked for me was using a custom Docker image with Chrome and the necessary extension pre-installed. You can create a Dockerfile that sets up Chrome, installs your extension, and configures the environment for Selenium.
In your GitLab CI config, you’d then use this custom image for your test job. It’s a bit more setup initially, but it gives you full control over the environment. You might need to tweak Chrome’s startup flags to ensure it runs smoothly in the CI environment.
Another approach I’ve seen colleagues use is mocking the extension’s functionality in your tests. This isn’t ideal if you’re specifically testing the extension, but it can be a pragmatic solution if you’re just using the extension as part of a larger test suite.
Remember to keep an eye on your test execution times with these approaches. They can sometimes slow down your pipeline, so you might want to parallelize your tests if possible.