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

查看:28
本文介绍了如何从命令行覆盖 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 文档:

According to the referenceConf.js documentation:

// 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: [],

换句话说,由于指定了 multiCapabilitiescapabilities 将被忽略.

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.

另外,相关主题列表:

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

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