The code provided above seems to be experiencing issues as "post4" and "post3" are not showing up in the console log. The promise is returned, however, attempting to chain from that promise does not seem to work.
loginPage.prototype.doLogin = function(isGood){
var d = webdriver.promise.defer();
this.driver.findElement(webdriver.By.css('input.loginbutton')).click(function() {
if(isGood){
//return new statementPage;
console.log("post3")
d.fulfill(new statement.statementPage(this.driver));
} else {
console.log("post4")
d.fulfill(this);
}
});
console.log("post5")
return d.promise;
}
If I try to execute
login.doLogin(true).then(function(){console.log("foo")})
, it won't display post3, post4, or foo in the log.
Even though other promises are working correctly elsewhere in my code, this specific piece of code doesn't seem to be functioning properly.