Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Does $browser.notifyWhenNoOutstandingRequests() wait for routing to complete? #255

Closed
penfold opened this Issue · 3 comments

2 participants

@penfold

A question.. does the waitForAngular method actually wait for routing to complete?

I'm doing a navigation (with routing) then doing a url test/expect.

In Chrome, it is always okay but in Firefox - it looks like the test is failing before routing is complete.

@ghost

I'm having the same issue: tests do not pause for routing to complete and I can't determine an easy way to check manually. This seems like crucial functionality - any ideas would be greatly appreciated.

Example failing test:

browser.get('/');
element(by.id('email')).sendKeys('...');
element(by.id('password')).sendKeys('...');
element(by.id('login-btn')).click(); // starts an asynchronous login process
browser.waitForAngular(); // does not wait for routing
// login & routing may not have completed yet, expect fails
expect(browser.getCurrentUrl()).toMatch(/\/#\/home/);

*Note that we're using angular-ui-router. I've confirmed via the screenshot capture functionality that the browser hasn't even begun to leave the original page when the test fails.

This is with protractor 0.14.0 and angular 1.2.4.

@juliemr
Owner

I just added a test for switching locations and a page which loads slowly, and it works fine:

af5570f

This change uses $location to trigger the route change, and the source of slowness is a timeout call in the route's resolve.

So, it would be great if I could get some more information from you on how you are doing routing which Protractor does not wait for. Can you describe exactly how your navigation works?

@ghost

@juliemr thanks for the reply. We initially implemented a workaround polling getCurrentUrl(), but upon further investigation it seems the issue is specific to phantomjs. The Chrome driver works as expected - no workaround needed to wait for routes with an asynchronous resolve.

It would be nice if this worked in phantomjs, but it seems there are enough other issues with phantomjs that it's not an option for now. Please feel free to close this issue.

@juliemr juliemr closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.