我正试图为我所拥有的一个Angular 4项目运行一些e2e测试!
我遇到了一些我无法解决的错误!
以下是错误消息:
/usr/local/bin/node /Users/jothi/Books/Angular/ng-book-_The_Complete_Guide_to_Angular_4_-_basic_package/ng-book-code/http/node_modules/protractor/bin/protractor /Applications/WebStorm.app/Contents/plugins/JavaScriptLanguage/helpers/protractor-intellij/lib/protractor-intellij-config.js --intellijOriginalConfigFile=/Users/jothi/Books/Angular/ng-book-_The_Complete_Guide_to_Angular_4_-_basic_package/ng-book-code/http/protractor.conf.js --disableChecks
(node:63426) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[19:38:44] I/launcher - Running 1 instances of WebDriver
[19:38:44] I/direct - Using ChromeDriver directly...
[19:38:44] E/direct - Error code: 135
[19:38:44] E/direct - Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
[19:38:44] E/direct - Error: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
任何人都可以与我分享问题的真正含义以及解决方法吗?
我在WebStorm IDE中运行它!
编辑:这是我的protractor.conf文件:
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
},
onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
答案 0 :(得分:2)
在运行测试之前尝试使用webdriver-manager下载chromedriver:
"scripts": {
"pretest": "webdriver-manager update",
"test": "protractor protractor.conf.js",
},
然后在package.json文件所在的文件夹中使用terminal命令运行 -
npm test
这将安装ChromeDriver并运行测试
答案 1 :(得分:0)
directConnect: true,
直接运行你的测试用例而不是使用webdriver!
....
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['--no-sandbox', '--test-type=browser'],
'prefs': {
'download': {
'prompt_for_download': false,
'default_directory': 'C:/Temp'
}
}
}
},
directConnect: true,
baseUrl: conf.baseUrl,
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
...