-
Notifications
You must be signed in to change notification settings - Fork 2.3k
browser.debugger() fails to pause test #1688
Comments
Can you share the code for your test which is failing? I believe this is all working as intended, but I'd like to make sure. What element(by.id('clickme')).click();
browser.debugger();
expect(element(by.id('output')).getText()).toEqual('hi'); And the test will pause after the element has been clicked but before the text is grabbed. Note that this is after the whole test has been executed and the asynchronous tasks have been queued up. Now, this is expected to fail: element(by.id('clickme')).click();
browser.debugger();
throw new Error('foo'); The code above should throw an error before the debug breakpoint is ever reached. |
This is my current code:
It fails with:
|
Well, I think your error is that |
Just to confirm - this looks like it should be failing for the same reason without the |
I commented out the line after the debugger statement and it worked. The behavior is just not as expected. I don't expect a failure after the debugger statement to prevent me from entering the debugger. I do understand that this is implemented using async code, so maybe it just needs to be documented somewhere for people coming from a synchronous language where this sort of thing isn't possible. I'm personally coming from Ruby on Rails and binding.pry. |
I'm confused. It's not preventing you from entering the debugger - you enter the debugger just fine. You continue, and it fails, as it looks like it should. |
I simply mean it's not pausing where I expected. |
I'm sorry, I still don't understand the problem. It pauses after the command above, which logs the text, correct? And it pauses before the line after? What behavior are you expecting? |
No problem. Using this code:
It does not pause on the This code does pause as expected:
It's an async vs sync thing, I think. |
OK, I think what you are saying is just that This is commented in http://angular.github.io/protractor/#/debugging, but I'll also update the function description to try to make it super clear that |
It was clear to me before I opened this issue that The documentation says Anyway, I'm clear on why |
Made some doc changes that hopefully clarify the issue. |
use browser.pause() |
I'm running 1.4 and 1.5 of protractor with webdriver standalone and chromedriver on Mac OSX. Setting
browser.debugger()
in a test and running protractor with the debug argument results in the debug prompt, but pressingc
causes my test to fail on the line after thebrowser.debugger()
statement.Using
debugger
instead pauses the test where expected. I see browser.debugger() mentioned as far back as protractor 0.20 on the web, so I'm fairly certain it should work. How do I debug this situation?The text was updated successfully, but these errors were encountered: