我正在嘗試啓動測試時遇到量角器惱人的問題。量角器「 - 失敗:無法讀取屬性」ver「爲空」
量角器版本:5.1.2
protractor.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.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應用程序,當用瀏覽器手動訪問時,它完美的工作。有人會有任何想法來解決這個問題嗎?在此先感謝
Thnx的所有信息,但這是真正的所有日誌,你有沒有參考日誌中的文件? – wswebcreation
@wswebcreation請在這裏找到完整的命令輸出:https://pastebin.com/3tLdGGvw – Bil5
我記得在jasmine-spec-reporter中有一個選項可以在日誌中啓用堆棧跟蹤,你可以打開它或禁用'jasmine-spec-reporter'並將日誌放在這裏? – wswebcreation