我在角度项目中进行了量角器测试,当我想运行它时,我会抓住下一个异常日志:
Possibly unhandled RequestError: Error: connect ECONNREFUSED
at new RequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/errors.js:11:15)
at Request.RP$callback [as _callback] (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/rp.js:56:32)
at self.callback (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:198:22)
at Request.emit (events.js:95:17)
at Request.onRequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:820:8)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1548:9)
at CleartextStream.emit (events.js:95:17)
at Socket.onerror (tls.js:1456:17)
at Socket.emit (events.js:117:20)
at net.js:441:14
at process._tickCallback (node.js:448:13)
Possibly unhandled RequestError: Error: connect ECONNREFUSED
at new RequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/errors.js:11:15)
at Request.RP$callback [as _callback] (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/rp.js:56:32)
at self.callback (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:198:22)
at Request.emit (events.js:95:17)
at Request.onRequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:820:8)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1548:9)
at CleartextStream.emit (events.js:95:17)
at Socket.onerror (tls.js:1456:17)
at Socket.emit (events.js:117:20)
at net.js:441:14
at process._tickCallback (node.js:448:13)
Possibly unhandled RequestError: Error: connect ECONNREFUSED
at new RequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/errors.js:11:15)
at Request.RP$callback [as _callback] (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/rp.js:56:32)
at self.callback (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:198:22)
at Request.emit (events.js:95:17)
at Request.onRequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:820:8)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1548:9)
at CleartextStream.emit (events.js:95:17)
at Socket.onerror (tls.js:1456:17)
at Socket.emit (events.js:117:20)
at net.js:441:14
at process._tickCallback (node.js:448:13)
Possibly unhandled RequestError: Error: connect ECONNREFUSED
at new RequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/errors.js:11:15)
at Request.RP$callback [as _callback] (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/rp.js:56:32)
at self.callback (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:198:22)
at Request.emit (events.js:95:17)
at Request.onRequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:820:8)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1548:9)
at CleartextStream.emit (events.js:95:17)
at Socket.onerror (tls.js:1456:17)
at Socket.emit (events.js:117:20)
at net.js:441:14
at process._tickCallback (node.js:448:13)
Possibly unhandled RequestError: Error: connect ECONNREFUSED
at new RequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/errors.js:11:15)
at Request.RP$callback [as _callback] (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/rp.js:56:32)
at self.callback (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:198:22)
at Request.emit (events.js:95:17)
at Request.onRequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:820:8)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1548:9)
at CleartextStream.emit (events.js:95:17)
at Socket.onerror (tls.js:1456:17)
at Socket.emit (events.js:117:20)
at net.js:441:14
at process._tickCallback (node.js:448:13)
Possibly unhandled RequestError: Error: connect ECONNREFUSED
at new RequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/errors.js:11:15)
at Request.RP$callback [as _callback] (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/rp.js:56:32)
at self.callback (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:198:22)
at Request.emit (events.js:95:17)
at Request.onRequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:820:8)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1548:9)
at CleartextStream.emit (events.js:95:17)
at Socket.onerror (tls.js:1456:17)
at Socket.emit (events.js:117:20)
at net.js:441:14
at process._tickCallback (node.js:448:13)
Possibly unhandled RequestError: Error: connect ECONNREFUSED
at new RequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/errors.js:11:15)
at Request.RP$callback [as _callback] (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/lib/rp.js:56:32)
at self.callback (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:198:22)
at Request.emit (events.js:95:17)
at Request.onRequestError (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/request-promise/node_modules/request/request.js:820:8)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1548:9)
at CleartextStream.emit (events.js:95:17)
at Socket.onerror (tls.js:1456:17)
at Socket.emit (events.js:117:20)
at net.js:441:14
at process._tickCallback (node.js:448:13)
Error: connect ECONNREFUSED
at errnoException (net.js:905:11)
at Object.afterConnect [as oncomplete] (net.js:896:19)
[launcher] Process exited with error code 1
/home/tk/WorkSpaceNew/dashboard/frontend/gulp/e2e-tests.js:23
throw err;
^
Error: protractor exited with code 1
Process finished with exit code 8
在此之前,我会看到带有下一个网址的浏览器窗口:数据:,。
UPD 的 protractor.conf.js
'use strict';
var paths = require('./.yo-rc.json')['generator-gulp-angular'].props.paths;
// An example configuration file.
exports.config = {
// The address of a running selenium server.
//seleniumAddress: 'http://localhost:4444/wd/hub',
//seleniumServerJar: deprecated, this should be set on node_modules/protractor/config.json
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: [paths.e2e + '/**/*.js'],
// Options to be passed to Jasmine-node.
mochaOpts: {
timeout: 5000
},
framework: 'mocha'
};
UPD2
如果我使用seleniumAddress:' http://localhost:4444/wd/hub', 我抓住了下一个例外:
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
ERROR - Unable to start a WebDriver session.
/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:145
callback(new Error(message));
^
Error: ECONNREFUSED connect ECONNREFUSED
at ClientRequest.<anonymous> (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:145:16)
at ClientRequest.emit (events.js:95:17)
at Socket.socketErrorListener (http.js:1548:9)
at Socket.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:448:13)
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession_ (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:149:22)
at Function.webdriver.WebDriver.createSession (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:123:30)
at Builder.build (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/gulp-protractor/node_modules/protractor/node_modules/selenium-webdriver/builder.js:294:22)
at DriverProvider.getNewDriver (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/gulp-protractor/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7)
at Runner.createBrowser (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/gulp-protractor/node_modules/protractor/lib/runner.js:180:37)
at /home/tk/WorkSpaceNew/dashboard/frontend/node_modules/gulp-protractor/node_modules/protractor/lib/runner.js:257:21
at _fulfilled (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/gulp-protractor/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/gulp-protractor/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/home/tk/WorkSpaceNew/dashboard/frontend/node_modules/gulp-protractor/node_modules/protractor/node_modules/q/q.js:759:13)
[launcher] Process exited with error code 1
/home/tk/WorkSpaceNew/dashboard/frontend/gulp/e2e-tests.js:23
throw err;
^
Error: protractor exited with code 1
Process finished with exit code 8
请帮我,请在我的电脑上运行此测试。 非常感谢。
答案 0 :(得分:1)
如果要连接到该seleniumAddress,则需要从protractor/bin/webdriver-manager start
启动selenium服务器。如果没有运行selenium服务器,您将无法在那里运行测试(ECONNREFUSED)。
或者你可以在配置文件中注释掉seleniumAddress,使用protractor/bin/webdriver-manager update
下载二进制文件,量角器将使用独立的seleniumServerJar运行测试。