Protractor: how to make the configuration file more flexible?

前端 未结 2 1161
感情败类
感情败类 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:38

    With @driver_by help I found nice solution for my problem. Now my files isolated. If I want to change url or path to folder I should change only global config.

    // globalProtractor.conf.js    
    module.exports = {
      seleniumAddress: 'http://localhost:4444/wd/hub',
    
      baseUrl: 'http://wks-15103:8010/ps/ng-components/examples/',
    
      specs: [],
    
      path_to_scenario: '../Scenarios/',
      path_to_spec: '../Specs/',
      path_to_lib: '../Lib/'
    }
    

    And another file:

    // protractor.conf.js
    var globalConf = require('../Global_configs/globalProtractor_conf.js');        
        globalConf.specs.push(path_to_spec + 'ps-grid-column-filter-range_spec.js');    
    
    globalConf.params = {'url_filter': 'ps-grid-column-filter-range.html',                          
                         'column_number_filter': 5,                                                 
                         'req_lib_filter': globalConf.path_to_lib + 'jasmine-expect'}               
    exports.config = globalConf;  
    

提交回复
热议问题