Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor Js run to linux machine

I have protractor tests in my angular project, and when I would like run it i catch next exception log:

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

And before it I see browser window with next url: data:,.

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

If I use seleniumAddress: 'http://localhost:4444/wd/hub', I catch next exception:

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

Help me please run this test in my pc. Thanks a lot.

like image 331
Taras Kovalenko Avatar asked Nov 09 '22 21:11

Taras Kovalenko


1 Answers

If you want to connect to that seleniumAddress, you will need to start a selenium server from protractor/bin/webdriver-manager start. If there is no selenium server running, you won't be able to run the test there (ECONNREFUSED).

Alternatively you can comment out the seleniumAddress in the config file, use protractor/bin/webdriver-manager update to download the binaries, and protractor will run the tests using the standalone seleniumServerJar.

like image 102
martin770 Avatar answered Nov 15 '22 04:11

martin770