Socket
Socket
Sign inDemoInstall

protractor

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protractor - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

lib/driverProviders/attachSession.js

6

config.json
{
"webdriverVersions": {
"selenium": "2.48.2",
"chromedriver": "2.20",
"iedriver": "2.48.0"
"selenium": "2.51.0",
"chromedriver": "2.21",
"iedriver": "2.51.0"
}
}

@@ -19,3 +19,3 @@ Contributing

Issues
------
======

@@ -26,5 +26,6 @@ If you have a bug or feature request, please file an issue.

When submitting an issue, please include context from your test and
your application. Include a reproducible case that we can actually run, if possible. If there's an error, please include the error text. Try running with troubleshooting messages (`protractor --troubleshoot`) against your configuration to make sure that there is not an error with your setup.
Try running with troubleshooting messages (`protractor --troubleshoot`) against your configuration to make sure that there is not an error with your setup.
When submitting an issue, please include a reproducible case that we can actually run. Protractor has a test Angular application available at `http://www.protractortest.org/testapp` which you can use for the reproducible test case. If there's an error, please include the error text.
Please format code and markup in your issue using [github markdown](https://help.github.com/articles/github-flavored-markdown).

@@ -31,0 +32,0 @@

@@ -42,2 +42,3 @@ /**

describe('seleniumAddress', 'A running selenium address to use').
describe('seleniumSessionId', 'Attaching an existing session id').
describe('seleniumServerJar', 'Location of the standalone selenium jar file').

@@ -44,0 +45,0 @@ describe('seleniumPort', 'Optional port for the selenium standalone server').

var path = require('path'),
glob = require('glob'),
log = require('./logger'),
_ = require('lodash'),
helper = require('./util');

@@ -37,2 +36,3 @@

seleniumArgs: [],
seleniumSessionId: null,
mochaOpts: {

@@ -76,6 +76,26 @@ ui: 'bdd',

var makeArray = function(item) {
return _.isArray(item) ? item : [item];
return Array.isArray(item) ? item : [item];
};
/**
* Adds to an array all the elements in another array without adding any
* duplicates
*
* @param {Array<string>} dest The array to add to
* @param {Array<string>} src The array to copy from
*/
var union = function(dest, src) {
var elems = {};
for (var key in dest) {
elems[dest[key]] = true;
}
for (key in src) {
if (!elems[src[key]]) {
dest.push(src[key]);
elems[src[key]] = true;
}
}
};
/**
* Resolve a list of file patterns into a list of individual file paths.

@@ -122,3 +142,3 @@ *

if (config.suite) {
_.forEach(config.suite.split(','), function(suite) {
config.suite.split(',').forEach(function(suite) {
var suiteList = config.suites[suite];

@@ -128,3 +148,3 @@ if (suiteList == null) {

}
specs = _.union(specs, makeArray(suiteList));
union(specs, makeArray(suiteList));
});

@@ -138,4 +158,4 @@ return specs;

_.forEach(config.suites, function(suite) {
specs = _.union(specs, makeArray(suite));
Array.prototype.forEach.call(config.suites, function(suite) {
union(specs, makeArray(suite));
});

@@ -142,0 +162,0 @@ return specs;

@@ -16,11 +16,2 @@ var repl = require('repl');

/**
* Initiate debugger client.
* @private
*/
WdRepl.prototype.initClient_ = function() {
this.client =
debuggerCommons.attachDebugger(process.argv[2], process.argv[3]);
};
/**
* Instantiate a server to handle IO.

@@ -147,8 +138,7 @@ * @param {number} port The port to start the server.

WdRepl.prototype.init = function() {
console.log('Type <tab> to see a list of locator strategies.');
console.log('Use the `list` helper function to find elements by strategy:');
console.log(' e.g., list(by.binding(\'\')) gets all bindings.');
this.initClient_();
this.initReplOrServer_();
var self = this;
this.client = debuggerCommons.attachDebugger(process.argv[2], process.argv[3]);
this.client.once('ready', function() {
self.initReplOrServer_();
});
};

@@ -155,0 +145,0 @@

@@ -25,20 +25,2 @@ var repl = require('repl');

/**
* Initiate debugger client.
* @private
*/
WdDebugger.prototype.initClient_ = function() {
this.client =
debuggerCommons.attachDebugger(process.argv[2], process.argv[3]);
this.client.once('ready', function() {
console.log(' ready\n');
console.log('press c to continue to the next webdriver command');
console.log('press d to continue to the next debugger statement');
console.log('type "repl" to enter interactive mode');
console.log('type "exit" to break out of interactive mode');
console.log('press ^C to exit');
console.log();
});
};
/**
* Eval function for processing a single step in repl.

@@ -120,3 +102,3 @@ * @private

self.replServer.on('exit', function() {
console.log('Exiting debugger.');
console.log('Resuming code execution');
self.client.req({command: 'disconnect'}, function() {

@@ -134,5 +116,7 @@ // Intentionally blank.

WdDebugger.prototype.init = function() {
console.log('------- WebDriver Debugger -------');
this.initClient_();
this.initRepl_();
var self = this;
this.client = debuggerCommons.attachDebugger(process.argv[2], process.argv[3]);
this.client.once('ready', function() {
self.initRepl_();
});
};

@@ -139,0 +123,0 @@

var util = require('util');
var DBG_INITIAL_SUGGESTIONS =
['repl', 'c', 'frame', 'scopes', 'scripts', 'source', 'backtrace', 'd'];
['repl', 'c', 'frame', 'scopes', 'scripts', 'source', 'backtrace'];

@@ -63,7 +63,2 @@ /**

break;
case 'd':
this.client.req({command: 'disconnect'}, function() {
// Intentionally blank.
});
break;
default:

@@ -70,0 +65,0 @@ console.log('Unrecognized command.');

@@ -54,13 +54,12 @@ /*

case 'chrome':
var chromeDriverFile = this.config_.chromeDriver ||
path.resolve(__dirname, '../../selenium/chromedriver');
var defaultChromeDriverPath = path.resolve(__dirname, '../../selenium/chromedriver');
// Check if file exists, if not try .exe or fail accordingly
if (process.platform.indexOf('win') === 0) {
defaultChromeDriverPath += '.exe';
}
var chromeDriverFile = this.config_.chromeDriver || defaultChromeDriverPath;
if (!fs.existsSync(chromeDriverFile)) {
chromeDriverFile += '.exe';
// Throw error if the client specified conf chromedriver and its not found
if (!fs.existsSync(chromeDriverFile)) {
throw new Error('Could not find chromedriver at ' +
chromeDriverFile);
}
throw new Error('Could not find chromedriver at ' + chromeDriverFile);
}

@@ -67,0 +66,0 @@

@@ -35,6 +35,10 @@ /**

DriverProvider.prototype.getNewDriver = function() {
var newDriver = new webdriver.Builder().
usingServer(this.config_.seleniumAddress).
withCapabilities(this.config_.capabilities).
build();
var builder = new webdriver.Builder().
usingServer(this.config_.seleniumAddress).
usingWebDriverProxy(this.config_.webDriverProxy).
withCapabilities(this.config_.capabilities);
if (this.config_.disableEnvironmentOverrides === true) {
builder.disableEnvironmentOverrides();
}
var newDriver = builder.build();
this.drivers_.push(newDriver);

@@ -41,0 +45,0 @@ return newDriver;

@@ -75,12 +75,21 @@ /*

var serverConf = this.config_.localSeleniumStandaloneOpts || {};
// If args or port is not set use seleniumArgs and seleniumPort
// for backward compatibility
if (serverConf.args === undefined) {
serverConf.args = this.config_.seleniumArgs || [];
}
if (serverConf.port === undefined) {
serverConf.port = this.config_.seleniumPort;
}
// configure server
if (this.config_.chromeDriver) {
this.config_.seleniumArgs.push('-Dwebdriver.chrome.driver=' +
serverConf.args.push('-Dwebdriver.chrome.driver=' +
this.config_.chromeDriver);
}
this.server_ = new remote.SeleniumServer(this.config_.seleniumServerJar, {
args: this.config_.seleniumArgs,
port: this.config_.seleniumPort
});
this.server_ = new remote.SeleniumServer(this.config_.seleniumServerJar, serverConf);
//start local server, grab hosted address, and resolve promise

@@ -87,0 +96,0 @@ this.server_.start().then(function(url) {

@@ -184,5 +184,3 @@ var webdriver = require('selenium-webdriver');

* });
* }).then(function(filteredElements) {
* filteredElements[0].click();
* });
* }).first().click();
*

@@ -557,6 +555,6 @@ * @param {function(ElementFinder, number): webdriver.WebElement.Promise} filterFn

* @view
* <span id="foo">{{variableInScope}}</span>
* <span class="foo">{{variableInScope}}</span>
*
* @example
* var value = element(by.id('foo')).evaluate('variableInScope');
* var value = element.all(by.css('.foo')).evaluate('variableInScope');
*

@@ -935,4 +933,10 @@ * @param {string} expression

* Evaluates the input as if it were on the scope of the current element.
* @see ElementArrayFinder.evaluate
* @see ElementArrayFinder.prototype.evaluate
*
* @view
* <span id="foo">{{variableInScope}}</span>
*
* @example
* var value = element(by.id('foo')).evaluate('variableInScope');
*
* @param {string} expression

@@ -939,0 +943,0 @@ *

@@ -99,8 +99,11 @@ var q = require('q');

try {
var completed = q();
if (originalOnComplete) {
originalOnComplete(passed);
completed = q(originalOnComplete(passed));
}
resolve({
failedCount: reporter.failedCount,
specResults: reporter.testResult
completed.then(function() {
resolve({
failedCount: reporter.failedCount,
specResults: reporter.testResult
});
});

@@ -107,0 +110,0 @@ } catch (err) {

@@ -55,8 +55,11 @@ var q = require('q');

try {
var completed = q();
if (runner.getConfig().onComplete) {
runner.getConfig().onComplete();
completed = q(runner.getConfig().onComplete());
}
deferred.resolve({
failedCount: failures,
specResults: testResult
completed.then(function() {
deferred.resolve({
failedCount: failures,
specResults: testResult
});
});

@@ -63,0 +66,0 @@ } catch (err) {

@@ -31,2 +31,4 @@ Framework Adapters for Protractor

- `runner.getConfig().onComplete` must be called when tests are finished.
It might return a promise, in which case `exports.run`'s promise should not
resolve until after `onComplete`'s promise resolves.

@@ -33,0 +35,0 @@ - The returned promise must be resolved when tests are finished and it should return a results object. This object must have a `failedCount` property and optionally a `specResults`

@@ -122,3 +122,3 @@ /**

if (config.multiCapabilities.length || config.capabilities) {
log.warn('getMultiCapabilities() will override both capabilites ' +
log.warn('getMultiCapabilities() will override both capabilities ' +
'and multiCapabilities');

@@ -135,7 +135,7 @@ }

}).then(function() {
// 2) Set `multicapabilities` using `capabilities`, `multicapabilites`,
// 2) Set `multicapabilities` using `capabilities`, `multicapabilities`,
// or default
if (config.capabilities) {
if (config.multiCapabilities.length) {
log.warn('You have specified both capabilites and ' +
log.warn('You have specified both capabilities and ' +
'multiCapabilities. This will result in capabilities being ' +

@@ -142,0 +142,0 @@ 'ignored');

@@ -20,2 +20,3 @@ var util = require('util');

var DEFER_LABEL = 'NG_DEFER_BOOTSTRAP!';
var ENABLE_DEBUG_INFO_LABEL = 'NG_ENABLE_DEBUG_INFO!';
var DEFAULT_RESET_URL = 'data:text/html,<html></html>';

@@ -489,2 +490,4 @@ var DEFAULT_GET_PAGE_TIMEOUT = 10000;

* @param {!string|Function} script The JavaScript to load the module.
* Note that this will be executed in the browser context, so it cannot
* access variables from outside its scope.
* @param {...*} varArgs Any additional arguments will be provided to

@@ -635,3 +638,3 @@ * the script and may be referenced using the `arguments` object.

this.executeScript_(
'window.name = "' + DEFER_LABEL + '" + window.name;' +
'window.name = "' + DEFER_LABEL + ENABLE_DEBUG_INFO_LABEL + '" + window.name;' +
'window.location.replace("' + destination + '");',

@@ -828,2 +831,44 @@ msg('reset url'))

/**
* Validates that the port is free to use. This will only validate the first
* time it is called. The reason is that on subsequent calls, the port will
* already be bound to the debugger, so it will not be available, but that is
* okay.
*
* @return {Promise<boolean>} A promise that becomes ready when the validation
* is done. The promise will resolve to a boolean which represents whether
* this is the first time that the debugger is called.
*/
Protractor.prototype.validatePortAvailability_ = function(port) {
if (this.debuggerValidated_) {
return webdriver.promise.fulfilled(false);
}
this.debuggerValidated_ = true;
var doneDeferred = webdriver.promise.defer();
// Resolve doneDeferred if port is available.
var net = require('net');
var tester = net.connect({port: port}, function() {
doneDeferred.reject('Port ' + port +
' is already in use. Please specify ' + 'another port to debug.');
});
tester.once('error', function (err) {
if (err.code === 'ECONNREFUSED') {
tester.once('close', function() {
doneDeferred.fulfill(true);
}).end();
} else {
doneDeferred.reject(
'Unexpected failure testing for port ' + port + ': ' +
JSON.stringify(err));
}
});
return doneDeferred.then(null, function(err) {
console.error(err);
process.exit(1);
});
},
/**
* Helper function to:

@@ -835,6 +880,9 @@ * 1) Set up helper functions for debugger clients to call on (e.g.

*
* @param {string=} debuggerClientPath Absolute path of debugger client to use
* @param {string} debuggerClientPath Absolute path of debugger client to use
* @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 process
*/
Protractor.prototype.initDebugger_ = function(debuggerClientPath, opt_debugPort) {
Protractor.prototype.initDebugger_ = function(debuggerClientPath, onStartFn, opt_debugPort) {
// Patch in a function to help us visualize what's going on in the control

@@ -852,24 +900,4 @@ // flow.

return helper.filterStackTrace(controlFlowText);
};
// Invoke fn if port is available.
var onPortAvailable = function(port, fn) {
var net = require('net');
var tester = net.connect({port: port}, function() {
console.error('Port ' + port + ' is already in use. Please specify ' +
'another port to debug.');
process.exit(1);
});
tester.once('error', function (err) {
if (err.code === 'ECONNREFUSED') {
tester.once('close', fn).end();
} else {
console.error('Unexpected failure testing for port ' + port + ': ',
err);
process.exit(1);
}
});
};
var vm_ = require('vm');

@@ -898,7 +926,7 @@ var flow = webdriver.promise.controlFlow();

var debuggerReadyPromise = webdriver.promise.defer();
flow.execute(function() {
log.puts('Starting WebDriver debugger in a child process. Pause is ' +
'still beta, please report issues at github.com/angular/protractor\n');
flow.execute(function() {
process.debugPort = opt_debugPort || process.debugPort;
onPortAvailable(process.debugPort, function() {
browserUnderDebug.validatePortAvailability_(process.debugPort).then(function(firstTime) {
onStartFn(firstTime);
var args = [process.pid, process.debugPort];

@@ -1045,3 +1073,15 @@ if (browserUnderDebug.debuggerServerPort_) {

var debuggerClientPath = __dirname + '/debugger/clients/explorer.js';
this.initDebugger_(debuggerClientPath, opt_debugPort);
var onStartFn = function() {
log.puts();
log.puts('------- Element Explorer -------');
log.puts('Starting WebDriver debugger in a child process. Element ' +
'Explorer is still beta, please report issues at ' +
'github.com/angular/protractor');
log.puts();
log.puts('Type <tab> to see a list of locator strategies.');
log.puts('Use the `list` helper function to find elements by strategy:');
log.puts(' e.g., list(by.binding(\'\')) gets all bindings.');
log.puts();
};
this.initDebugger_(debuggerClientPath, onStartFn, opt_debugPort);
};

@@ -1067,3 +1107,19 @@

var debuggerClientPath = __dirname + '/debugger/clients/wddebugger.js';
this.initDebugger_(debuggerClientPath, opt_debugPort);
var onStartFn = function(firstTime) {
log.puts();
log.puts('Encountered browser.pause(). Attaching debugger...');
if (firstTime) {
log.puts();
log.puts('------- WebDriver Debugger -------');
log.puts('Starting WebDriver debugger in a child process. Pause is ' +
'still beta, please report issues at github.com/angular/protractor');
log.puts();
log.puts('press c to continue to the next webdriver command');
log.puts('press ^D to detach debugger and resume code execution');
log.puts('type "repl" to enter interactive mode');
log.puts('type "exit" to break out of interactive mode');
log.puts();
}
};
this.initDebugger_(debuggerClientPath, onStartFn, opt_debugPort);
};

@@ -1070,0 +1126,0 @@

@@ -96,3 +96,7 @@ var protractor = require('./protractor'),

} else if (this.config_.seleniumAddress) {
runnerPath = './driverProviders/hosted';
if (this.config_.seleniumSessionId) {
runnerPath = './driverProviders/attachSession';
} else {
runnerPath = './driverProviders/hosted';
}
} else if (this.config_.browserstackUser && this.config_.browserstackKey) {

@@ -99,0 +103,0 @@ runnerPath = './driverProviders/browserstack';

@@ -48,6 +48,5 @@ /**

capabilities.exclude, true, config.configDir);
capabilitiesSpecs = ConfigParser.resolveFilePatterns(
capabilitiesSpecs).filter(function(path) {
return capabilitiesSpecExcludes.indexOf(path) < 0;
});
capabilitiesSpecs = capabilitiesSpecs.filter(function(path) {
return capabilitiesSpecExcludes.indexOf(path) < 0;
});
}

@@ -54,0 +53,0 @@

@@ -15,22 +15,24 @@ {

"dependencies": {
"request": "~2.57.0",
"request": "~2.67.0",
"selenium-webdriver": "2.48.2",
"jasminewd2": "0.0.6",
"jasmine": "2.3.2",
"jasminewd2": "0.0.8",
"jasmine": "2.4.1",
"saucelabs": "~1.0.1",
"glob": "~3.2",
"adm-zip": "0.4.4",
"glob": "~6.0",
"adm-zip": "0.4.7",
"optimist": "~0.6.0",
"q": "1.0.0",
"lodash": "~2.4.1",
"source-map-support": "~0.3.2"
"q": "1.4.1",
"source-map-support": "~0.4.0"
},
"devDependencies": {
"expect.js": "~0.2.0",
"chai": "~3.3.0",
"chai-as-promised": "~5.1.0",
"jshint": "2.5.0",
"mocha": "2.3.3",
"express": "~3.3.4",
"rimraf": "~2.2.6"
"expect.js": "~0.3.1",
"chai": "~3.4.1",
"chai-as-promised": "~5.2.0",
"jshint": "2.9.1",
"mocha": "2.3.4",
"express": "~4.13.3",
"body-parser": "1.14.2",
"rimraf": "~2.5.0",
"lodash": "^2.4.1",
"marked": "^0.3.3"
},

@@ -47,3 +49,3 @@ "repository": {

"scripts": {
"pretest": "node_modules/.bin/jshint lib spec scripts",
"pretest": "./scripts/pretest.sh",
"test": "node scripts/test.js",

@@ -53,3 +55,3 @@ "start": "node testapp/scripts/web-server.js"

"license": "MIT",
"version": "3.0.0"
"version": "3.1.0"
}

@@ -1,7 +0,13 @@

Protractor [![Build Status](https://travis-ci.org/angular/protractor.png?branch=master)](https://travis-ci.org/angular/protractor)
Protractor [![Build Status](https://travis-ci.org/angular/protractor.png?branch=master)](https://travis-ci.org/angular/protractor) [![Join the chat at https://gitter.im/angular/protractor](https://badges.gitter.im/angular/protractor.svg)](https://gitter.im/angular/protractor)
==========
[Protractor](http://angular.github.io/protractor) is an end-to-end test framework for [AngularJS](http://angularjs.org/) applications. Protractor is a [Node.js](http://nodejs.org/) program built on top of [WebDriverJS](https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs). Protractor runs tests against your application running in a real browser, interacting with it as a user would.
[Protractor](http://angular.github.io/protractor) is an end-to-end test framework for [AngularJS](http://angularjs.org/) applications. Protractor is a [Node.js](http://nodejs.org/) program built on top of [WebDriverJS](https://github.com/SeleniumHQ/selenium/wiki/WebDriverJs). Protractor runs tests against your application running in a real browser, interacting with it as a user would.
Compatibility
-------------
Protractor 3 is compatible with nodejs v4 and newer.
When using nodejs v0.12, use protractor 2 (`npm install -g protractor@2`).
Getting Started

@@ -25,13 +31,5 @@ ---------------

Check the
[Protractor FAQ](https://github.com/angular/protractor/blob/master/docs/faq.md)
and read through
the [Top 20 questions on StackOverflow](http://stackoverflow.com/questions/tagged/protractor?sort=votes&pageSize=20).
Check the [Protractor FAQ](https://github.com/angular/protractor/blob/master/docs/faq.md) and read through the [Top 20 questions on StackOverflow](http://stackoverflow.com/questions/tagged/protractor?sort=votes&pageSize=20).
Please ask usage and debugging questions on
[StackOverflow](http://stackoverflow.com/questions/tagged/protractor) (use
the "protractor" tag)
or in the
[Angular discussion group](https://groups.google.com/forum/?fromgroups#!forum/angular).
(Please do not ask support questions here on Github.)
Please ask usage and debugging questions on [StackOverflow](http://stackoverflow.com/questions/tagged/protractor) (use the ["protractor"](http://stackoverflow.com/questions/ask?tags=protractor) tag), the [Gitter](https://gitter.im/angular/protractor) chat room, or in the [Angular discussion group](https://groups.google.com/forum/?fromgroups#!forum/angular). (Please do not ask support questions here on Github.)

@@ -46,2 +44,3 @@

npm install
./bin/webdriver-manager update
cd website

@@ -48,0 +47,0 @@ npm install

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc