【问题标题】:How to loop in Protractor config file?如何在量角器配置文件中循环?
【发布时间】:2016-06-29 03:42:04
【问题描述】:

我是 JS 和 Protractor 测试功能的新手。我需要在量角器的“配置”文件中包含一些条件或循环。 例如,如果我需要检查在“Windows / Mac”平台上运行的规格,并且变量提供了这些详细信息。

我期待类似的东西:

exports.config = {
    seleniumAddress : 'http://localhost:4444/wd/hub',
    getPageTimeout : 30000,
    allScriptsTimeout : 30000,
    specs : [  ],
    framework : 'jasmine2',

    ***don't know the syntax, am expecting below line and condition need to work for protractor***
    ***var platform = 'Windows',
    if(platform ==='Windows'){***
    multiCapabilities: [{
        'browserName': 'chrome',
        'specs': ['spec1.js']
      },
      ***else {***
        'browserName': 'chrome',
        'specs': ['spec2.js']
      }],
};

是否可以在配置文件中验证?

【问题讨论】:

    标签: angularjs node.js automation jasmine protractor


    【解决方案1】:

    您需要使用getMultiCapabilities function:

    getMultiCapabilities: function() {
        // TODO: check platform and return list of capability objects
    },
    

    【讨论】:

    • 感谢您指出此功能。如果我想检查更多条件,是否可以在“配置”文件中多次调用 getMultiCapabilities: function() { // TODO: check platform and return list of capability objects }?
    猜你喜欢
    • 2017-06-28
    • 1970-01-01
    • 2015-02-01
    • 2018-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-10
    相关资源
    最近更新 更多