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

debug broken on 0.19.0 but works on 0.18.1 #552

Closed
elgalu opened this issue Feb 25, 2014 · 39 comments
Closed

debug broken on 0.19.0 but works on 0.18.1 #552

elgalu opened this issue Feb 25, 2014 · 39 comments
Milestone

Comments

@elgalu
Copy link
Contributor

elgalu commented Feb 25, 2014

I'm unable to debug on protractor 0.19.0

Failed to open socket on port 5858, waiting 1000 ms before retrying

Downgraded to protractor 0.18.1 and worked fine!
Then re-installed 0.19.0 to test again, and the same socket error.

Tested on chrome33 & firefox27, chromedriver 2.9. node 0.10.25
Using webdriver-manager start in another console.

$ protractor debug config/local/firefox.js
< debugger listening on port 5858
connecting... ok
break in /usr/local/lib/node_modules/protractor/lib/cli.js:7
  5  * Values from command line options override values from the config.
  6  */
  7 'use strict';
  8 
  9 // Coffee is required here to enable config files written in coffee-script.
debug> c
< ------------------------------------
< PID: 15196 (capability: firefoxANY #1)
< ------------------------------------
< debugger listening on port 5858
< Failed to open socket on port 5858, waiting 1000 ms before retrying
< Failed to open socket on port 5858, waiting 1000 ms before retrying
< Failed to open socket on port 5858, waiting 1000 ms before retrying
< Failed to open socket on port 5858, waiting 1000 ms before retrying
< Failed to open socket on port 5858, waiting 1000 ms before retrying
< Failed to open socket on port 5858, waiting 1000 ms before retrying

Then port 5858 seems to be left open:

$ sudo lsof -i tcp:5858
COMMAND   PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
node    15185 user   11u  IPv4 1397240      0t0  TCP localhost:58131->localhost:5858 (ESTABLISHED)
node    15187 user    9u  IPv4 1397907      0t0  TCP localhost:5858 (LISTEN)
node    15187 user   10u  IPv4 1395469      0t0  TCP localhost:5858->localhost:58131 (ESTABLISHED)
node    15196 user    9u  IPv4 1397907      0t0  TCP localhost:5858 (LISTEN)
node    15196 user   10u  IPv4 1395469      0t0  TCP localhost:5858->localhost:58131 (ESTABLISHED)

Please note debug works well when i re-install 0.18.1

Tried with a remote selenium grid, same issue so webdriver-manager is not related.

#549 looks like a question but might be related.

@sJhonny
Copy link

sJhonny commented Feb 27, 2014

yup, same here- doesn't work on 0.19 (although i don't see those socket errors), seems to be working with 0.18.1

@mcalthrop
Copy link
Contributor

I get the above error using both 0.19.0 and 0.18.1.

@elgalu
Copy link
Contributor Author

elgalu commented Feb 27, 2014

@mcalthrop ensure you kill all node processes before trying again on 0.18.1

@mcalthrop
Copy link
Contributor

Thanks Leo, good call – correction: debugging works on 0.18.1, but on 0.19.0 I get the error described above.

@elgalu
Copy link
Contributor Author

elgalu commented Feb 27, 2014

i'm glad to help narrowing this issue :)

@mcalthrop
Copy link
Contributor

Yep, definitely don't want any red herrings!

I hope this bug gets picked up soon. Making it hard to debug.

@juliemr
Copy link
Member

juliemr commented Feb 27, 2014

On the radar! Thanks for pointing this out!

@chris-ramon
Copy link

That's right! debugger is working on 0.18.1, however i had to change chromeDriver within protractor config file, because I was getting an error about path.

chromeDriver: '../node_modules/protractor/selenium/chromedriver'

@juliemr juliemr closed this as completed in 2ca6541 Mar 3, 2014
@juliemr
Copy link
Member

juliemr commented Mar 3, 2014

Fix is in - should be out next release. Thanks for your patience, everyone.

@dineshdh
Copy link

The issue still seems to be present in version 0.20.1. I am running protractor with the debug param, but the test completes successfully and competently ignores the line which says browser.debugger();

@juliemr
Copy link
Member

juliemr commented Mar 12, 2014

@dineshdh can you post your exact command line and the OS you are using?

@elgalu
Copy link
Contributor Author

elgalu commented Mar 12, 2014

Works for me on 0.20.1, Linux.

@dineshdh
Copy link

I am using Windows 8, and running the below command from within the root of my project

"C:\Program Files\nodejs\node.exe" node_modules\protractor\lib\cli.js debug protractor_conf.js

output

------------------------------------
PID: 13372 (capability: chrome #1)
------------------------------------

Starting debugger agent.
debugger listening on port 5858
Using the selenium server at http://localhost:4444/wd/hub
debug> �connecting....

Finished in 3.076 seconds
1 test, 1 assertion, 0 failures


Process finished with exit code 0

protractor_conf.js

exports.config = {
    /**
     * Use `seleniumAddress` for faster startup; run `./node_modules/.bin/webdriver-manager start` to launch the Selenium server.
     * Use `seleniumPort` to let Protractor manage its own Selenium server instance (using the server JAR in its default location).
     */
    seleniumAddress: 'http://localhost:4444/wd/hub',
    // seleniumPort: 4444,

    /**
     * Path to your E2E test files, relative to the location of this configuration file.
     * We're pointing to the directory where our CoffeeScript output goes.
     */
    specs: [
        './test/app_spec.js'
    ],

    /**
     * Properties passed to Selenium -- see https://code.google.com/p/selenium/wiki/DesiredCapabilities for more info.
     */
    capabilities: {
        'browserName': 'chrome'
    },

    /**
     * This should point to your running app instance, for relative path resolution in tests.
     */
    baseUrl: 'http://localhost:9001'
};

app_spec.js

describe('homepage', function() {

    it('should load the page', function() {
        browser.get('#/login');

        var url = browser.getCurrentUrl();


        browser.debugger();
        var version = element(by.binding('version'));

        expect(version.getText()).toEqual('1.0.0');
    },10000);
});

@juliemr
Copy link
Member

juliemr commented Mar 12, 2014

@dineshdh can you try running with protractor instead of node.exe lib/cli.js?

That works fine for me on mac/linux but maybe there's something weird on windows?

@dineshdh
Copy link

@juliemr, I ran using protractor (protractor debug protractor_conf.js) instead of the cli.js, but it still ignored browser.debugger();

@budajeff
Copy link

browser.debugger() is being ignored by protractor 0.20.1 on Windows 7 (node-debug 0.1.0)

My test:

describe('angularjs homepage', function() {
it('should greet the named user', function() {
console.log("about to break...");
browser.debugger();
console.log("after the break...");
expect(1).toEqual(1);
});
});

Console:

c:\TFS\A\DEV>"C:\Program Files\nodejs\node" c:\tfs\a\DEV\node_modules\protractor\lib\cli.js debug C:\TFS\A\DEV\protractor.config.js


PID: 6136 (capability: chrome #1)

Starting debugger agent.
debugger listening on port 5858
Using the selenium server at http://127.0.0.1:4444/wd/hub
connecting... ok
break in timers.js:77
75 }
76
77 function listOnTimeout() {
78 var msecs = this.msecs;
79 var list = this;
debug> c
debug> about to break...
after the break...
break in c:\tfs\a\DEV\node_modules\protractor\lib\protractor.js:932
930 var flow = webdriver.promise.controlFlow();
931 flow.execute(function() {
932 debugger;
933 }, 'add breakpoint to control flow');
934 };
debug> c
debug> .

Finished in 4.111 seconds
1 test, 1 assertion, 0 failures

@uglow
Copy link

uglow commented Mar 24, 2014

I also find that browser.debugger() is not pausing the tests on a Mac.

It wasn't working in 0.18 so installed 0.20.1 and no change. Here's the the command line argument:

protractor debug config/protractor/localhost.conf.js --seleniumServerJar node_modules/protractor/selenium/selenium-server-standalone-2.40.0.jar

The test:

describe('Links to the page', function () {
beforeEach(function () {
TEST_UTILS.openNavMenu();
});

    it('should show the  link on the navigation menu', function () {
        browser.debugger(); 
        ...
    });

});

@uglow
Copy link

uglow commented Mar 24, 2014

After some more investigation, I found that browser.debugger() DOES work when there are no syntax errors in that particular test (e.g. element(...).text() vs element(...).getText() )

So this works for me:

it('should show the link on the navigation menu', function () {
browser.debugger();
// empty test
});

@bmcnaboe
Copy link

Still appears to be broken in WebStorm with Protractor 0.20.1. I tried many variations and watch The video, but nothing resolved the problem within WebStorm of hanging during debug start - until I rolled back to Protractor v 0.18.1. I made no other changes to my environment (same as video), except rolling back Protractor, and now it works as expected, with the ability to use the IDE to set breakpoints inline. I've rolled back and forth between versions twice just to confirm that is indeed the only variable changed.

By the way, I'm using WebStorm 7.0.3 on Mac. Here's how WebStorm starts the debugger:

/usr/local/bin/node --debug-brk=53819 node_modules/protractor/lib/cli.js config/pro_conf.js

Typing this exact same command in the terminal manually WILL HANG. In order for this to work in the terminal, the "--debug..." part must appear after the cli path. That's true for both version 18 and 20. However, version 18 seems to properly account for this different set of launch args inside of WebStorm.

@mdudek
Copy link

mdudek commented Mar 27, 2014

Unfortunately, I must confirm that debugging is still broken in WebStorm(7/8) with Protractor 0.20.1. ;-(

@jiverson
Copy link

Yes still broken in Webstorm 8.

@bmcnaboe
Copy link

bmcnaboe commented Apr 5, 2014

Should this issue be re-opened as it's not resolved - at least not in WebStorm 7 or 8? Appears to relate to how Protractor is parsing the WS launch arguments for debugging (see my comment above).

@juliemr
Copy link
Member

juliemr commented Apr 5, 2014

This should be resolved with 0.21.0

On Sat, Apr 5, 2014 at 11:26 AM, Brian McNaboe [email protected]:

Should this issue be re-opened as it's not resolved - at least not in
WebStorm 7 or 8? Appears to relate to how Protractor is parsing the WS
launch arguments for debugging (see my comment above).

Reply to this email directly or view it on GitHubhttps://github.com//issues/552#issuecomment-39646587
.

@bmcnaboe
Copy link

bmcnaboe commented Apr 5, 2014

Confirmed - it works in 0.21.0 and WebStorm 8! Thanks Julie!

@screenm0nkey
Copy link

Node v0.10.26 - Still doesn't work for me. I've tried various versions protractor and they are all the same. Not sure you can help me but would be very grateful if you can. Output is below.

Using the selenium server at http://localhost:4444/wd/hub
Hit SIGUSR1 - starting debugger agent.
debugger listening on port 5858
connecting... ok
break in timers.js:77
75 }
76
77 function listOnTimeout() {
78 var msecs = this.msecs;
79 var list = this;

@Nogbit
Copy link

Nogbit commented Apr 25, 2014

Same for me, Node 10.26 and protractor 0.22.0 and selenium standalone server on Arch Linux (jre7-openjdk 7.u55_2.4.7-1....currently available package as of this comment date).

I get the same error as @screenm0nkey

@stefek99
Copy link

MacOS 10.9.2
node --version v0.10.25
protractor 0.22.0

Following the tutorial: http://www.ng-newsletter.com/posts/practical-protractor.html

To kick this test off with the node debugger, we can run the test in debug mode:
$ protractor debug conf.js

The output I'm getting:

(Same as @screenm0nkey and @Nogbit)

./node_modules/protractor/bin/protractor debug protractor_conf.js 
Using ChromeDriver directly...
Hit SIGUSR1 - starting debugger agent.
debugger listening on port 5858
connecting... ok
break in timers.js:77
  75 }
  76 
  77 function listOnTimeout() {
  78   var msecs = this.msecs;
  79   var list = this;
debug> 

Configuration files:

(nothing exceptional here, just for reference)

// An example configuration file.
exports.config = {
  // Do not start a Selenium Standalone sever - only run this using chrome.
  chromeOnly: true,
  chromeDriver: './node_modules/protractor/selenium/chromedriver',

  // 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: ['test/e2e/*_spec.js'],

  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000
  }
};
describe('homepage', function() {
  beforeEach(function() {
    browser.get('http://127.0.0.1:9000/');
  });

  it('should load the page', function() {
    browser.get('app/index.html');

    //browser.debugger();

    element(by.binding('user.name'));
  });
});

@juliemr
Copy link
Member

juliemr commented May 16, 2014

@stefek99 this looks correct to me - you are now in the node debugger and can type 'c' to continue execution. What's the issue you're seeing?

@ghost
Copy link

ghost commented May 23, 2014

@stefek99 @juliemr I got exactly the same issue like @stefek99

Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriverHit SIGUSR1 - starting debugger agent.
debugger listening on port 5858
connecting... ok
break in timers.js:77
  75 }
  76
  77 function listOnTimeout() {
  78   var msecs = this.msecs;
  79   var list = this;
debug> c
debug> [launcher] chrome passed
program terminated
debug> There was an internal error in Node's debugger. Please report this bug.
read EIO
Error: read EIO
    at errnoException (net.js:904:11)
    at TTY.onread (net.js:558:19)

using Mac 10.9.3, node v0.10.26, protractor 0.22.0

@jacopotarantino
Copy link

Any ideas anybody? My output below:

$ grunt protractor
Running "protractor:run" (protractor) task
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriverHit SIGUSR1 - starting debugger agent.
debugger listening on port 5858
connecting... ok
break in timers.js:77
  75 }
  76
  77 function listOnTimeout() {
  78   var msecs = this.msecs;
  79   var list = this;
debug> c
debug> Selenium standalone server started at http://10.0.1.30:62952/wd/hub
c
debug> c
debug> c
debug> c
debug> [launcher] chrome passed
>>
program terminated
debug> Fatal error: protractor exited with code: 1


Execution Time (2014-05-27 21:14:09 UTC)
protractor:run  16.8s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 100%
Total 16.8s

@deloschang
Copy link

I get the same output as @jacopotarantino Mac 10.9.3, node v0.10.26, protractor 0.22.0

@elgalu
Copy link
Contributor Author

elgalu commented Jul 30, 2014

Could you try upgrading protractor? current version is 1.0.0

@deloschang
Copy link

Yes, I thought that might have been the problem. Just did a fresh npm -g install and updated to v1.0.0. Same issue where I stop in timers.js:77. Thanks for the help though!

@deloschang
Copy link

To update, I have v0.10.29 of node and tried the following versions of protractor with the tutorial setup: v1.0.0, v0.20.1, v0.21. I get the same output as @jacopotarantino

When I try v0.18, I get the following output:

Deloss-MacBook-Pro:protractor deloschang$ protractor debug conf.js
< debugger listening on port 5858
connecting... ok
break in /usr/local/lib/node_modules/protractor/lib/cli.js:7
5 * Values from command line options override values from the config.
6 */
7 'use strict';
8
9 // Coffee is required here to enable config files written in coffee-script.
debug> c
< Using the selenium server at http://localhost:4444/wd/hub
break in /usr/local/lib/node_modules/protractor/lib/protractor.js:747
745 var flow = webdriver.promise.controlFlow();
746 flow.execute(function() {
747 debugger;
748 });
749 };
debug> c
< .
< Finished in 4.599 seconds
< 1 test, 1 assertion, 0 failures
<
program terminated

@Elijen
Copy link

Elijen commented Sep 19, 2014

I have been having this issue for a long time now. (I think since protractor 0.18.0) Current versions are: protractor v1.2.0, node v0.10.30, MacOS 10.10 (had the same problem on 10.9). This is the result:

protractor debug test/protractor.conf.js 
Using ChromeDriver directly...

Hit SIGUSR1 - starting debugger agent.
debugger listening on port 5858
connecting... ok
break in timers.js:79
  77 }
  78 
  79 function listOnTimeout() {
  80   var msecs = this.msecs;
  81   var list = this;
debug> 

It seems that the execution always breaks in a random place of code (a process is being killed).

@levithomason
Copy link

For those still experiencing this issue as I was:

Failed to open socket on port 5858, waiting 1000 ms before retrying

Turned out I had another process running on that port already. A previous debug gone wrong. After killing it, all is well:

$ ps ax | grep :5858
13387   ??  S      0:00.07 /Users/levithomason/.nvm/v0.10.24/bin/node debug localhost:5858
13941 s003  S+     0:00.00 grep :5858

$ kill 13387
Password:

Props to this SO post.

@Istenes
Copy link

Istenes commented Dec 3, 2014

@levithomason This is not the case for me and the problem still exists in protractor 1.4.0. I have tried an earlier version but I sill can't properly debug protractor.

This is the output like many of the other people having the same issue:

Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Hit SIGUSR1 - starting debugger agent.
debugger listening on port 5858
connecting... ok
break in timers.js:79
77 }
78
79 function listOnTimeout() {
80 var msecs = this.msecs;
81 var list = this;

when I hit C it continues to run and ignore my browser.debugger();

is this solved or is there a new way to approach debugging this?

@rlucha
Copy link

rlucha commented Dec 4, 2014

@Istenes Exactly the same problem here (protractor 1.4, node 10.29)

@levithomason
Copy link

@Istenes I also had issues with the debugger apparently skipping my break points. The fix I confirmed above was regarding the OP's exact error:

Failed to open socket on port 5858, waiting 1000 ms before retrying

My solve for debugging was to use my IDE's protractor runner (WebStorm by JetBrains). The debugging is beyond superb. Not only does it pause, it overlays the value of all my javascript variables in the IDE right inside the javascript file. Does much more goodness, too.

If you're a JetBrains user you can checkout the debug setup instructions on the Protractor site here:

http://angular.github.io/protractor/#/debugging#setting-up-webstorm-for-debugging

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