Protractor node 8 debugging / async await

Viewed 293

I'm trying to speed up writing protractor tests with Node8.. previously using older versions of node and protractor I could use protractor --elementExplorer to interactively test out my selectors. However, since upgrading to node8 this is not possible.

I'm trying to find an alternative option since I keep reading that it's a better debugging experience using node 8 async/await (I.e. none control flow).

We've upgraded to the new approach and we start protractor

node --inspect-brk ./node_modules/protractor/bin/protractor protractor.conf.js

And we're using debugger statements to replace browser.pause() and to step through the code...This is all well and good. But! When you have complex scenarios that are spanning multiple screens it's very slow to restart your tests every time you make a change and inspect the result.

I want to be able to test and execute live in the chrome inspector whilst on a break point, e.g:

const email = await element(by.binding("contact.email)).getText();
email // press return to show me the result.

The problem is this returns an unresolved promise...

And because you're on a debugger statement the execution is paused and you can't get the resolved promise value. It seems that jasmine executes the step and closes down the session before the promise can resolve. Does anyone know how I can debug in this way?

Cheers

Kevin

0 Answers
Related