I've just started to use Protractor. I created several page objects and everything is working fine till now. I log in to a page and I'm being redirected to the myaccount page.
On that page, I got the following error:
Error while waiting for Protractor to sync with the page: "window.angular is undefined.
My code is here:
var myaccount = function(){
//some function but everything is commented out
};
module.exports = new myaccount();
Here is my login test as well:
this.loginSuccess = function(){
userName.sendKeys(params.registration.email);
password.sendKeys(params.registration.password);
submitButton.click();
};
After the click, myaccount page appears but the protractor throws the mentioned error.
Could somebody help me with this?
See the answer from mcalthrop here: https://github.com/angular/protractor/issues/610
Can use like
var newpage = new RegExp('welcome', 'i');
submitButton.click();
waitForUrlToChangeTo(newpage).then(function () {
expect(browser.getTitle()).toEqual('Welcome!');
});
/**
* @name waitForUrlToChangeTo
* @description Wait until the URL changes to match a provided regex
* @param {RegExp} urlRegex wait until the URL changes to match this regex
* @returns {!webdriver.promise.Promise} Promise
*/
function waitForUrlToChangeTo(urlRegex) {
var currentUrl;
return browser.getCurrentUrl().then(function storeCurrentUrl(url) {
currentUrl = url;
}
).then(function waitForUrlToChangeTo() {
return browser.wait(function waitForUrlToChangeTo() {
return browser.getCurrentUrl().then(function compareCurrentUrl(url) {
return urlRegex.test(url);
});
});
}
);
}
window.angular is undefined
means you are trying to make protractor go to a page that is not angular