[Protractor] Running tests on multiple browsers
On multiple running tests
2023-09-14 08:59:20 时间
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" },
相关文章
- DevOps on DevCloud|如何采用流水线践行CI/CD理念【华为云技术分享】
- DevOps on DevCloud|如何构建Kotlin开发的Android Apps
- $().click()和$().on('click',function(){})的区别
- [Ramda] Filter an Array Based on Multiple Predicates with Ramda's allPass Function
- Machine Learning On Spark——第一节:基础数据结构(一)
- Spark on k8s提交测试任务失败报错解决办法:User “system:serviceaccount:default:default“ cannot get resource “pods
- How to bind multiple properties with formatter on one control
- 使用阿里云容器服务Jenkins实现持续集成和Docker镜像构建(updated on 2017.3.3)
- 关于Copy On Write Array List,你会安全使用么
- 论文解读《Research on the application of contrastive learning in multi-label text classification》
- kali linux on android armhf 安装 tmate
- WebGL on iOS8 最终等到了这一天
- sql语法:inner join on, left join on, right join on具体用法
- PAT 1095 Cars on Campus C++版
- 仅当使用了列列表并且 IDENTITY_INSERT 为 ON 时,才能为表‘faceid‘中的标识列指定显式值。
- 【python问题解决】---- sqlite3.OperationalError: AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY