-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Refactor element explorer to work with selenium-webdriver 3 #3828
Conversation
We can greatly simplify our code by making a change to separate the 'step by execute' and 'enter repl' debuggers more clearly. This would mean that if you do I'll go ahead and implement this to show how much easier it is to reason about. I've seen many users not know they can get into a repl from |
One more item to fix - the tab completion for the explorer is currently broken. EDIT: fixed in next commit. |
This is now ready for review! I'm also considering aliasing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, this is so much better! Also, I vote yes on browser.explore()
@@ -0,0 +1,3 @@ | |||
module.exports = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be good to have a comment here explaining why this is awesome. Oh, and maybe it should go under debugger/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done adding a comment. I don't think this belongs under debugger/ because all of the code in there runs in the separate debugger process, whereas this is part of the same process as browser + friends.
* @param {Function} onStartFn Function to call when the debugger starts. The | ||
* function takes a single parameter, which represents whether this is the | ||
* first time that the debugger is called. | ||
* @param {number=} opt_debugPort Optional port to use for the debugging | ||
* @param {number=} opt_debugPort Optional port to u`se for the debugging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tpyo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -910,7 +910,7 @@ export class ProtractorBrowser extends Webdriver { | |||
logger.info(' e.g., list(by.binding(\'\')) gets all bindings.'); | |||
logger.info(); | |||
}; | |||
this.debugHelper.init(debuggerClientPath, onStartFn, opt_debugPort); | |||
this.debugHelper.init(debuggerClientPath, true, onStartFn, opt_debugPort); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you, but it'd be nice if this were an enum, or at least had a comment explaining what this flag does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed into two different functions on the theory that the best documentation is good naming.
this.dbgCodeExecutor = { | ||
execPromise_: pausePromise, // Promise pointing to current stage of flow. | ||
execPromise_: null, // Promise pointing to currently executing command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be null instead of undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason, changed.
this.dbgRepl = new DebuggerRepl(this.client); | ||
this.currentRepl = this.dbgRepl; | ||
|
||
// We want the prompt to show up only after the controlflow text prints. | ||
this.dbgRepl.printControlFlow_(function() { | ||
// Backward compatibility: node version 0.8.14 has a number of built in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just get rid of this node 0.8.14 stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks for catching that.
@@ -76,19 +84,22 @@ DebuggerRepl.prototype.stepEval = function(cmd, callback) { | |||
* @param {function} callback | |||
*/ | |||
DebuggerRepl.prototype.complete = function(line, callback) { | |||
console.log('calling debuggerrepl complete'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, gone.
e3ee71c
to
98b7f5e
Compare
bd394d6
to
71a8d94
Compare
Comments addressed, and rebased on top of beta. PTAL! |
71a8d94
to
2d23860
Compare
2d23860
to
47590d8
Compare
Rebase successful! Just waiting for CI to be green now. |
This implementation now relies mostly on promises explicitly, so the control flow is only used to add one large task to the queue. This should pave the way for the eventual removal of the control flow, as well as getting element explorer to work immediately. BREAKING CHANGE You can no longer use the `repl` command from within `browser.pause()`. Instead, use `broser.explore()` to directly enter the repl.
47590d8
to
bf92d02
Compare
This implementation now relies mostly on promises explicitly, so the control flow is only used to add one large task to the queue. This should pave the way for the eventual removal of the control flow, as well as getting element explorer to work immediately. BREAKING CHANGE You can no longer use the `repl` command from within `browser.pause()`. Instead, use `broser.explore()` to directly enter the repl.
This implementation now relies mostly on promises explicitly,
so the control flow is only used to add one large task to the queue.
This should pave the way for the eventual removal of the control flow,
as well as getting element explorer to work immediately.
Note that there are several missing items and TODOs at the moment: