Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

ECONNREFUSED after server shutdown with grunt-protractor-runner #1123

Closed
DavidTanner opened this issue Jul 29, 2014 · 17 comments
Closed

ECONNREFUSED after server shutdown with grunt-protractor-runner #1123

DavidTanner opened this issue Jul 29, 2014 · 17 comments

Comments

@DavidTanner
Copy link

Using version 1.0.0 I get an error message that the connection was refused. This is similiar to issue #85. I found someone had similiar issues in http://stackoverflow.com/questions/21382962/when-running-protractor-with-phantomjs-browser-only-able-to-run-tests-once and changed my version to 0.24.2 and the issue went away.

Session deleted: Going to shut down the Selenium server
Shutting down Selenium server: http://127.0.0.1:4444
Shut down Selenium server: http://127.0.0.1:4444 (OKOK)

node_modules/protractor/node_modules/selenium-webdriver/http/index.js:136
callback(new Error(message));
^
Error: ECONNREFUSED connect ECONNREFUSED
at ClientRequest. (node_modules/protractor/node_modules/selenium-webdriver/http/index.js:136:16)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at Socket.socketErrorListener (http.js:1547:9)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:440:14
at process._tickCallback (node.js:415:13)
==== async task ====
WebDriver.quit()

@juliemr
Copy link
Member

juliemr commented Jul 29, 2014

Clarification - does this only occur using Phantom.js?

@JesusLopezCh
Copy link

@DavidTanner I just updated to v1.0.0, and it started happening exactly the same behavior, and only with phantomJS.
@juliemr yes, only with phantomJS, other browsers seems to be working normal :(

@DavidTanner
Copy link
Author

@juliemr Yes, just phantomjs and for me only in ubuntu.
On Jul 29, 2014 2:54 PM, "JesusLopezCh" notifications@github.com wrote:

@DavidTanner https://github.com/DavidTanner I just updated to v1.0.0,
and star happening exactly the same behavior, and only with phantomJS.
@juliemr https://github.com/juliemr yes, only with phantomJS, other
browsers seems to be working normal :(

Reply to this email directly or view it on GitHub
#1123 (comment).

@georgievrado
Copy link

Facing the same issue with Chrome. It works OK on version 0.24.2. I am running this with grunt task using https://www.npmjs.org/package/grunt-protractor-runner.

@JesusLopezCh
Copy link

How can I downgrade my version, updating the 'package.json' file ?

@DavidTanner
Copy link
Author

Just change the version to ~0.24.2 or ^0.24.2 depending on your node version, then npm install to get the version you want.

@kdekooter
Copy link

+1 here with Chrome on both OS X and Ubuntu.

"Needs: more info" - please tell us what more information you need.

@franktroia
Copy link

+1 with Chrome on Windows 7.

grunt-protractor-runner: ^1.14
grunt-protractor-webdriver: ^0.1.9
protractor: ^1.2.0

@hueitan
Copy link

hueitan commented Nov 2, 2014

+1 with Chrome on Mac OS Lion
grunt-protractor-runner: ^1.14

==============(fixed)
I got no error after running webdriver-manager start at first

@orloffv
Copy link

orloffv commented Dec 1, 2014

+1 with Chrome on Mac OS Yosemite
grunt-protractor-runner: ^1.1.4
grunt-protractor-webdriver: ^0.1.9
protractor: ^1.4.0

console report https://gist.github.com/orloffv/f255d93c9b577b0f784c

@juliemr
Copy link
Member

juliemr commented Dec 9, 2014

OK - I think there might be multiple issues at work here. Let's ignore the phantom issues - people who aren't using phantom, can you share your configuration? I cannot reproduce this.

@Mike-Hardy
Copy link

i'm running Windows 8.1 x64.

Gruntfile.js =


module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({
        protractor_webdriver: {
            e2eUpdate: {
                options: {
                    path: './node_modules/.bin/',
                    command: 'webdriver-manager update --standalone'
                },  
            },  
            e2eStart: {
                options: {
                    path: './node_modules/.bin/',
                    command: 'webdriver-manager start'
                },  
            },              
        },
        protractor: {
            options: {
                configFile: "ProtractorConfig.js",
                keepAlive: true, // If false, the grunt process stops when the test fails.
                noColor: false, // If true, protractor will not use colors in its output.
                args: {

                    // Arguments passed to the command
                }
            },
            e2e: {
                // Grunt requires at least one target to run so you can simply put 'all: {}' here too.
                options: {
                    configFile: "ProtractorConfig.js", // Target-specific config file
                    args: {} // Target-specific arguments
                }
            },
        },
    });
    grunt.loadNpmTasks('grunt-protractor-webdriver');
    grunt.loadNpmTasks('grunt-protractor-runner');

    // Default task(s).
    grunt.registerTask('default', ['protractor_webdriver:e2eStart', 'protractor:e2e']);
};

package.json =


{
    "name": "UI.NodeE2ETests",
    "version": "1.0.0",
    "description": "UI.NodeE2ETests",
    "private": false,
    "author": "fifteenbelow",
    "devDependencies": {
        "grunt-protractor-runner": "~1.1.4",
        "grunt-protractor-webdriver": "~0.1.9",         
        "jasmine-reporters": "<2.0.0"       
    },
    "scripts": {
    "postinstall": "node_modules/.bin/webdriver-manager update --standalone"
  }
}

protractorConfig.js =


exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',
    specs: ['../src/UI.NodeE2ETests/tests/**/*spec.js'],
    multiCapabilities: [,{
            browserName: 'chrome'
        }],
    jasmineNodeOpts: {
    onComplete: null,
    defaultTimeoutInterval: 180000,
    isVerbose: true,
    showColors: true,
    includeStackTrace: true
    },
    allScriptsTimeout: 180000,
    framework: 'jasmine',
    onPrepare: function() {
        if (process.env.TEAMCITY_VERSION)
        {
            require('jasmine-reporters');
            jasmine.getEnv().addReporter(new jasmine.TeamcityReporter());
        }
    }
}

Output from tests =


Running "protractor_webdriver:e2eStart" (protractor_webdriver) task
Starting Selenium server
Started Selenium server: http://127.0.0.1:4444

Running "protractor:e2e" (protractor) task
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Session created: count=1, browserName=chrome
Elements feature
  should be able to delete and add a element - pass

Send notification feature
  should be able to create and send a manual notification - pass
Signin invalid feature
  should not sign in with invalid credentials - pass
Signin feature
  should sign in using valid credentials - pass
Templates and Subjects feature
  should be able to delete and add a template and delete and add a subject - pas
s
Tenants feature
  should display tenants - pass
  should be able to select tenant - pass
  should be able to switch tenant - pass


Finished in 198.995 seconds
8 tests, 43 assertions, 0 failures

Session deleted: Going to shut down the Selenium server
Shutting down Selenium server: http://127.0.0.1:4444
Shut down Selenium server: http://127.0.0.1:4444 (OKOK)

D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protractor-runner\node_
modules\protractor\node_modules\selenium-webdriver\http\index.js:145
      callback(new Error(message));
               ^
Error: ECONNREFUSED connect ECONNREFUSED
    at ClientRequest.<anonymous> (D:\Git\XXX.AcceptanceTests\build\node_mod
ules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdr
iver\http\index.js:145:16)
    at ClientRequest.emit (events.js:95:17)
    at Socket.socketErrorListener (http.js:1551:9)
    at Socket.emit (events.js:95:17)
    at net.js:440:14
    at process._tickCallback (node.js:419:13)
==== async task ====
WebDriver.quit()
    at [object Object].webdriver.WebDriver.schedule (D:\Git\XXX.AcceptanceT
ests\build\node_modules\grunt-protractor-runner\node_modules\protractor\node_mod
ules\selenium-webdriver\lib\webdriver\webdriver.js:345:15)
    at [object Object].webdriver.WebDriver.quit (D:\Git\XXX.AcceptanceTests
\build\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules
\selenium-webdriver\lib\webdriver\webdriver.js:418:21)
    at D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protractor-runne
r\node_modules\protractor\lib\driverProviders\driverProvider.js:28:16
    at D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protractor-runne
r\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1582:
15
    at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protractor-runner\node_modules\pro
tractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20)
    at notify (D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protract
or-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\
promise.js:465:12)
    at [object Object].then (D:\Git\XXX.AcceptanceTests\build\node_modules\
grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\
lib\webdriver\promise.js:522:7)
    at D:\Git\XXX.AcceptanceTests\build\node_modules\grunt-protractor-runne
r\node_modules\protractor\lib\driverProviders\driverProvider.js:26:25
    at Array.map (native)
[launcher] Process exited with error code 1
>>
>> Test failed but keep the grunt process alive.

Note we are running grunt from F# Fake, but this should have no bearing on this error.

If i change my protractorConfig to use


multiCapabilities: [,{
            browserName: 'firefox'
        }],

then i do not get the error.

@juliemr
Copy link
Member

juliemr commented Dec 16, 2014

I'm beginning to suspect this is an issue with grunt-protractor-runner, since everyone having the problem is using it. Anyone NOT using grunt-protractor-runner have this problem?

@Mike-Hardy
Copy link

Pretty sure you are right @juliemr. Have raised teerapap/grunt-protractor-runner#99

@juliemr juliemr changed the title ECONNREFUSED after server shutdown ECONNREFUSED after server shutdown with grunt-protractor-runner Jan 6, 2015
@Mike-Hardy
Copy link

please reference teerapap/grunt-protractor-runner#99 and teerapap/grunt-protractor-runner#100 I managed to resolve this

@juliemr juliemr modified the milestone: Pending Mar 17, 2015
@skjoshi
Copy link

skjoshi commented Mar 17, 2015

If any one has got the solution to this problem, please provide the details. I am facing same issue on mac osx.

Running "protractor:webdriver" (protractor) task
Using the selenium server at http://localhost/wd/hub
[launcher] Running 1 instances of WebDriver
ERROR - Unable to start a WebDriver session.

/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:145
callback(new Error(message));
^
Error: ECONNREFUSED connect ECONNREFUSED
at ClientRequest. (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:145:16)
at ClientRequest.emit (events.js:95:17)
at Socket.socketErrorListener (http.js:1552:9)
at Socket.emit (events.js:95:17)
at net.js:441:14
at process.tickCallback (node.js:442:13)
==== async task ====
WebDriver.createSession()
at Function.webdriver.WebDriver.acquireSession
(/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:149:22)
at Function.webdriver.WebDriver.createSession (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:123:30)
at Builder.build (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/selenium-webdriver/builder.js:294:22)
at DriverProvider.getNewDriver (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/lib/driverProviders/driverProvider.js:38:7)
at Runner.createBrowser (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/lib/runner.js:180:37)
at /Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/lib/runner.js:257:21
at _fulfilled (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/q/q.js:797:54)
at self.promiseDispatch.done (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/q/q.js:826:30)
at Promise.promise.promiseDispatch (/Users/sjoshi/Documents/SJWorkspace/GDAClientAutomationTest/node_modules/protractor/node_modules/q/q.js:759:13)
[launcher] Process exited with error code 1

Also if there are any specific versions that are compatible and works for you, please specify them.

@juliemr
Copy link
Member

juliemr commented Mar 17, 2015

Looks like this is resolved. Closing.

@juliemr juliemr closed this as completed Mar 17, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants