问题描述
我是 Protractor 的新手.您能否告知是否有任何方法可以在多个远程主机(Ubuntu - Firefox、chrome、Windows - IE、Chrome、firefox、Mac - Firefox、Chrome、Mobile - Android 设备、Mobile - iOS 等)上运行量角器 E2E 测试.),具有多个浏览器.请共享示例配置以指定远程主机.
I'm new to Protractor. Could you please advise if there is any way to run protractor E2E tests on multiple remote hosts (Ubuntu - Firefox,chrome, Windows - IE, Chrome, firefox, Mac - Firefox, Chrome, Mobile - Android device, Mobile - iOS etc..), with multi browsers. Please share sample config to specify remote hosts.
由于许可成本不考虑使用saucelabs,计划在本地测试环境中设置.
Due to licensing costs not considering to use saucelabs, planning to setup in local test environment.
目前我只能在一台主机上使用多浏览器运行量角器 E2E 测试.(例如:Mac - Firefox、Chrome、Safari)在 conf.js 中使用以下配置
Currently I'm able to run protractor E2E tests, with multibrowsers on one host only. (eg: Mac - Firefox, Chrome, Safari) using following config in conf.js
多能力:[{'浏览器名称':'铬','铬选项':{'args': ['no-sandbox','no-default-browser-check', 'no-first-run', 'disable-default-apps']},版本: '',平台:'任何'},
multiCapabilities: [{ 'browserName': 'chrome', 'chromeOptions': { 'args': ['no-sandbox','no-default-browser-check', 'no-first-run', 'disable-default-apps'] }, version: '', platform: 'ANY' },
{
'browserName': 'safari'
},
{
'browserName': 'firefox'
}]
提前致谢.
推荐答案
步骤 1:在多台机器上,启动 selenium webdriver,并确保它们可以从你启动量角器的机器上访问
Step 1:On multiple machines, start up selenium webdriver, and make sure they are accessible from the machine you're kicking off protractor
第 2 步:https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L136为每个浏览器设置适当的 seleniumAddress
.
Step 2:https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L136Set appropriate seleniumAddress
for each browser.
multiCapabilities: [{
browserName: chrome,
seleniumAddress: $HOST_A:1234,
specs: ['testA.js']
}, {
browserName: chrome,
seleniumAddress: $HOST_B:1234,
specs: ['testB.js']
}]
旁注,这些 selenium 地址可能不是静态的.您可以通过 getMultiCapabilities (https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L152)
Side note, likely, those selenium addresses are not static. You can return the multiCapabilities object as a promise via getMultiCapabilities (https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L152)
要做任何其他花哨的事情,您可能需要与 runner.js (https://github.com/angular/protractor/blob/master/lib/runner.js) 直接
To do any other fancy things, you might need to interact with runner.js (https://github.com/angular/protractor/blob/master/lib/runner.js) directly
这篇关于量角器远程测试多浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!