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

Commit fa699b8

Browse files
committed
fix(debugger): fix 'getControlFlowText()' broken in webdriver 2.45
1 parent e6e668c commit fa699b8

File tree

2 files changed

+11
-35
lines changed

2 files changed

+11
-35
lines changed

lib/debugger/modes/debuggerRepl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ DebuggerRepl.prototype.printControlFlow_ = function(callback) {
100100
command: 'evaluate',
101101
arguments: {
102102
frame: 0,
103-
maxStringLength: 2000,
103+
maxStringLength: 4000,
104104
expression: 'protractor.promise.controlFlow().getControlFlowText()'
105105
}
106106
}, function(err, controlFlowResponse) {

lib/protractor.js

+10-34
Original file line numberDiff line numberDiff line change
@@ -625,40 +625,16 @@ Protractor.prototype.initDebugger_ = function(debuggerClientPath, opt_debugPort)
625625
// Patch in a function to help us visualize what's going on in the control
626626
// flow.
627627
webdriver.promise.ControlFlow.prototype.getControlFlowText = function() {
628-
var descriptions = [];
629-
630-
var getDescriptions = function(frameOrTask, descriptions) {
631-
if (frameOrTask.getDescription) {
632-
var stacktrace = frameOrTask.snapshot_.getStacktrace();
633-
stacktrace = stacktrace ? stacktrace.join('\n').trim() : '';
634-
descriptions.push({
635-
description: frameOrTask.getDescription(),
636-
stack: helper.filterStackTrace(stacktrace)
637-
});
638-
} else {
639-
for (var i = 0; i < frameOrTask.children_.length; ++i) {
640-
getDescriptions(frameOrTask.children_[i], descriptions);
641-
}
642-
}
643-
};
644-
if (this.history_.length) {
645-
getDescriptions(this.history_[this.history_.length - 1], descriptions);
646-
}
647-
if (this.activeFrame_.getPendingTask()) {
648-
getDescriptions(this.activeFrame_.getPendingTask(), descriptions);
649-
}
650-
getDescriptions(this.activeFrame_.getRoot(), descriptions);
651-
var asString = '-- WebDriver control flow schedule \n';
652-
for (var i = 0; i < descriptions.length; ++i) {
653-
asString += ' |- ' + descriptions[i].description;
654-
if (descriptions[i].stack) {
655-
asString += '\n |---' + descriptions[i].stack.replace(/\n/g, '\n |---');
656-
}
657-
if (i != (descriptions.length - 1)) {
658-
asString += '\n';
659-
}
660-
}
661-
return asString;
628+
var controlFlowText = this.getSchedule(/* opt_includeStackTraces */ true);
629+
// This filters the entire control flow text, not just the stack trace, so
630+
// unless we maintain a good (i.e. non-generic) set of keywords in
631+
// STACK_SUBSTRINGS_TO_FILTER, we run the risk of filtering out non stack
632+
// trace. The alternative though, which is to reimplement
633+
// webdriver.promise.ControlFlow.prototype.getSchedule() here is much
634+
// hackier, and involves messing with the control flow's internals / private
635+
// variables.
636+
return helper.filterStackTrace(controlFlowText);
637+
662638
};
663639

664640
if (opt_debugPort) {

0 commit comments

Comments
 (0)