这是Set firefox profile with protractor主题的后续行动.
根据setFirefoxProfile
howto,可以使用特殊的“helper” js code设置firefox配置文件,它使用firefox-profile
和q
库来动态编码firefox配置文件.
这对我有用,直到我尝试使用多个浏览器并配置multiCapabilities
:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
multiCapabilities: [
{
browserName: 'chrome',
specs: [
'footer.disabledCookies.spec.js'
],
chromeOptions: {
prefs: {
'profile.default_content_settings.cookies': 2
}
}
},
...
// other capabilities here
...
helper.getFirefoxProfile()
},
...
}
Spec patterns did not match any files.
据我了解,这意味着使用firefox配置文件的设置缺少specs键.换句话说,它找不到任何运行的测试.
我试过include specs
into the capabilities
dictionary inside the helper itself,但错误仍然存在.
如果使用multiCapabilities,如何修复错误并设置firefox配置文件?
作为一种解决方法,我创建了一个单独的量角器配置文件,只配置了firefox(使用功能)并设置了两次运行量角器的grunt – 一个用于“firefox with a profile”配置,另一个用于所有其他浏览器.
解决方法:
现在,如果我们不使用多功能,量角器只能接受承诺作为功能.这是因为multiCapabilities在新进程中运行每个任务,因此无法传递promise(函数)(单个功能可以工作,因为我们没有分叉).
或者,我们可以在将已解析的功能传递到新进程之前解析启动程序中的功能;但是,这将破坏设置代理(https://github.com/angular/protractor/pull/1040)的能力,这依赖于在driverProvider设置之后解析的功能承诺.
我想不出一个简单的方法(没有大的重构),但它绝对可行.
我为Protractor(https://github.com/angular/protractor/issues/1594)创建了一个问题.如果这是您需要的,或者您有其他想法来实现它,请关注和/或评论它.
现在,您需要使用原始问题中提到的解决方法.
UPDATE
https://github.com/angular/protractor/pull/1629支持这一点.从量角器1.6开始(或者如果您同步到master),您可以将函数传递给config.getMultiCapabilities,如onPrepare和onCleanup.此函数可以返回对multiCapabilties(即功能数组)的承诺.
有关示例,请参见https://github.com/angular/protractor/blob/master/spec/getCapabilitiesConf.js.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。