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

Commit

Permalink
feat(webdriver): update to WebDriverJS 2.43.5
Browse files Browse the repository at this point in the history
Breaking Changes
WebDriverJS has introduced changes in the way that Promises are handled in version
2.43. See https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/CHANGES.md
 - `webdriver.WebElement` has now been split into `webdriver.WebElementPromise`
   and `webdriver.WebElement` so that it does not resolve to itself. This change
   should be largely transparent to users.
 - `WebElement.toWireValue` has been removed.
  • Loading branch information
juliemr committed Sep 22, 2014
1 parent f3ebd54 commit f7c3c37
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
11 changes: 6 additions & 5 deletions lib/protractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var DEFER_LABEL = 'NG_DEFER_BOOTSTRAP!';
var WEB_ELEMENT_FUNCTIONS = [
'click', 'sendKeys', 'getTagName', 'getCssValue', 'getAttribute', 'getText',
'getSize', 'getLocation', 'isEnabled', 'isSelected', 'submit', 'clear',
'isDisplayed', 'getOuterHtml', 'getInnerHtml', 'toWireValue'];
'isDisplayed', 'getOuterHtml', 'getInnerHtml', 'getId'];

var STACK_SUBSTRINGS_TO_FILTER = [
'node_modules/minijasminenode/lib/',
Expand Down Expand Up @@ -198,9 +198,10 @@ var buildElementHelper = function(ptor) {
childrenPromiseList.push(childrenPromise);
});


// Resolve the list of Promise<List<child_web_elements>> and merge into
// a single list
return webdriver.promise.fullyResolved(childrenPromiseList).then(
return webdriver.promise.all(childrenPromiseList).then(
function(resolved) {
var childrenList = [];
resolved.forEach(function(resolvedE) {
Expand Down Expand Up @@ -429,7 +430,7 @@ var buildElementHelper = function(ptor) {
arr.forEach(function(webElem) {
list.push(actionFn(webElem));
});
return list;
return webdriver.promise.all(list);
});
return new ElementArrayFinder(this.getWebElements, this.locator_, actionResults);
};
Expand Down Expand Up @@ -477,7 +478,7 @@ var buildElementHelper = function(ptor) {
*/
ElementArrayFinder.prototype.then = function(fn, errorFn) {
if (this.actionResults_) {
return webdriver.promise.fullyResolved(this.actionResults_).then(fn, errorFn);
return this.actionResults_.then(fn, errorFn);
} else {
return this.asElementFinders_().then(fn, errorFn);
}
Expand Down Expand Up @@ -747,7 +748,7 @@ var buildElementHelper = function(ptor) {
function(parentWebElements) {
return parentWebElements[0];
});
return new webdriver.WebElement(ptor.driver, id);
return new webdriver.WebElementPromise(ptor.driver, id);
};

/**
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"author": "Julie Ralph <ju.ralph@gmail.com>",
"dependencies": {
"request": "~2.36.0",
"selenium-webdriver": "2.42.1",
"selenium-webdriver": "2.43.5",
"minijasminenode": "1.1.1",
"jasminewd": "1.0.4",
"jasminewd": "1.1.0",
"saucelabs": "~0.1.0",
"glob": "~3.2",
"adm-zip": "0.4.4",
Expand Down
4 changes: 3 additions & 1 deletion spec/basic/elements_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('ElementFinder', function() {
it('should return the same result as browser.findElement', function() {
browser.get('index.html#/form');
var nameByElement = element(by.binding('username'));

expect(nameByElement.getText()).toEqual(
browser.findElement(by.binding('username')).getText());
});
Expand Down Expand Up @@ -161,13 +162,14 @@ describe('ElementFinder', function() {
var elem = element(by.binding('greeting'));

elem.then(function(elem2) {
expect(elem.toWireValue()).toEqual(elem2.toWireValue());
expect(elem.getId()).toEqual(elem2.getId());
});
});

it('should not resolve to itself', function() {
browser.get('index.html#/form');
var elem1 = element(by.binding('greeting'));

elem1.then(function(result) {
expect(result === elem1).toBe(false);
});
Expand Down

0 comments on commit f7c3c37

Please sign in to comment.