Jasmine 在量角器中,我可以专门为规范定义浏览器,因为我想在两个不同的浏览器中运行两个规范
我有两个规范需要在非并行模式下运行,一个规范应该在chrome上运行,另一个规范在firefox上运行 这是我的config.jsJasmine 在量角器中,我可以专门为规范定义浏览器,因为我想在两个不同的浏览器中运行两个规范,jasmine,protractor,Jasmine,Protractor,我有两个规范需要在非并行模式下运行,一个规范应该在chrome上运行,另一个规范在firefox上运行 这是我的config.js exports.config = { framework: 'jasmine', //Potractor will run tests in parallel against each set of capabilities. //Please note that if multiCapabilities is defined, the runner w
exports.config = {
framework: 'jasmine',
//Potractor will run tests in parallel against each set of capabilities.
//Please note that if multiCapabilities is defined, the runner will ignore the capabilities configuration
multiCapabilities: [{
'name': 'test1',
browserName: 'firefox',
'moz:firefoxOptions': {
args: ['--verbose'],
binary: 'C:/Program Files/Mozilla Firefox/firefox.exe',
specs: ['src/com/sam/scriptjs/iframes.spec.js']
},
}, {
'name': 'test2',
browserName: 'chrome',
specs: ['src/com/sam/scriptjs/rightclickme.spec.js']
}],
seleniumAddress: 'http://localhost:4444/wd/hub'
}
这是我的chrometest.spec.js
描述('chrome desc',函数(){
这是我的firefoxtest.spec.js。请告诉我是否有办法,我已经检查了类似的方法,但它不足以解决我的问题。谢谢
describe('firefox desc', function() {
it('Navigae to the site using firefox', function() {
browser.driver.get(browser.baseUrl);
expect(browser.getTitle()).toEqual('Super Calculator');
});
});
我认为这可以通过多容量而不是功能来实现。你能试试下面的代码片段吗
multiCapabilities: [{
'name': 'test1',
'browserName': 'chrome',
specs: ['chrometest.spec.js']
}, {
'name': 'test2',
'browserName': 'firefox',
specs: ['firefoxtest.spec.js']
}],
希望这有帮助!在阅读了dhreeraj的答案和一些进一步的阅读之后,下面的config.js在5.4.2版的量角器和Jasmine中为我工作
exports.config = {
framework: 'jasmine',
directConnect: false,
multiCapabilities: [{
browserName: 'firefox',
'moz:firefoxOptions': {
args: ['--verbose'],
binary: 'C:/Program Files/Mozilla Firefox/firefox.exe'
//Need to start cmd via admin mode to avoid permission error
},
specs: ['src/com/sam/scriptjs/draganddrop.spec.js']
},
{
browserName : 'chrome',
chromeOptions: {
args: [ "--start-maximized" ]
},
specs: ['src/com/sam/scriptjs/iframes.spec.js']
}],
maxSessions: 1,//To run in sequential mode so first Firefox then chrome
//without max session it will open two windows at the same time for both browsers
seleniumAddress: 'http://localhost:4444/wd/hub'
}
谢谢dheeraj的建议,我修改了我的配置js,请参见我编辑的问题。但是,现在它抛出了新错误(“规范模式与任何文件都不匹配”);规范文件路径似乎有问题,您可以尝试类似['./src/com/sam/scriptjs/rightclickme.Spec.js']。还有一个看起来应该是“rightclickme.spec.js”,而不是逗号,可能是拼写错误。谢谢你,我纠正了我的错误。现在它抛出了crossbrowerconfig.js:15个规范:[“src/com/sam/scriptjs/nonangularstackscript.js”]^^^^^您能简要介绍一下控制台中的确切错误吗?我没有收到问题Hi dheeraj谢谢您的支持,我通过添加几行来解决它。现在错误消失了,我还必须删除名称“:“test1”,因为它抛出了一个错误。再次感谢您,祝您度过愉快的一天。
exports.config = {
framework: 'jasmine',
directConnect: false,
multiCapabilities: [{
browserName: 'firefox',
'moz:firefoxOptions': {
args: ['--verbose'],
binary: 'C:/Program Files/Mozilla Firefox/firefox.exe'
//Need to start cmd via admin mode to avoid permission error
},
specs: ['src/com/sam/scriptjs/draganddrop.spec.js']
},
{
browserName : 'chrome',
chromeOptions: {
args: [ "--start-maximized" ]
},
specs: ['src/com/sam/scriptjs/iframes.spec.js']
}],
maxSessions: 1,//To run in sequential mode so first Firefox then chrome
//without max session it will open two windows at the same time for both browsers
seleniumAddress: 'http://localhost:4444/wd/hub'
}