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
Protractor E2E test times out when app polls an API at regular intervals #49
Comments
Not yet - Protractor attempts to avoid syncing problems by waiting for any $timeout calls to finish, so if you have constant calls it will time out. This is probably an issue that others will run into, so I'll call it a bug. |
Thanks @juliemr. If you more details on what the app is doing (to reproduce or test a fix) let me know. |
Would love to see it fixed :) |
Will be exploring this issue in the poll branch The issue is basically - how do I tell if the site is just being slow, or if there's some intentional polling going on and it's OK to resume the E2E test? First step - give better error messages when timeouts occur. |
For the record, here's a link to the Angular Scenario Runner Issue of this same thing. |
Added a kind of lame temporary fix with 73821fb You can turn off synchronization using protractor.ignoreSynchronization But of course, this means that Protractor will NEVER wait for $timeout or $http to finish before fulfilling, which can make tests flaky. Leaving this bug open as I discuss better solutions. EDIT: See my note below about ignoreSynchronization being an instance variable, not a static / class variable. |
Important comment!
You will want to set Sorry for the confusion! |
@juliemr, I'm stuck. I don't know is it
It looks like
|
Hey everyone, With Angular 1.2rc3, you can now use the |
In our case, we have our own service that keep synchronized a local model with the server database using long polling. As a workaround to this issue, we replaced clientSideScripts.waitForAngular with a function that wait for angular $$phase and wait for our own service to be ready. This solve all our issues. @juliemr: Will be really handy if it is possible to overwrite the waitForAngular function from test configuration! |
@fedenunez Could you share more details about this $$phase patch? I'm currently facing the same issue and don't have control over the source base to change $timeout usage to $interval as @juliemr mentions Using |
@elgalu under protractor/lib/clientsidescripts.js you will find the implementation of waitForAngular function. That function is executed by protractor to synchronize the Control Flow with angular state. I just replaced that code with my own implementation that looks something like this:
I hope this help! |
Any update on this? I still need to set ptor.ignoreSynchronization = true; in beforeEach() and ptor.ignoreSynchronization = false; in afterEach(). |
I have a situation where we're loading an index page, which can take quite a long time - about ten seconds.
This is a huge pain in the ass. Any ideas on how to fix this, or just indefinitely extend the the 30000ms limit? |
I use 7mins spec timeouts, also have long running e2e tests:
|
Should add that we're already using
And still getting the |
You're getting the 30secs timeout on Firefox or Chrome or Both? |
|
@wilfredjamesgodfrey it sounds like your tests actually take more than 30 seconds. Increasing the timeout in this case seems reasonable. |
thanks @juliemr, I would do that with |
You want to change this one: https://github.com/angular/protractor/blob/master/referenceConf.js#L138 |
Ah, that's amazing @juliemr. Thanks! |
I have a permanent $interval in my app and I can't stop it via a click event since it waits to synchronize before running the test. Is there a workaround to this? |
* Made the documentation (README.md) clearer regarding issue `Could not find chromedriver...` * Due to the recently introduced addition of polling the E2E tests were partially broken also. Add `browser.ignoreSynchronization=true` to the tests as described at angular/protractor#49
* Made the documentation (README.md) clearer regarding issue `Could not find chromedriver...` * Due to the recently introduced addition of polling the E2E tests were partially broken also. Add `browser.ignoreSynchronization=true` to the tests as described at angular/protractor#49
* Made the documentation (README.md) clearer regarding issue `Could not find chromedriver...` * Due to the recently introduced addition of polling the E2E tests were partially broken also. Add `browser.ignoreSynchronization=true` to the tests as described at angular/protractor#49 XD-2015 Reference `protractor.conf.js` explicitly * Bump versions in `package.json` * Have NPM execute `webdriver-manager update` XD-2015 Polishing, updating `README.md`
This uses the ignoreSynchronization flag because of the longpoll on the event stream. It would be better to use $interval, but couldn't get that to *reliably* work when testing. I suspect that $interval won't help us here, since there is genuinely an open $http connection, as we're doing a long poll. angular/protractor#49 for more info.
* Made the documentation (README.md) clearer regarding issue `Could not find chromedriver...` * Due to the recently introduced addition of polling the E2E tests were partially broken also. Add `browser.ignoreSynchronization=true` to the tests as described at angular/protractor#49 XD-2015 Reference `protractor.conf.js` explicitly * Bump versions in `package.json` * Have NPM execute `webdriver-manager update` XD-2015 Polishing, updating `README.md`
Given that Angular 2, as of yet, at least to my knowledge, does not provide an interval service for polling. Would you propose people using protractor to test angular 2 apps workaround this issue? In cases where dropping synchronization is not possible. Cheers, |
@nvsoares That is exactly what I wanted to write as well! Is there any solution or workaround for this yet? Edit: |
Please see our updated documentation (https://github.com/angular/protractor/blob/master/docs/timeouts.md#angular) on this issue and let us know if we need to make it more clear. Thanks! |
@juliemr |
Addressing protractor members won't help directly. If you still experience problems please create a new issue and use the issue template in which you provide all needed info. Otherwise you can ask a question on Stackoverflow with the 'protractor' tag or post in the Gitter Channel to get help. |
@wswebcreation |
@MuraliMolluru , can you give me the link on SO, then I can check if I can help you there |
@wswebcreation Did u get a chance to look at the issue? |
Our app has a poller which makes calls to an API every 3 seconds. When I load a page with has an active instance of the poller Protractor will always time out.
The poller is started when the page loads and uses the Angular
$timeout
function.Is there a way to get Protractor to ignore the poller or send a signal to the app to pause the poller momentarily so the E2E test can finish running?
The text was updated successfully, but these errors were encountered: