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

Closed
penfold opened this Issue Nov 14, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@penfold
Contributor

penfold commented Nov 14, 2013

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

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Dec 17, 2013

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.

ghost commented Dec 17, 2013

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

This comment has been minimized.

Show comment Hide comment
@juliemr

juliemr Jan 12, 2014

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?

Owner

juliemr commented Jan 12, 2014

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

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Jan 13, 2014

@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.

ghost commented Jan 13, 2014

@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 Jan 23, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment