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

Commit

Permalink
fix issue where ElementFinder.then does not return a promise
Browse files Browse the repository at this point in the history
See #1152
  • Loading branch information
hankduan committed Aug 5, 2014
1 parent 316961c commit d15d35a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/protractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ var buildElementHelper = function(ptor) {
if (this.opt_actionResult_) {
return this.opt_actionResult_.then(fn, errorFn);
} else {
return fn(this);
return webdriver.promise.fulfilled(fn(this));
}
};

Expand Down
6 changes: 6 additions & 0 deletions spec/basic/elements_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ describe('ElementFinder', function() {
});
expect(successful).toEqual(false);
});

it('should always return a promise when calling then', function() {
browser.get('index.html#/form');
var e1 = element(by.tagName('body')).then(function(){});
expect(e1 instanceof protractor.promise.Promise).toBe(true);
});
});

describe('evaluating statements', function() {
Expand Down

0 comments on commit d15d35a

Please sign in to comment.