Socket
Socket
Sign inDemoInstall

protractor

Package Overview
Dependencies
Maintainers
1
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 0.14.0 to 0.15.0

92

CHANGELOG.md

@@ -0,4 +1,76 @@

# 0.15.0
_Note: Major version 0 releases are for initial development, and backwards incompatible changes may be introduced at any time._
## Features
- ([f8d0291](https://github.com/angular/protractor/commit/f8d02910340f54af92a8ed5fdd067fa03ca2cef8)) chore(version): update the version of dependency minijasminenode
This is notable because in the newer 0.2.6 version of minijasminenode,
ddescribe and iit are supported. These should be available after running
an 'npm update'.
- ([6165023](https://github.com/angular/protractor/commit/6165023a9593f4f69fe342761b8b2d75923baf7a)) feat(runner): return a promise from runner.runOnce
In some cases knowing when the runner has finished is a requirement (e.g. an async grunt task).
- ([d44ef01](https://github.com/angular/protractor/commit/d44ef01c64023b4e3a24a9959740676b691f6074)) feat(debugging): remove webdriver lines from stacktraces by default to improve readability
- ([33fa4a4](https://github.com/angular/protractor/commit/33fa4a43acfbe87f3a4d4c84fa93c5c20b3cca0c)) feat(locators): by model works for anything with a model, not just input
Notably, by.model will now find selects and textareas.
Closes #321.
- ([238bb74](https://github.com/angular/protractor/commit/238bb7429572f9a9f6620bf1317690f1ac825960)) feat(ignoresync): ignoreSynchronization now affects the behavior of browser.get
Now, when ignoring synchronization, calls to browser.get are equivalent to calling
browser.driver.get.
Closes #306
- ([30c0ceb](https://github.com/angular/protractor/commit/30c0ceb3e2745d3bcc549f4d4963d9fade132e71)) feat(element) element.all exports an 'each' method
Usage:
```
element.all(by.model('foo')).each(function(webElement) {
// Do stuff with webElement.
});
```
Closes #298
- ([6a73a25](https://github.com/angular/protractor/commit/6a73a25c61a72ef991a604eadae010c90a157266)) feat(by.repeat) by.repeat support for multi ng-repeat
Make by.repeat (and its column and row friends) work with ng-repeat-start
and ng-repeat-end elements.
Closes #366. Closes #182.
## Bug Fixes
- ([50d6fde](https://github.com/angular/protractor/commit/50d6fde25148e24d7ef22be371b04333cdf61e50)) fix(clientSideScripts): bind-template directive shouldn't break bind locators
Fix "UnknownError: angular.element(...).data(...).$binding[0] is
undefined" error raised when trying to use "by.binding" locator in any
element of a page that contains at least one "bind-template" directive.
- ([f8c606b](https://github.com/angular/protractor/commit/f8c606bae7b2f414a67b6349f841881132d9cc97)) fix(webdriver-manager): make sure selenium standalone shuts down nicely
This addresses selenium server shutdown in two ways
- the node process will stay open until selenium has exited
- if the user inputs to STDIN (e.g. press space) selenium will shut down gracefully
- ([e98f71e](https://github.com/angular/protractor/commit/e98f71ebd7778d5c77c41bbecc73e31f1aeca177)) fix(webdriver-manager): fix IEDriver install and running via windows
Changed the binaries.ie.url function to return the correct URL for the IEDriverServer.
Created the zip object in the win32 section to be able to decompress IEDriverServer.
Added a function to normalize a command across OS and spawn it. It allows start the webdriver in win32.
Seen here:
https://github.com/yeoman/generator/blob/master/lib/actions/spawn_command.js
# 0.14.0
_Note: Major version 0 releases are for initial development, and backwards compatible changes may be introduced at any time._
_Note: Major version 0 releases are for initial development, and backwards incompatible changes may be introduced at any time._

@@ -59,3 +131,3 @@ ## Features

_Note: Major version 0 releases are for initial development, and backwards compatible changes may be introduced at any time._
_Note: Major version 0 releases are for initial development, and backwards incompatible changes may be introduced at any time._

@@ -105,3 +177,3 @@ ## Features

_Note: Major version 0 releases are for initial development, and backwards compatible changes may be introduced at any time._
_Note: Major version 0 releases are for initial development, and backwards incompatible changes may be introduced at any time._

@@ -158,3 +230,3 @@ ## Minor features

_Note: Major version 0 releases are for initial development, and backwards compatible changes may be introduced at any time._
_Note: Major version 0 releases are for initial development, and backwards incompatible changes may be introduced at any time._

@@ -177,3 +249,3 @@ This change introduces major syntax updates. Using the new syntax is recommeded, but the old version is still supported for now. Note also that the test application, docs, and example tests have been updated.

All changes should be backwards compatible, as tested with the new 'backwardscompat'
All changes should be backwards incompatible, as tested with the new 'backwardscompat'
tests.

@@ -194,3 +266,3 @@

_Note: Major version 0 releases are for initial development, and backwards compatible changes may be introduced at any time._
_Note: Major version 0 releases are for initial development, and backwards incompatible changes may be introduced at any time._

@@ -267,3 +339,3 @@ ## Features

_Note: Major version 0 releases are for initial development, and backwards compatible changes may be introduced at any time._
_Note: Major version 0 releases are for initial development, and backwards incompatible changes may be introduced at any time._

@@ -342,3 +414,3 @@ ## Features

_Note: Major version 0 releases are for initial development, and backwards compatible changes may be introduced at any time._
_Note: Major version 0 releases are for initial development, and backwards incompatible changes may be introduced at any time._

@@ -370,3 +442,3 @@ ## Features

_Note: Major version 0 releases are for initial development, and backwards compatible changes may be introduced at any time._
_Note: Major version 0 releases are for initial development, and backwards incompatible changes may be introduced at any time._

@@ -408,3 +480,3 @@ ## Docs

_Note: Major version 0 releases are for initial development, and backwards compatible changes may be introduced at any time._
_Note: Major version 0 releases are for initial development, and backwards incompatible changes may be introduced at any time._

@@ -411,0 +483,0 @@ ## Features

14

CONTRIBUTING.md
Contributing
============
Questions
---------
Please ask questions on [StackOverflow](http://stackoverflow.com/questions/tagged/protractor),
and read through the [FAQ](https://github.com/angular/protractor/blob/master/docs/faq.md)
and issue archives.
Issues
------
If you have a bug or enhancement request, please file an issue.
Before submitting an issues, please search the issue archive, read the
[FAQ](https://github.com/angular/protractor/blob/master/docs/faq.md) and
consider asking on [StackOverflow](http://stackoverflow.com/questions/tagged/protractor).
[FAQ](https://github.com/angular/protractor/blob/master/docs/faq.md).
When submitting an issue, please include context from your test and
your application. If there's an error, please include the erro text.
your application. If there's an error, please include the error text.

@@ -14,0 +22,0 @@

@@ -136,2 +136,25 @@ Debugging Protractor Tests

Sample usage:
``` javascript
// at the top of the test spec:
var fs = require('fs');
// ... other code
// abstract writing screen shot to a file
function writeScreenShot(data, filename) {
var stream = fs.createWriteStream(filename);
stream.write(buf = new Buffer(data, 'base64'));
stream.end();
}
// ...
// within a test:
browser.takeScreenshot().then(function (png) {
writeScreenShot(png, 'exception.png');
});
```
Timeouts

@@ -138,0 +161,0 @@ --------

@@ -12,3 +12,3 @@ FAQ

[$interval service](https://github.com/angular/angular.js/blob/master/src/ng/interval.js) for anything that polls continuously (introduced in Angular 1.2rc3). Further
discussion is in [issue 59](https://github.com/angular/protractor/issues/49).
discussion is in [issue 49](https://github.com/angular/protractor/issues/49).

@@ -15,0 +15,0 @@ You may also be running into a timeout because your page is slow to load

@@ -6,4 +6,4 @@ Getting Started

WebDriverJS
-----------
Understand that Protractor wraps WebDriverJS
--------------------------------------------

@@ -108,3 +108,4 @@ When writing tests, it's important to remember that Protractor is a wrapper

// Find the element with ng-model matching 'yourName', and then
// Find the element with ng-model matching 'yourName' - this will
// find the <input type="text" ng-model="yourName"/> element - and then
// type 'Julie' into it.

@@ -152,2 +153,16 @@ element(by.model('yourName')).sendKeys('Julie');

Setting up the System Under Test
--------------------------------
Protractor uses real browsers to run its tests, so it can connect to anything that your browser can connect to. This means you have great flexibility in deciding _what_ you are actually testing. It could be a development server on localhost, a staging server up on your local network, or even production servers on the general internet. All Protractor needs is the URL.
There are a couple of things to watch out for!
**If your page does manual bootstrap** Protractor will not be able to load your page using `browser.get`. Instead, use the base webdriver instance - `browser.driver.get`. This means that Protractor does not know when your page is fully loaded, and you may need to add a wait statement to make sure your tests avoid race conditions.
**If your page uses $timeout for polling** Protractor will not be able to tell when your page is ready. Consider using $interval instead of $timeout and see [this issue](https://github.com/angular/protractor/issues/49) for further discussion.
If you need to do global preparation for your tests (for example, logging in), you can put this into the config in the `onPrepare` property. This property can be either a function or a filename. If a filename, Protractor will load that file with node.js and run its contents. See the [login tests](https://github.com/angular/protractor/blob/master/spec/login) for an example.
Organizing Real Tests: Page Objects

@@ -154,0 +169,0 @@ -----------------------------------

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

global.it = wrapInControlFlow(global.it);
global.iit = wrapInControlFlow(global.iit);
global.beforeEach = wrapInControlFlow(global.beforeEach);

@@ -63,0 +64,0 @@ global.afterEach = wrapInControlFlow(global.afterEach);

@@ -44,10 +44,9 @@ /**

for (var i = 0; i < bindings.length; ++i) {
var elemData = angular.element(bindings[i]).data();
if (!elemData || !elemData.$binding) {
continue;
var dataBinding = angular.element(bindings[i]).data('$binding');
if(dataBinding) {
var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;
if (bindingName.indexOf(binding) != -1) {
matches.push(bindings[i]);
}
}
var bindingName = elemData.$binding[0].exp || elemData.$binding;
if (bindingName.indexOf(binding) != -1) {
matches.push(bindings[i]);
}
}

@@ -58,4 +57,5 @@ return matches; // Return the whole array for webdriver.findElements.

/**
* Find an array of elements matching a row within an ng-repeat. Always returns
* an array of only one element.
* Find an array of elements matching a row within an ng-repeat.
* Always returns an array of only one element for plain old ng-repeat.
* Returns an array of all the elements in one segment for ng-repeat-start.
*

@@ -66,4 +66,4 @@ * arguments[0] {Element} The scope of the search.

*
* @return {Array.<Element>} An array of a single element, the row of the
* repeater.
* @return {Array.<Element>} The row of the repeater, or an array of elements
* in the first row in the case of ng-repeat-start.
*/

@@ -75,4 +75,4 @@ clientSideScripts.findRepeaterRows = function() {

var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\:'];
var rows = [];
var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\:'];
for (var p = 0; p < prefixes.length; ++p) {

@@ -88,3 +88,25 @@ var attr = prefixes[p] + 'repeat';

}
return [rows[index]];
// multiRows is an array of arrays, where each inner array contains
// one row of elements.
var multiRows = [];
for (var p = 0; p < prefixes.length; ++p) {
var attr = prefixes[p] + 'repeat-start';
var repeatElems = using.querySelectorAll('[' + attr + ']');
attr = attr.replace(/\\/g, '');
for (var i = 0; i < repeatElems.length; ++i) {
if (repeatElems[i].getAttribute(attr).indexOf(repeater) != -1) {
var elem = repeatElems[i];
var row = [];
while (elem.nodeType != 8 ||
elem.nodeValue.indexOf(repeater) == -1) {
if (elem.nodeType == 1) {
row.push(elem);
}
elem = elem.nextSibling;
}
multiRows.push(row);
}
}
}
return [rows[index]].concat(multiRows[index]);
};

@@ -116,2 +138,18 @@

}
for (var p = 0; p < prefixes.length; ++p) {
var attr = prefixes[p] + 'repeat-start';
var repeatElems = using.querySelectorAll('[' + attr + ']');
attr = attr.replace(/\\/g, '');
for (var i = 0; i < repeatElems.length; ++i) {
if (repeatElems[i].getAttribute(attr).indexOf(repeater) != -1) {
var elem = repeatElems[i];
var row = [];
while (elem.nodeType != 8 ||
elem.nodeValue.indexOf(repeater) == -1) {
rows.push(elem);
elem = elem.nextSibling;
}
}
}
}
return rows;

@@ -149,20 +187,56 @@ };

}
// multiRows is an array of arrays, where each inner array contains
// one row of elements.
var multiRows = [];
for (var p = 0; p < prefixes.length; ++p) {
var attr = prefixes[p] + 'repeat-start';
var repeatElems = using.querySelectorAll('[' + attr + ']');
attr = attr.replace(/\\/g, '');
for (var i = 0; i < repeatElems.length; ++i) {
if (repeatElems[i].getAttribute(attr).indexOf(repeater) != -1) {
var elem = repeatElems[i];
var row = [];
while (elem.nodeType != 8 ||
(elem.nodeValue && elem.nodeValue.indexOf(repeater) == -1)) {
if (elem.nodeType == 1) {
row.push(elem);
}
elem = elem.nextSibling;
}
multiRows.push(row);
}
}
}
var row = rows[index];
var multiRow = multiRows[index];
var bindings = [];
if (row.className.indexOf('ng-binding') != -1) {
bindings.push(row);
if (row) {
if (row.className.indexOf('ng-binding') != -1) {
bindings.push(row);
}
var childBindings = row.getElementsByClassName('ng-binding');
for (var i = 0; i < childBindings.length; ++i) {
bindings.push(childBindings[i]);
}
}
var childBindings = row.getElementsByClassName('ng-binding');
for (var i = 0; i < childBindings.length; ++i) {
bindings.push(childBindings[i]);
if (multiRow) {
for (var i = 0; i < multiRow.length; ++i) {
rowElem = multiRow[i];
if (rowElem.className.indexOf('ng-binding') != -1) {
bindings.push(rowElem);
}
var childBindings = rowElem.getElementsByClassName('ng-binding');
for (var j = 0; j < childBindings.length; ++j) {
bindings.push(childBindings[j]);
}
}
}
for (var i = 0; i < bindings.length; ++i) {
var elemData = angular.element(bindings[i]).data();
if (!elemData || !elemData.$binding) {
continue;
var dataBinding = angular.element(bindings[i]).data('$binding');
if(dataBinding) {
var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;
if (bindingName.indexOf(binding) != -1) {
matches.push(bindings[i]);
}
}
var bindingName = elemData.$binding[0].exp || elemData.$binding;
if (bindingName.indexOf(binding) != -1) {
matches.push(bindings[i]);
}
}

@@ -199,4 +273,26 @@ return matches;

}
// multiRows is an array of arrays, where each inner array contains
// one row of elements.
var multiRows = [];
for (var p = 0; p < prefixes.length; ++p) {
var attr = prefixes[p] + 'repeat-start';
var repeatElems = using.querySelectorAll('[' + attr + ']');
attr = attr.replace(/\\/g, '');
for (var i = 0; i < repeatElems.length; ++i) {
if (repeatElems[i].getAttribute(attr).indexOf(repeater) != -1) {
var elem = repeatElems[i];
var row = [];
while (elem.nodeType != 8 ||
(elem.nodeValue && elem.nodeValue.indexOf(repeater) == -1)) {
if (elem.nodeType == 1) {
row.push(elem);
}
elem = elem.nextSibling;
}
multiRows.push(row);
}
}
}
var bindings = [];
for (var i = 0; i < rows.length; ++i) {
var bindings = [];
if (rows[i].className.indexOf('ng-binding') != -1) {

@@ -209,8 +305,19 @@ bindings.push(rows[i]);

}
for (var j = 0; j < bindings.length; ++j) {
var elemData = angular.element(bindings[j]).data();
if (!elemData || !elemData.$binding) {
continue;
}
for (var i = 0; i < multiRows.length; ++i) {
for (var j = 0; j < multiRows[i].length; ++j) {
var elem = multiRows[i][j];
if (elem.className.indexOf('ng-binding') != -1) {
bindings.push(elem);
}
var bindingName = elemData.$binding[0].exp || elemData.$binding;
var childBindings = elem.getElementsByClassName('ng-binding');
for (var k = 0; k < childBindings.length; ++k) {
bindings.push(childBindings[k]);
}
}
}
for (var j = 0; j < bindings.length; ++j) {
var dataBinding = angular.element(bindings[j]).data('$binding');
if (dataBinding) {
var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;
if (bindingName.indexOf(binding) != -1) {

@@ -226,2 +333,3 @@ matches.push(bindings[j]);

* Find an input elements by model name.
* DEPRECATED - use findByModel
*

@@ -247,2 +355,23 @@ * arguments[0] {Element} The scope of the search.

/**
* Find a elements by model name.
*
* arguments[0] {Element} The scope of the search.
* arguments[1] {string} The model name.
*
* @return {Array.<Element>} The matching elements.
*/
clientSideScripts.findByModel = function() {
var using = arguments[0] || document;
var model = arguments[1];
var prefixes = ['ng-', 'ng_', 'data-ng-', 'x-ng-', 'ng\\:'];
for (var p = 0; p < prefixes.length; ++p) {
var selector = '[' + prefixes[p] + 'model="' + model + '"]';
var elements = using.querySelectorAll(selector);
if (elements.length) {
return elements;
}
}
};
/**
* Find multiple select elements by model name.

@@ -249,0 +378,0 @@ *

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

* Usage:
* @DEPRECATED - use 'model' instead.
* <select ng-model="user" ng-options="user.name for user in users"></select>

@@ -117,3 +118,3 @@ * element(by.select("user"));

return driver.findElements(
webdriver.By.js(clientSideScripts.findInputs), using, model);
webdriver.By.js(clientSideScripts.findByModel), using, model);
},

@@ -125,2 +126,3 @@ message: 'by.model("' + model + '")'

/**
* @DEPRECATED - use 'model' instead.
* Usage:

@@ -148,6 +150,6 @@ * <textarea ng-model="user"></textarea>

* // Returns the DIV for the second cat.
* var secondCat = element(by.repeater("cat in pets").row(2));
* var secondCat = element(by.repeater("cat in pets").row(1));
* // Returns the SPAN for the first cat's name.
* var firstCatName = element(
* by.repeater("cat in pets").row(1).column("{{cat.name}}"));
* by.repeater("cat in pets").row(0).column("{{cat.name}}"));
* // Returns a promise that resolves to an array of WebElements from a column

@@ -154,0 +156,0 @@ * var ages = element(

var url = require('url');
var util = require('util');
var path = require('path');
var webdriver = require('selenium-webdriver');

@@ -133,2 +134,10 @@

elementArrayFinder.each = function(fn) {
ptor.findElements(locator).then(function(arr) {
arr.forEach(function(webElem) {
fn(webElem);
});
});
};
return elementArrayFinder;

@@ -505,2 +514,5 @@ }

Protractor.prototype.get = function(destination, opt_timeout) {
if (this.ignoreSynchronization) {
return this.driver.get(destination);
}
var timeout = opt_timeout || 10;

@@ -663,1 +675,23 @@ destination = url.resolve(this.baseUrl, destination);

}
/**
* Utility function that filters a stack trace to be more readable. It removes
* Jasmine test frames and webdriver promise resolution.
* @param {string} text Original stack trace.
* @return {string}
*/
exports.filterStackTrace = function(text) {
if (!text) {
return text;
}
var jasmineFilename = 'node_modules/minijasminenode/lib/jasmine-1.3.1.js';
var seleniumFilename = 'node_modules/selenium-webdriver';
var lines = [];
text.split(/\n/).forEach(function(line){
if (line.indexOf(jasmineFilename) == -1 &&
line.indexOf(seleniumFilename) == -1) {
lines.push(line);
}
});
return lines.join('\n');
}

@@ -34,3 +34,4 @@ var util = require('util');

showColors: true,
includeStackTrace: true
includeStackTrace: true,
stackFilter: protractor.filterStackTrace
}

@@ -308,3 +309,3 @@ }

var runOnce = function() {
setUpSelenium().then(function() {
return setUpSelenium().then(function() {
// cleanUp must be registered directly onto runJasmineTests, not onto

@@ -314,3 +315,3 @@ // the chained promise, so that cleanUp is still called in case of a

// would mess up chaining promises.
runJasmineTests().then(cleanUp);
return runJasmineTests().then(cleanUp);
});

@@ -317,0 +318,0 @@ };

@@ -16,3 +16,3 @@ {

"selenium-webdriver": "~2.37.0",
"minijasminenode": "~0.2.4",
"minijasminenode": ">=0.2.7",
"saucelabs": "~0.1.0",

@@ -43,8 +43,8 @@ "glob": ">=3.1.14",

"license" : "MIT",
"version": "0.14.0",
"version": "0.15.0",
"webdriverVersions": {
"selenium": "2.37.0",
"chromedriver": "2.7",
"iedriver": "2.37.0"
"selenium": "2.39.0",
"chromedriver": "2.8",
"iedriver": "2.39.0"
}
}
Protractor
==========
Protractor is an end to end test framework for [AngularJS](http://angularjs.org/) applications built on top of [WebDriverJS](https://code.google.com/p/selenium/wiki/WebDriverJs).
Protractor is an end to end test framework for [AngularJS](http://angularjs.org/) applications built on top of [WebDriverJS](https://code.google.com/p/selenium/wiki/WebDriverJs). Protractor runs tests against your application running in a real browser, interacting with it as a user would.
Protractor can be run as a standalone binary runner, or included into your tests as a library. Use [Protractor as a library](https://github.com/angular/protractor/blob/master/docs/library-only.md) if you would like to manage WebDriver and your test setup yourself.
Protractor can be run as a standalone binary, or included into your tests as a library. Use [Protractor as a library](https://github.com/angular/protractor/blob/master/docs/library-only.md) if you would like to manage WebDriver and your test setup yourself.
For more information, [read the docs](https://github.com/angular/protractor/tree/master/docs), or head over to the [FAQ](https://github.com/angular/protractor/blob/master/docs/faq.md).
For more information, [read the docs](https://github.com/angular/protractor/tree/master/docs/getting-started.md), or head over to the [FAQ](https://github.com/angular/protractor/blob/master/docs/faq.md).

@@ -20,3 +20,3 @@

The example folder contains a simple test suite which runs against angularjs.org. Run with:
The node module's example folder contains a simple test suite which runs against angularjs.org. Run with:

@@ -23,0 +23,0 @@ protractor example/conf.js

@@ -19,4 +19,5 @@ // A reference configuration file.

// to the location of this config. If no other method of starting selenium
// is found, this will default to protractor/selenium/selenium-server...
seleniumServerJar: './selenium/selenium-server-standalone-2.37.0.jar',
// is found, this will default to
// node_modules/protractor/selenium/selenium-server...
seleniumServerJar: null,
// The port to start the selenium server on, or null if the server should

@@ -23,0 +24,0 @@ // find its own unused port.

Sorry, the diff of this file is not supported yet

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