From df3dd6400e3a4792ff9f7a58849d2a5eed6e1483 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 14 May 2020 11:53:40 +0200 Subject: [PATCH] fix: remove elementExplorer api and command line Protractor debugger and element explorer cannot be used for Node.js 8+ and were removed in version 7. --- bin/elementexplorer.js | 46 ------------------------------------------ docs/debugging.md | 45 ----------------------------------------- lib/cli.ts | 5 +---- lib/launcher.ts | 3 +-- 4 files changed, 2 insertions(+), 97 deletions(-) delete mode 100755 bin/elementexplorer.js diff --git a/bin/elementexplorer.js b/bin/elementexplorer.js deleted file mode 100755 index 069b7552c..000000000 --- a/bin/elementexplorer.js +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env node - -/** - * This is an explorer to help get the right element locators, and test out what - * Protractor commands will do on your site without running a full test suite. - * - * This beta version only uses the Chrome browser. - * - * Usage: - * - * Expects a selenium standalone server to be running at http://localhost:4444 - * from protractor directory, run with: - * - * ./bin/elementexplorer.js - * - * This will load up the URL on webdriver and put the terminal into a REPL loop. - * You will see a > prompt. The `browser`, `element` and `protractor` variables - * will be available. Enter a command such as: - * - * > element(by.id('foobar')).getText() - * - * or - * - * > browser.get('http://www.angularjs.org') - * - * try just - * - * > browser - * - * to get a list of functions you can call. - * - * Typing tab at a blank prompt will fill in a suggestion for finding - * elements. - */ -console.log('Please use "protractor [configFile] [options] --elementExplorer"' + - ' for full functionality\n'); - -if (process.argv.length > 3) { - console.log('usage: elementexplorer.js [url]'); - process.exit(1); -} else if (process.argv.length === 3) { - process.argv[2] = ('--baseUrl=' + process.argv[2]); -} - -process.argv.push('--elementExplorer'); -require('../built/cli.js'); diff --git a/docs/debugging.md b/docs/debugging.md index 3be69ef65..7c967f223 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -258,51 +258,6 @@ used from the browser's console. > window.clientSideScripts.findInputs('username', document.getElementById('#myEl')); ``` -**Testing Out Protractor Interactively** - -When debugging or first writing test suites, you may find it helpful to -try out Protractor commands without starting up the entire test suite. You can -do this with the element explorer. - -To run element explorer, simply run protractor as you normally would, but pass in -the flag --elementExplorer: - - protractor --elementExplorer - -This will load up the URL on WebDriver and put the terminal into a REPL loop. -You will see a > prompt. The `browser`, `element` and `protractor` variables will -be available. Enter a command such as: - - > browser.get('http://www.angularjs.org') - -or - - > element(by.id('foobar')).getText() - -Typing tab at a blank prompt will fill in a suggestion for finding -elements. You can also use the `list(locator)` command to list all elements -matching a locator. - -Element explorer will start chrome by default. However, you can specify -another browser, change browser settings, or specify any other config that you -normally would with your protractor test. To do this, pass configs to -protractor like you normally would, -but with the `--elementExplorer` flag set: - - protractor [configFile] [options] --elementExplorer - -For example, to connect to ChromeDriver directly, use - - protractor --directConnect --elementExplorer - -Element explore will ignore your specs, not set up your framework (e.g. jasmine, -mocha, cucumber), and only allow you to pass in 1 capability, but will honor -every other parameter in your config. - -Note `baseUrl` is used here as the initial page, i.e. element explorer will try -to navigate to `baseUrl` automatically on start. - - ## Taking Screenshots WebDriver can snap a screenshot with `browser.takeScreenshot()`. This can be a diff --git a/lib/cli.ts b/lib/cli.ts index 7b184af02..d6a0ebace 100644 --- a/lib/cli.ts +++ b/lib/cli.ts @@ -99,7 +99,6 @@ let allowedNames = [ 'nodeDebug', 'debuggerServerPort', 'frameworkPath', - 'elementExplorer', 'debug', 'logLevel', 'disableChecks', @@ -134,7 +133,6 @@ let yargsOptions: any = { framework: 'Test framework to use: jasmine, mocha, or custom', resultJsonOutputFile: 'Path to save JSON test result', troubleshoot: 'Turn on troubleshooting output', - elementExplorer: 'Interactively test Protractor commands', debuggerServerPort: 'Start a debugger server at specified port instead of repl', disableChecks: 'Disable cli checks', logLevel: 'Define Protractor log level [ERROR, WARN, INFO, DEBUG]' @@ -148,7 +146,6 @@ let yargsOptions: any = { build: 'capabilities.build', grep: 'jasmineNodeOpts.grep', 'invert-grep': 'jasmineNodeOpts.invertGrep', - explorer: 'elementExplorer' }, strings: {'capabilities.tunnel-identifier': ''} }; @@ -232,7 +229,7 @@ if (!configFile) { } } -if (!configFile && !argv.elementExplorer && args.length < 3) { +if (!configFile && args.length < 3) { console.log( '**you must either specify a configuration file ' + 'or at least 3 options. See below for the options:\n'); diff --git a/lib/launcher.ts b/lib/launcher.ts index 6a92e20ea..462137415 100644 --- a/lib/launcher.ts +++ b/lib/launcher.ts @@ -159,8 +159,7 @@ let initFn = function(configFile: string, additionalConfig: Config) { }); }) .then(() => { - // 3) If we're in `elementExplorer` mode, run only that. - if (config.elementExplorer || config.framework === 'explorer') { + if (config.framework === 'explorer') { if (config.multiCapabilities.length != 1) { throw new Error('Must specify only 1 browser while using elementExplorer'); } else {