Skip to content
This repository has been archived by the owner on Jan 26, 2023. It is now read-only.

Tests untruly failing if screenshot taking is still in progress during test shutdown (ECONNREFUSED) #13

Open
bentolor opened this issue Aug 20, 2014 · 3 comments
Labels

Comments

@bentolor
Copy link

I get sporadically the following errors on using protractor-screenshot-reporter:

node_modules/protractor/node_modules/selenium-webdriver/http/index.js:136
      callback(new Error(message));
               ^
Error: ECONNREFUSED connect ECONNREFUSED
    at ClientRequest.<anonymous> (node_modules/protractor/node_modules/selenium-webdriver/http/index.js:136:16)
    at ClientRequest.emit (events.js:95:17)
    at Socket.socketErrorListener (http.js:1547:9)
    at Socket.emit (events.js:95:17)
    at net.js:440:14
    at process._tickCallback (node.js:419:13)
==== async task ====
WebDriver.takeScreenshot()
    at webdriver.WebDriver.schedule (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:268:15)
    at webdriver.WebDriver.takeScreenshot (node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:871:15)
    at to.(anonymous function) [as takeScreenshot] (node_modules/protractor/lib/protractor.js:56:25)
    at ScreenshotReporter.reportSpecResults (node_modules/protractor-screenshot-reporter/index.js:123:10)
    at jasmine.NestedResults.totalCount [as reportSpecResults] (node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:1901:39)
    at jasmine.Spec.finishCallback (node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2470:21)
    at jasmine.Spec.finish (node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2475:8)
    at null.onComplete (node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2504:10)
    at jasmine.Queue.next_ (node_modules/protractor/node_modules/minijasminenode/lib/jasmine-1.3.1.js:2219:14)

Fatal error: protractor exited with code: 1

Obviously the issue is that the Jasmine/Protractor-Tests already are shutting down and therefore the PhantomJS process terminates while the screenshot taking is still in progress.

In my opinition screenshot reporter should fail silently & gracefully instead of pulling the test itself into damnation here.

@bentolor bentolor changed the title Tests falsy failing due to aborted screenshot during test shutdown (ECONNREFUSED) Tests untruly failing if screenshot taking is still in progress during test shutdown (ECONNREFUSED) Aug 20, 2014
@swissmanu
Copy link
Owner

i'm not sure if this could really be fixed by the protractor-screenshot-reporter.
the reporter only calls the webdriver api which completly handles the selenium browser lifecycle.

maybe you can supply more details otherwise?

@bentolor
Copy link
Author

I read the stacktrace in that way, that Jasmine fails because it receives an Exception on calling ScreenshotReporter.reportSpecResults() via jasmine.Spec.finishCallback.

Pretty sure protractor-screenshot-reporter cannot avoid the failure during taking the screenshot. But I guess it can easily avoid the test failure of Jasmine by simple swallowing Exceptions received byScreenshotReporter.reportSpecResults() on calling the Webdriver API?

@swissmanu swissmanu added the bug label Oct 15, 2014
@zoejobson
Copy link

This is hitting our continuous integration - can anyone suggest a workaround ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants