Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Automated tests 无法在headless chrome中运行CodeceptJS测试用例_Automated Tests_Google Chrome Headless_Codeceptjs - Fatal编程技术网

Automated tests 无法在headless chrome中运行CodeceptJS测试用例

Automated tests 无法在headless chrome中运行CodeceptJS测试用例,automated-tests,google-chrome-headless,codeceptjs,Automated Tests,Google Chrome Headless,Codeceptjs,我已经为我的应用程序设置了CodeceptJS框架&测试正在顺利运行。 但现在我想让他们使用无头镀铬。尝试了一些在官方网站上提到的东西,但对我来说不起作用 我尝试使用npxcodeceptjsrun--verbose运行测试 我的codecept.conf.js文件如下所示: exports.config={ 测试:“./tests/features/***_test.js”, 输出:'./测试/输出', 助手:{ 网络驱动程序:{ 智能等待:10000, waitForTimeout:1000

我已经为我的应用程序设置了CodeceptJS框架&测试正在顺利运行。 但现在我想让他们使用无头镀铬。尝试了一些在官方网站上提到的东西,但对我来说不起作用

我尝试使用
npxcodeceptjsrun--verbose
运行测试

我的codecept.conf.js文件如下所示:

exports.config={
测试:“./tests/features/***_test.js”,
输出:'./测试/输出',
助手:{
网络驱动程序:{
智能等待:10000,
waitForTimeout:10000,
网址:'https://affinity.sourcefuse.com',
浏览器:“chrome”,
窗口大小:“最大化”,
色度选项:{
参数:[“--headless”、“--disable gpu”、“--window size=800600”]
}
}
},
包括:{
I:“./steps_file.js”,
createDatasetPage:'tests/pages/createDataset.js',
},
引导:空,
摩卡:{},
名称:“仪表板”,
插件:{
“诱惑”:{
“已启用”:真
},
wdio:{
启用:对,
服务:['selenium-standalone']
}
}
}
实际:Chrome启动,测试开始运行


预期:我希望它在无头chrome上运行。

chromeOptions
需要包装在
desiredCapabilities
中,您的配置应如下所示:

exports.config={
测试:“./tests/features/***_test.js”,
输出:'./测试/输出',
助手:{
网络驱动程序:{
智能等待:10000,
waitForTimeout:10000,
网址:'https://affinity.sourcefuse.com',
浏览器:“chrome”,
窗口大小:“最大化”,
所需能力:{
色度选项:{
参数:[“--headless”、“--disable gpu”、“--no sandbox”]
}
}
}
},
包括:{
I:“./steps_file.js”,
createDatasetPage:'tests/pages/createDataset.js',
},
引导:空,
摩卡:{},
名称:“仪表板”,
插件:{
“诱惑”:{
“已启用”:真
},
wdio:{
启用:对,
服务:['selenium-standalone']
}
}
}

我从
args
中删除了
windowSize
,因为它已经被设置为
windowSize
,并添加了
no sandbox
,这是测试自动化的建议。

添加了
no sandbox
,而不是测试自动化的建议。未获取此部分。在初始配置中,您使用了
--window size=800600
作为
chromeOptions
的第三个参数:1。我建议把这个删掉。我建议添加
--无沙箱
参数