Closed rpavlov closed 8 years ago
it seems ignoreSynchronization is incompatible with browser.addMockModule method used by httpbackend. I am going to examine this issue
+1, I am having the same issue. Thanks for your support @nchaulet!
ignoreSynchronization method is not compatible with browser.addMockModule used in internal by httpbackend, why do you set ignoreSynchronization to true ?
Well I'm not sure but I know that without it waitForAngular() never resolves. I suspect it's my application code but not sure where. we are not doing any type of browser polling using $timeout and our ng-app attribute is on the body tag. Thanks for your response, I really appreciate it
Maybe you have a $timeout in an external dependencies ?
yup, I found one. So for clarity here. should all Angular applications that have e2e testing with Protractor just simply never use $timeout for anything?
According to the protractor documentation you should never use $timeout but use $interval
got it. So I should even use that for a single timeout and cancel after the first interval. Thanks again Nicolas, you're legend in my book :)
Using $timeout is OK, but your app will only synchronize with protractor once all timeouts have resolved.
If you're using a $timeout with a 0 value to perform something in the next digest cycle, that'll be fine.
If, however, you have a $timeout that logs the user out after 10 minutes, the app will never sync. This will need to be replaced with a $interval that you cancel once it's done its job.
When I set
browser.ignoreSynchronization = true
and{ autoSync: false}
a call to backend.sync() yields aUnknownError: unknown error: Cannot read property 'context' of undefined
. It's trigged on this line in httpbackend.jsthis.browser.driver.executeScript(jsBuilder.toString());
You can reproduce this in the e2e test for manual sync:
Any tips would be welcome :)