博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Protractor] Running tests on multiple browsers
阅读量:4607 次
发布时间:2019-06-09

本文共 1840 字,大约阅读时间需要 6 分钟。

Testing your AngularJS application on multiple browsers is important, and Protractor offers this ability through the multiCapabilities configuration option. Learn how to use this option, as well as configure your e2e tests to run on only a single browser for rapid development.

 

By default, protractor will use chrome as default browser. You can also use other browser:

exports.config = {    capabilities: {        name: "Firefox",        browserName: "firefox"    },    specs: [        './e2etest/**/*.spec.js'    ],    seleniumAddress: 'http://localhost:4444/wd/hub'};

 

If you want to run on multi browsers, then you can use 'multiCapabilities':

exports.config = {    multiCapabilities: [        {            name: "Chrome",            browserName: "chrome"        },        {            name: "Firefox",            browserName: "firefox"        }    ],    specs: [        './e2etest/**/*.spec.js'    ],    seleniumAddress: 'http://localhost:4444/wd/hub'};

 

But it probably good when you are actually developing the project, you can run only on one browser for saving time, so you can modify the scripts tags:

"test-e2e": "protractor conf.js",    "test-e2e-dev": "protractor conf.js --chrome"

 

More flexable code:

var browsers = {  firefox: {    name: 'Firefox',    browserName: 'firefox'  },  chrome: {    name: 'Chrome',    browserName: 'chrome'  }}var config = {  specs: [    './e2etest/**/*.spec.js'  ],  baseUrl: 'http://localhost:3333'};if (process.argv[3] === '--chrome') {  config.capabilities = browsers.chrome;}  else {  config.multiCapabilities = [    browsers.firefox,    browsers.chrome  ]}exports.config = config;

 

 

package.json:

"scripts": {    "test-start": "webdriver-manager start",    "test-e2e": "protractor conf.js",    "test-e2e-dev": "protractor conf.js --chrome"  },

转载于:https://www.cnblogs.com/Answer1215/p/5201949.html

你可能感兴趣的文章
产品功能对标 - 服务授权管理
查看>>
各地IT薪资待遇讨论
查看>>
splay入门
查看>>
带CookieContainer进行post
查看>>
C语言学习笔记--字符串
查看>>
CSS-上下文选择器
查看>>
ionic repeat 重复最后一个时要执行某个函数
查看>>
1.初识代码审计-基础
查看>>
APC注入
查看>>
No enclosing instance of type Hello is accessible
查看>>
windows SVN搭建
查看>>
Scrum立会报告+燃尽图(Beta阶段第二周第二次)
查看>>
动态代理
查看>>
WCF 中,出现The remote server returned an unexpected response: (400) Bad Request.
查看>>
缓存概要
查看>>
vue项目中使用百度地图的方法
查看>>
[Vue-rx] Stream an API using RxJS into a Vue.js Template
查看>>
[Javascript] lodash: memoize() to improve the profermence
查看>>
手写符合Promise/A+规范的Promise
查看>>
JPA、JTA、XA相关索引
查看>>