我正在使用量角器5.2.2和黄瓜3.2.0。我通过指定如下所示的多重功能来进行并行执行。
multiCapabilities: [
{
browserName: 'chrome',
},
{
browserName: 'chrome',
}],
我只需要对所有浏览器执行一次查询,但是现在该查询正在对每个浏览器执行。当脚本由'protractor命令运行时,如何设置此查询仅执行一次conf.js”。
答案 0 :(得分:0)
您可以尝试量角器conf.js的beforeLaunch()。
/**
* A callback function called once configs are read but before any
* environment setup. This will only run once, and before onPrepare.
*
* You can specify a file containing code to run by setting beforeLaunch to
* the filename string.
*
* At this point, global variable 'protractor' object will NOT be set up,
* and globals from the test framework will NOT be available. The main
* purpose of this function should be to bring up test dependencies.
*/
beforeLaunch?: () => void;
conf.js
exports.config = {
multiCapabilities: [],
specs:[],
beforeLaunch: function(){
// execute query at here
}
...
};