4

I want to run tests without the browser pop-up.Installed wct-headless and configured wct.config.json as shown

{
  "plugins": {
    "local": {
      "disabled": true
    },
    "headless": {
      "browsers": [
        "chrome",
        "firefox"
      ],
      "browsersOptions": {
        "chrome": [
          "headless",
          "disable-gpu",
          "no-sandbox"
        ],
        "firefox": [
          "--headless"
        ]
      }
    },
    "sauce": false,
    "xunit-reporter": {
      "output": "testfile.xml"
    }
  }
}

While executing polymer test, it gives following error

Could not find WCT plugin named "headless"

package.json

"dependencies": {
  "@polymer/polymer": "^3.0.0"
},
"devDependencies": {
  "@polymer/iron-demo-helpers": "^3.0.0-pre.19",
  "@webcomponents/webcomponentsjs": "^2.0.0",
  "wct-browser-legacy": "^1.0.0",
  "wct-headless": "^2.2.2",
  "web-component-tester": "^6.8.0",
  "wct-xunit-reporter": "1.0.2"
}

How should i configure wct.conf.json ??

1 Answer 1

6

No need to install wct-headless. Just create file wct.conf.json with the following content:

{
 "plugins": {
   "local": {
     "browsers": [
       "chrome",
       "canary",
       "firefox"
     ],
     "browserOptions": {
       "chrome": [
         "headless",
         "disable-gpu",
         "start-maximized",
         "user-agent='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3239.108 Safari/537.36'"
       ],
       "canary": [
         "headless",
         "disable-gpu",
         "start-maximized",
         "user-agent='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3239.108 Safari/537.36'"
       ],
       "firefox": [
         "-headless"
       ]
     } // browserOptions
   } // local
 } // plugins
}
1
  • works with polymer 2 on docker / debian as well. thanks.
    – csomakk
    Feb 7, 2020 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.