Dororo
Dororo

Reputation: 3440

Avoiding test synchronization timeouts in Protractor when long polling

Angularjs recently introduced $interval, the counterpart to setInterval to help avoid cases where Protractor would think the page was still loading when it was actually polling.

However, this fix doesn't help with long poll scenarios, where the connection is held open for x milliseconds then closed by the server. Is there any workaround for this, so Protractor will execute the tests correctly?

Upvotes: 3

Views: 545

Answers (1)

yurisich
yurisich

Reputation: 7109

Why doesn't it?

$interval(function () {
    MySrvc.pollServer();
}, 1000 * 60 * 3, 1);

If you're only interested in doing it once, then just say so in the third argument, count. Your tests will then proceed as usual without resorting to the dreaded browser.ignoreSynchronization.

Upvotes: 2

Related Questions