Protractor: how to make the configuration file more flexible?

前端 未结 2 1193
感情败类
感情败类 2021-01-06 08:12

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\         


        
2条回答
  •  忘掉有多难
    2021-01-06 08:47

    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'
    }
    

    And use in another file

    // protractor.conf.js
    var globalConf = require('/path/to/globalProtractor.conf.js');
    
    globalConf.specs.push('path/new.spec.js');
    exports.config = globalConf;
    

提交回复
热议问题