[Protractor] Running tests on multiple browsers
On multiple running tests
2023-09-14 09:00:54 时间
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" },
相关文章
- [java] javax.el.PropertyNotFoundException: Property 'id' not found on type bean.Student
- 【华为云技术分享】云图说 | 华为云AnyStack on BMS解决方案:助力线下虚拟化业务迁移上云
- The network bridge on device VMnet0 is not running
- [Tools] Install npm packages globally without sudo on macOS and Linux
- How to bind multiple properties with formatter on one control
- IBASE view WD_DESTROY - ON_NEW_FOCUS
- 【Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) A】 Doggo Recoloring
- 成功解决ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device
- Maven项目Run As无Run On Server的解决方法
- PAT 1095 Cars on Campus
- Android USB audio on Android platform