Hey everyone! I’m trying to set up my Polymer 3.x tests to run in a headless browser so that the browser window doesn’t keep popping up. I’ve installed the wct-headless package and configured my wct.config.json, but I’m encountering an error when I run polymer test.
I encountered a similar issue when configuring Polymer 3.x tests for headless execution. The problem lies in the plugin configuration. The ‘headless’ plugin isn’t a separate entity; it’s part of the ‘local’ plugin.
To resolve this, modify your wct.config.json as follows:
This configuration utilizes the local plugin with headless options. Ensure you have the latest versions of wct-browser-legacy and web-component-tester installed. After making these changes, run ‘polymer test’ again. It should execute your tests in headless mode without opening browser windows.
I’ve dealt with this exact problem before, and it can be frustrating. The key is understanding that ‘headless’ isn’t a separate plugin, but a feature of the ‘local’ plugin. Here’s what worked for me:
First, update your wct.config.json file. Remove the ‘headless’ section entirely and modify the ‘local’ plugin like this:
Also, make sure your package.json has the latest versions of the necessary packages. You might want to run ‘npm update’ to ensure everything is up to date.
After making these changes, clear your npm cache with ‘npm cache clean --force’ and then run ‘npm install’ again. This should resolve the issue and allow you to run your tests headlessly.