Protractor e2e Tests Login Redirection Protractor e2e Tests Login Redirection angularjs angularjs

Protractor e2e Tests Login Redirection


Your post lacks information but I'll try to make an assumption:

I suspect that your "thanks you're logged in" page makes javascript redirect after a timeout.

So after you click "Login", the browser loads "thanks you're logged in" page, and since the second parameter to .then() does nothing, browser.waitForAngular() fails because there is no angular on that page.

You should try to use something like browser.driver.wait() with a reasonable timeout to detect url change (described here: https://github.com/angular/protractor/issues/610) and trigger browser.waitForAngular() after the browser get to /success page.


Have you tried using an explicit wait?

    return browser.driver.wait(function() {        return browser.driver.getCurrentUrl().then(function(url) {            return /success/.test(url);        });    }, 10000);

Your code would be like that:

  // Click to sign in - waiting for Angular as it is manually bootstrapped.  userLoginBtn.click();  return browser.driver.wait(function() {        return browser.driver.getCurrentUrl().then(function(url) {            return /success/.test(url);        });  }, 10000);