我们如何在并行执行时对所有浏览器只执行一次查询
How can we execute a query only one time for all browsers while doing parallel execution
我正在使用 Protractor 5.2.2 和 Cucumber 3.2。0.I 正在通过指定下面给出的多重功能进行并行执行。
multiCapabilities: [
{
browserName: 'chrome',
},
{
browserName: 'chrome',
}],
我只需要为所有 browsers.But 执行一次查询,现在正在为每个 browsers.How 执行查询,我可以将此查询设置为仅在脚本运行时执行一次吗运行 通过命令 'protractor conf.js'.
你可以试试量角器beforeLaunch()conf.js。
/**
* 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
}
...
};
我正在使用 Protractor 5.2.2 和 Cucumber 3.2。0.I 正在通过指定下面给出的多重功能进行并行执行。
multiCapabilities: [
{
browserName: 'chrome',
},
{
browserName: 'chrome',
}],
我只需要为所有 browsers.But 执行一次查询,现在正在为每个 browsers.How 执行查询,我可以将此查询设置为仅在脚本运行时执行一次吗运行 通过命令 'protractor conf.js'.
你可以试试量角器beforeLaunch()conf.js。
/**
* 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
}
...
};