I’m trying to run my Polymer 3.x tests without the browser popping up. I installed the wct-headless package and configured my wct.config.json file. However, when I execute polymer test, I encounter an error that says the headless plugin could not be found.
I’ve encountered similar issues when setting up headless testing for Polymer projects. One thing that often gets overlooked is ensuring that the wct-headless package is properly installed and recognized by your project.
First, try running npm install wct-headless --save-dev to make sure it’s correctly installed. Then, check if your wct.conf.js file (not wct.config.json) is in the root directory of your project. The configuration should be in JavaScript format, not JSON.
Also, make sure you’re using the latest version of web-component-tester. Sometimes, outdated versions can cause compatibility issues with headless testing.
If you’re still encountering problems, try running polymer test with the --verbose flag to get more detailed error messages. This can often provide clues about what’s going wrong in the test setup process.
I’ve had success running Polymer 3.x tests in a headless environment by using a slightly different approach. Instead of relying on the wct-headless package, I’ve found it more reliable to use Puppeteer directly with web-component-tester.
First, ensure you have Puppeteer installed: npm install puppeteer --save-dev. Then, modify your wct.conf.js (note: .js, not .json) like this:
This setup lets you run tests with polymer test without browser windows popping up. It’s been more stable in my experience and works well with CI/CD pipelines. Remember to update your package.json scripts if needed to use this configuration.