protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Long Polling http request;

Open pravalviptela opened this issue 11 years ago • 8 comments

Error: Timed out waiting for Protractor to synchronize with the page after 11 seconds.

angular.module('someName').factory('eventPoll', eventPoll);

eventPoll.$inject = ['$rootScope', '$log', '$interval', 'eventPollService'];

Due to this factory 'eventPoll', my protractor tests are getting failed.

I am using it in my test to avert this:-

browser.addMockModule('notificatonOverride', function() { angular.module('notificatonOverride').service('eventPoll', function() { function eventPoll($rootScope, $log, $interval, eventPollService) { }); });

how to resolve this??

pravalviptela avatar Mar 20 '15 21:03 pravalviptela

Please read https://help.github.com/articles/github-flavored-markdown/ to learn how to use markdown to format your issues better, this makes it much easier to read and respond.

juliemr avatar Mar 23 '15 17:03 juliemr

This is a limitation in the way that Protractor waits for pages to be stable. What you are doing looks like a good workaround, are you having problems with it?

juliemr avatar Mar 23 '15 17:03 juliemr

Thanks for the response. The workaround is not working for me.

In my scenario I have a big Module and inside that have a factory(Long polling one). I don't want to wait for that factory. Essentially just want to mock that particular factory.

angular.module('vManage').factory('eventPoll', eventPoll);

eventPoll.$inject = ['$rootScope', '$log', '$interval', 'eventPollService'];

function eventPoll($rootScope, $log, $interval, eventPollService) { ...} 

So can you please explain how can I do that?

pravalviptela avatar Mar 23 '15 17:03 pravalviptela

OK, it sounds like this is more of a question than an issue or feature request, so I'm closing the issue per our contribution guidelines.

You want to do something like:

browser.addMockModule('notificatonOverride', function() {
  angular.module('notificatonOverride').factory('eventPoll', function() {
    // intentionally left blank, noop
  });
});

juliemr avatar Mar 23 '15 19:03 juliemr

@juliemr i am facing the same issue . Even after using the above addMockModule solution . We are unable to mock the the event Poll

snehacharkha avatar Mar 23 '15 21:03 snehacharkha

How do you know that the service is not mocked? Have you verified that the mock is set up properly and that there is not another polling event on the page?

juliemr avatar Mar 23 '15 21:03 juliemr

We have followed the test code you suggested and this is the only long poll event on the page .

snehacharkha avatar Mar 23 '15 22:03 snehacharkha

It's very hard to help without specifically knowing what is not working or having a reproducible example - could you make a minimal example that reproduces the issue?

juliemr avatar Mar 23 '15 22:03 juliemr