debugging protactor (with / without webstorm)

2020-03-24 08:46发布

问题:

So I'm starting out with protractor, and I want to debug my test code:

describe('stuff', function(){

it('should find the specs item, and its empty', function(){
    browser.debugger();
    gotoHome();
    var allItems = element.all('li in model.tags');
    var specsDashboardElement;
    for (var i=0 ; i < allItems.length; ++i) {
        var elem = allItems[i];
        var text = elem.findElement(by.css('.li-title').getText()); // does this even work?? dunno
        if (text == "Specs")
            specsDashboardElement = elem;
    }

    expect(specsDashboardElement.isDisplayed()).toBe(true);

});

});

I've followed these instructions, but this is the output I see on the node.js debugger console:

D:\src\apps\j1-test.module>protractor debug conf.js
< debugger listening on port 5858
connecting... ok
break in C:\Users\j\AppData\Roaming\npm\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> cont
< ------------------------------------
< PID: 9756 (capability: chrome #1)
< ------------------------------------
< debugger listening on port 5858
debug>

and that's it. no matter how many types I type 'cont', nothing happens.
I've tried following the instructions for debugging in WebStorm, with much the same result (output on the WebStorm debug console:

"C:\Program Files\nodejs\node.exe" --debug-brk=2259 C:\Users\j\AppData\Roaming\npm\node_modules\protractor\lib\cli.js conf.js
debugger listening on port 2259
PID: 2708 (capability: chrome #1)
debugger listening on port 2259

).

I'm using node 0.10.26 (64 bit) on windows 8

Ideas anyone?

回答1:

That was a Protractor issue, which should be fixed now:

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

from GitHub issue #552

EDIT: Released in 0.20.0 version! (0.20.1 for Windows users). See Protractor changelog.