【发布时间】:2017-12-19 23:01:31
【问题描述】:
我在尝试启动测试时遇到了一个恼人的量角器问题。
量角器版本:5.1.2
量角器.conf.js
var SpecReporter = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:8080/src/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
useAllAngular2AppRoots: true,
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e'
});
},
onPrepare: function() {
jasmine.getEnv().addReporter(new SpecReporter());
},
rootElement: '*[ng-app]',
};
端到端测试文件“app.comp.e2e-spec.js”
import { browser, element, by, $ } from 'protractor';
describe('testproject App', function() {
it('should display message saying app works', (done) => {
browser.get('/');
expect($('.my-span').isPresent()).toBe(true);
return done();
});
});
每次我启动测试(protractor protractor.conf.js)时都会遇到以下错误消息:
1) testproject App should display message saying app works
- Failed: Cannot read property 'ver' of null
Executed 1 of 1 spec (1 FAILED) in 0.984 sec.
[11:27:52] I/launcher - 0 instance(s) of WebDriver still running
[11:27:52] I/launcher - chrome #01 failed 1 test(s)
[11:27:52] I/launcher - overall: 1 failed spec(s)
[11:27:52] E/launcher - Process exited with error code 1
我当然有一个在 localhost:8080/index 上运行的 Angular 应用程序,并且在使用浏览器手动访问时它工作得很好。有人有解决这个问题的想法吗?提前致谢
【问题讨论】:
-
感谢所有信息,但这真的是您拥有的所有日志吗,日志中没有对文件的引用吗?
-
@wswebcreation 请在此处找到完整的命令输出:pastebin.com/3tLdGGvw
-
我记得
jasmine-spec-reporter中有一个选项可以在日志中启用堆栈跟踪,您可以打开或禁用jasmine-spec-reporter并再次将日志放在这里吗? -
错误“无法读取 null 的属性 x”表示打字稿错误。您正在引用 ts-node 所以大概您正在使用 typescript - 您可以发布您的 tsconfig.json 吗?
-
@wswebcreation 启用堆栈跟踪的输出:pastebin.com/1G9tYXtU
标签: angular protractor e2e-testing