protractor remote tests multibrowser

◇◆丶佛笑我妖孽 提交于 2019-12-05 09:07:59

问题


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.

Due to licensing costs not considering to use saucelabs, planning to setup in local test environment.

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

multiCapabilities: [ { 'browserName': 'chrome', 'chromeOptions': { 'args': ['no-sandbox','no-default-browser-check', 'no-first-run', 'disable-default-apps'] }, version: '', platform: 'ANY' },

{
      'browserName': 'safari'
},
{
      'browserName': 'firefox'
}]

Thanks in advance.


回答1:


Step 1: On multiple machines, start up selenium webdriver, and make sure they are accessible from the machine you're kicking off protractor

Step 2: https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L136 Set appropriate seleniumAddress for each browser.

multiCapabilities: [{
  browserName: chrome,
  seleniumAddress: $HOST_A:1234,
  specs: ['testA.js']
}, {
  browserName: chrome,
  seleniumAddress: $HOST_B:1234,
  specs: ['testB.js']
}]

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)

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



来源:https://stackoverflow.com/questions/28564777/protractor-remote-tests-multibrowser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!