I am writing a test case for adding store information in the page for Angular app using Protractor, where initially I am counting the number of stores I already have and aft
For creating a promise in protractor, you have to write:
var deferred = protractor.promise.defer();
var promise = deferred.promise;
The callbacks are invoked asynchronously. You can register one (or more) "on success" callbacks:
promise.then(function() {
...
});
you can also register one (or more) "on error" callback:
promise.then(null, function() {
...
});
These registrations could be chained:
promise.then(function() {
...
}).then(function() {
...
}).then(null, function() {
...
}).then(function() {
}, function() {
...
}).then(onSuccess, onFailure);
The "on success" callbacks are invoked when the promise is resolved successfully:
deferred.fulfill(value);
The "on failure" callbacks are invoked when the promise is resolved successfully:
deferred.reject(new Error('a problem occurs'));
you missed the resolution step. You have to fulfill the promise.
A more complete reference is available in the Webdriver.js documentation