量角器:如何让配置文件更灵活? [英] Protractor: how to make the configuration file more flexible?
本文介绍了量角器:如何让配置文件更灵活?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个想法,使我的configs更加灵活。比如我有相同的参数10000配置文件:
I have an idea to make my configs more flexible. For example I have 10000 config files with same parameters:
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['C:/Users/Lilia.Sapurina/Desktop/Protractor Tests/Scenarios/ps-grid-column-filter-range_spec.js'],
params: {'url_filter': 'http://wks-15103:8010/ps/ng-components/examples/ps-grid-column-filter-range.html'}
和一次我想改变路径规范,HTML或更改硒地址。我能做到这一点在另一个文件中为我所有的configs?
And once I want to change path to specs, html or change selenium address. Can I do this in another file for all my configs?
例如在写我的配置:
seleniumAddress: '../Variables/seleniumAdress.txt'
或许存在另一种有趣的方式来解决这个问题?
Or maybe exist another interesting ways to solve this problem?
推荐答案
您可以导出常见的配置规则Node.js的模块:
You can export your common config rules as node.js module:
// globalProtractor.conf.js
module.exports = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['C:/Users/Lilia.Sapurina/Desktop/Protractor Tests/Scenarios/ps-grid-column-filter-range_spec.js'],
params: {
'url_filter': 'http://wks-15103:8010/ps/ng-components/examples/ps-grid-column-filter-range.html'
}
和在另一个文件中使用
// protractor.conf.js
var globalConf = require('/path/to/globalProtractor.conf.js');
globalConf.specs.push('path/new.spec.js');
exports.config = globalConf;
这篇关于量角器:如何让配置文件更灵活?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文