运行 polymer-3.x 在无头浏览器中测试
Running polymer-3.x test in headless browser
我想 运行 在没有浏览器弹出的情况下进行测试 up.Installed wct-headless 并配置 wct.config.json 如图所示
{
"plugins": {
"local": {
"disabled": true
},
"headless": {
"browsers": [
"chrome",
"firefox"
],
"browsersOptions": {
"chrome": [
"headless",
"disable-gpu",
"no-sandbox"
],
"firefox": [
"--headless"
]
}
},
"sauce": false,
"xunit-reporter": {
"output": "testfile.xml"
}
}
}
在执行 polymer test
时,出现以下 错误
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"
}
我应该如何配置 wct.conf.json ??
无需安装wct-headless
。只需创建包含以下内容的文件 wct.conf.json
:
{
"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
}
我想 运行 在没有浏览器弹出的情况下进行测试 up.Installed wct-headless 并配置 wct.config.json 如图所示
{
"plugins": {
"local": {
"disabled": true
},
"headless": {
"browsers": [
"chrome",
"firefox"
],
"browsersOptions": {
"chrome": [
"headless",
"disable-gpu",
"no-sandbox"
],
"firefox": [
"--headless"
]
}
},
"sauce": false,
"xunit-reporter": {
"output": "testfile.xml"
}
}
}
在执行 polymer test
时,出现以下 错误
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"
}
我应该如何配置 wct.conf.json ??
无需安装wct-headless
。只需创建包含以下内容的文件 wct.conf.json
:
{
"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
}