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

Commit ffa3519

Browse files
committed
chore(debugger): remove debugger and explore methods (#5070)
1 parent 0f7a38a commit ffa3519

File tree

8 files changed

+2
-1024
lines changed

8 files changed

+2
-1024
lines changed

lib/browser.ts

+1-120
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import {BPClient} from 'blocking-proxy';
2-
import {ActionSequence, By, Capabilities, Command as WdCommand, FileDetector, ICommandName, Navigation, Options, promise as wdpromise, Session, TargetLocator, TouchSequence, until, WebDriver, WebElement, WebElementPromise} from 'selenium-webdriver';
2+
import {By, Command as WdCommand, ICommandName, Navigation, promise as wdpromise, Session, WebDriver, WebElement, WebElementPromise} from 'selenium-webdriver';
33
import * as url from 'url';
44
import {extend as extendWD, ExtendedWebDriver} from 'webdriver-js-extender';
55

6-
import {DebugHelper} from './debugger';
76
import {build$, build$$, ElementArrayFinder, ElementFinder} from './element';
87
import {IError} from './exitCodes';
98
import {ProtractorExpectedConditions} from './expectedConditions';
@@ -309,11 +308,6 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
309308
*/
310309
ng12Hybrid: boolean;
311310

312-
/**
313-
* A helper that manages debugging tests.
314-
*/
315-
debugHelper: DebugHelper;
316-
317311
// This index type allows looking up methods by name so we can do mixins.
318312
[key: string]: any;
319313

@@ -358,7 +352,6 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
358352
this.getPageTimeout = DEFAULT_GET_PAGE_TIMEOUT;
359353
this.params = {};
360354
this.resetUrl = DEFAULT_RESET_URL;
361-
this.debugHelper = new DebugHelper(this);
362355

363356
let ng12Hybrid_ = false;
364357
Object.defineProperty(this, 'ng12Hybrid', {
@@ -1038,118 +1031,6 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
10381031
clientSideScripts.getLocationAbsUrl, 'Protractor.getLocationAbsUrl()', rootEl));
10391032
}
10401033

1041-
/**
1042-
* Adds a task to the control flow to pause the test and inject helper
1043-
* functions
1044-
* into the browser, so that debugging may be done in the browser console.
1045-
*
1046-
* This should be used under node in debug mode, i.e. with
1047-
* protractor debug <configuration.js>
1048-
*
1049-
* @example
1050-
* While in the debugger, commands can be scheduled through webdriver by
1051-
* entering the repl:
1052-
* debug> repl
1053-
* > element(by.input('user')).sendKeys('Laura');
1054-
* > browser.debugger();
1055-
* Press Ctrl + c to leave debug repl
1056-
* debug> c
1057-
*
1058-
* This will run the sendKeys command as the next task, then re-enter the
1059-
* debugger.
1060-
*/
1061-
debugger() {
1062-
// jshint debug: true
1063-
return this.driver.executeScript(clientSideScripts.installInBrowser)
1064-
.then(() => wdpromise.controlFlow().execute(() => {
1065-
debugger;
1066-
}, 'add breakpoint to control flow'));
1067-
}
1068-
1069-
/**
1070-
* See browser.explore().
1071-
*/
1072-
enterRepl(opt_debugPort?: number) {
1073-
return this.explore(opt_debugPort);
1074-
}
1075-
1076-
/**
1077-
* Beta (unstable) explore function for entering the repl loop from
1078-
* any point in the control flow. Use browser.explore() in your test.
1079-
* Does not require changes to the command line (no need to add 'debug').
1080-
* Note, if you are wrapping your own instance of Protractor, you must
1081-
* expose globals 'browser' and 'protractor' for pause to work.
1082-
*
1083-
* @example
1084-
* element(by.id('foo')).click();
1085-
* browser.explore();
1086-
* // Execution will stop before the next click action.
1087-
* element(by.id('bar')).click();
1088-
*
1089-
* @param {number=} opt_debugPort Optional port to use for the debugging
1090-
* process
1091-
*/
1092-
explore(opt_debugPort?: number) {
1093-
let debuggerClientPath = __dirname + '/debugger/clients/explorer.js';
1094-
let onStartFn = (firstTime: boolean) => {
1095-
logger.info();
1096-
if (firstTime) {
1097-
logger.info('------- Element Explorer -------');
1098-
logger.info(
1099-
'Starting WebDriver debugger in a child process. Element ' +
1100-
'Explorer is still beta, please report issues at ' +
1101-
'github.com/angular/protractor');
1102-
logger.info();
1103-
logger.info('Type <tab> to see a list of locator strategies.');
1104-
logger.info('Use the `list` helper function to find elements by strategy:');
1105-
logger.info(' e.g., list(by.binding(\'\')) gets all bindings.');
1106-
logger.info();
1107-
}
1108-
};
1109-
this.debugHelper.initBlocking(debuggerClientPath, onStartFn, opt_debugPort);
1110-
}
1111-
1112-
/**
1113-
* Beta (unstable) pause function for debugging webdriver tests. Use
1114-
* browser.pause() in your test to enter the protractor debugger from that
1115-
* point in the control flow.
1116-
* Does not require changes to the command line (no need to add 'debug').
1117-
* Note, if you are wrapping your own instance of Protractor, you must
1118-
* expose globals 'browser' and 'protractor' for pause to work.
1119-
*
1120-
* @example
1121-
* element(by.id('foo')).click();
1122-
* browser.pause();
1123-
* // Execution will stop before the next click action.
1124-
* element(by.id('bar')).click();
1125-
*
1126-
* @param {number=} opt_debugPort Optional port to use for the debugging
1127-
* process
1128-
*/
1129-
pause(opt_debugPort?: number): wdpromise.Promise<any> {
1130-
if (this.debugHelper.isAttached()) {
1131-
logger.info('Encountered browser.pause(), but debugger already attached.');
1132-
return wdpromise.when(true);
1133-
}
1134-
let debuggerClientPath = __dirname + '/debugger/clients/wddebugger.js';
1135-
let onStartFn = (firstTime: boolean) => {
1136-
logger.info();
1137-
logger.info('Encountered browser.pause(). Attaching debugger...');
1138-
if (firstTime) {
1139-
logger.info();
1140-
logger.info('------- WebDriver Debugger -------');
1141-
logger.info(
1142-
'Starting WebDriver debugger in a child process. Pause is ' +
1143-
'still beta, please report issues at github.com/angular/protractor');
1144-
logger.info();
1145-
logger.info('press c to continue to the next webdriver command');
1146-
logger.info('press ^D to detach debugger and resume code execution');
1147-
logger.info();
1148-
}
1149-
};
1150-
this.debugHelper.init(debuggerClientPath, onStartFn, opt_debugPort);
1151-
}
1152-
11531034
/**
11541035
* Determine if the control flow is enabled.
11551036
*

0 commit comments

Comments
 (0)