New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
browser.ignoreSynchronization #973
Comments
Are you sure that there are no long $timeout requests or polling $timeout requests on the page? See https://github.com/angular/protractor/blob/master/docs/faq.md#my-tests-time-out-in-protractor-but-everythings-working-fine-when-running-manually-whats-up |
Wow, you're good! Thank you so much, it all makes sense now! :) Going to try to get it working now! |
Hm - you can use the |
Good point! Going to type my solution here when I find a good one! You're the best, thanks again! :) |
I fixed this by changing $timeout to $interval like you said. Works perfectly! |
Julie, What needs to be done when we are using some third-party service (such as pubnub) and this third party service is constantly polling the server ? Is there a workaround ? |
I think you just have to set ignoreSynchronization to true or change that service to angular's $interval service (https://docs.angularjs.org/api/ng/service/$interval) |
In the previous days i fought with the same protractor timeout issue and replacing $timeout with $interval seems working but considering that:
@juliemr, i think that angular documentation should notice developers that using $timeout could leads to testing issues, what do you think about it? Furthermore, according to the $interval API, all intervals created must be manually destroyed meanwhile $timeout not: a simple batch replace couldn't be appropriate, forcing me to return back in the code to destroy the intervals. |
What is the update? It doesn't make sense to me that either of these could be the "accepted solution". I have an application that doesn't poll at all and loads within 5.46s but even setting timeouts to 60s it still doesn't synchronize.
|
@stramel I'm happy to hear other ideas. We're constrained by the basic fact that we're trying to figure out when the webpage is stable (done with anything asynchronous that would cause race conditions). The way we do that is having angular keep track of http requests, promises that are pending, and pending timeouts. So, if you always have a pending timeout, you page will never be marked as stable. |
@juliemr Is there a reason promises are part of marking it as stable? |
I can find elements but performing actions is causing timeouts with describe('New Retail Web homepage', function() {
it('should log in', function() {
var orderType, elem;
browser.get('/');
orderType = element(by.repeater('orderType in orderTypes').row(0));
expect(orderType).toBeDefined();
orderType.click(); // Works with this line commented out
// ... more code here
});
}); |
Here's the things that we test against, including stuff like "http request then promise": https://github.com/angular/protractor/blob/master/testapp/async/async.js The philosophy is that we want to make sure you don't get race conditions, so asynchronous actions on your page should be completed before you do the next action. It's impossible to debug your specific case without knowing what the application is doing when you click. |
Is there any way to have |
Hi,
I have been trying to search for answers for a day now. My simple protractor test doesn't work unless i have set:
browser.ignoreSynchronization = true
If i have browser.ignoreSynchronization = false (as it is by default) it gets stuck in the first thing that should be synchronous, expect browser.get('') works!
I have a login script in my onPrepare on my config, works fine:
enviroinment.js: http://jsfiddle.net/LrgDz/
config.js: http://jsfiddle.net/PEJj3/
I have ng-app tag in 'html' tag.
login.spec.js: http://jsfiddle.net/8rQ3n/
This makes no sense. I've tried everything it feels like.
appConfig.js: http://jsfiddle.net/rn37U/
Please help me!
Best regards,
Ron
The text was updated successfully, but these errors were encountered: