如何从命令行覆盖protractor.conf.js值? [英] How do i overwrite protractor.conf.js values from the command line?

查看:97
本文介绍了如何从命令行覆盖protractor.conf.js值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在我们的集成服务器上运行了量角器设置。在protractor.conf.js文件中,我有以下内容:

I currently have protractor setup to run on our integration server. Inside the protractor.conf.js file i have the following:

 multiCapabilities: [{
    'browserName': 'firefox',
    'platform': 'MAC'
  }, {
    'browserName': 'chrome',
    'platform': 'MAC'
  }]

我想在命令行本地运行时覆盖它。我试过以下但没有成功

I would like to override this when running locally from the command line. I've tried the following with no success

protractor --verbose --browser=chrome

问题:如何从命令行本地运行时切换到仅使用单个chrome实例?

Question: How do i switch to only using a single instance of chrome when running locally from the command line?

推荐答案

这是一个问题。

根据源代码浏览器命令行参数是 capabilities.browserName 的别名。

According to the source code, browser command line argument is an alias of capabilities.browserName.

根据 referenceConf.js 文档

// If you would like to run more than one instance of WebDriver on the same
// tests, use multiCapabilities, which takes an array of capabilities.
// If this is specified, capabilities will be ignored.
multiCapabilities: [],

换句话说,因为 multiCapabilities指定,忽略功能

In other words, since multiCapabilities are specified, capabilities are ignored.

您可以尝试从命令行重置 multiCapabilities

What you can try to do is to reset multiCapabilities from command-line:

protractor --verbose --browser=chrome --multiCapabilities

作为另一种解决方法,有一个单独的配置文件,用于运行单个浏览器实例。

As an another workaround, have a separate config file for running a single browser instance.

此外,相关主题列表:

  • Added support for multiCapabilities object and splitTestsBetweenCapabilities boolean
  • Multicapabilities specs ignore the --specs flag on the command line and run anyway

这篇关于如何从命令行覆盖protractor.conf.js值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆