我在一个 Angular (v.4) 项目中工作并使用 Protractor 我遇到了这个问题
从终端:
I/launcher - 运行 1 个 WebDriver 实例
I/hosted - 在http://localhost:4444/wd/hub使用 selenium 服务器 已 开始 未找到规范 0.003 秒内完成
I/launcher - 0 个 WebDriver 实例仍在运行 [17:06:38] I/launcher - chrome #01 通过
它运行快速关闭的浏览器,并且不运行(查找)任何规范。
量角器.conf.js:
require('ts-node/register');
var helpers = require('./helpers');
exports.config = {
baseUrl: 'http://localhost:3000/',
// use `npm run e2e`
specs: [
helpers.root('test/e2e/**/**.e2e.ts'),
helpers.root('test/e2e/**/*.e2e.ts')
],
exclude: [],
framework: 'jasmine2',
allScriptsTimeout: 110000,
jasmineNodeOpts: {
showTiming: true,
showColors: true,
isVerbose: false,
includeStackTrace: false,
defaultTimeoutInterval: 400000
},
directConnect: true,
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ["--headless", "--disable-gpu", "--window-size=800x600"]
}
},
onPrepare: function () {
browser.ignoreSynchronization = true;
},
/**
* Angular 2 configuration
*
* useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching
* `rootEl`
*/
useAllAngular2AppRoots: true
};
文件夹结构
-/App
|--/config
|--protractor.conf.js
|--helpers.js
|--(all webpack files)
|--(other stuff)
|--/node_modules
|--/src
|--/test
|--/e2e
|-mytest.e2e.ts
|--/features
|--/mockBackend
|--/pages
|-mypage.page.ts
|--config.js
包.json
"cucumber": "^2",
"cucumber-html-reporter": "^3.0.4",
"cucumber-snippets-tsflow": "^1.0.2",
"cucumber-tsflow": "^2.2.0",
"protractor": "^5.1.2",
"protractor-cucumber-framework": "^3",
"protractor-snapshot": "^1.2.0",