chieffancypants/angular-loading-bar

Loading bar doesn't stop when used with protractor-http-mock

Closed this issue · 5 comments

When testing frontend with protractor and protractor-http-mock the loading bar does not stop when requests are done.

See this repository for a minimal example: https://github.com/Crevil/Test-protractor-mock-loading-bar

When ignoring the loading bar on the request everything works fine.
Is this a problem with the order of the interceptors in angular? protractor-http-mock is interception based as well.

Most likely. I'm unfamiliar with that project, so I'm not sure how much I can help on this. My guess is that the loading bar is not ever receiving a response it expects as the mock's interceptor is doing its work before the loading bar can get a response back. Probably shouldn't be much of an issue though, as it doesn't make much sense to test that the loading bar disappears, as we already have that coverage in this repo.

Can you clarify what the loading bar expects in the response? The issue for me is that my protractor tests fail due to a timeout. It seems that these outstanding requests are the issue of this.

If I know what the loading bar expects I may write the mocks accordingly?

The loading bar interceptor simply expects to get a response back:

'response': function(response) {

Without a response (either success or error), it will just sit there waiting forever. Again, not sure I can help much without knowledge of the other library, but you can simply mock out the loading bar in the tests so it doesn't cause a problem.

Hey there

I have the same problem using angular-loading-bar in a project with protractor testing.
Could you please tell me how to

simply mock out the loading bar in the tests?

I think the best way would be to disable the interceptor. But I did not find a way to do so.

Same issue here...

EDIT: never mind, found how to mock it out. However it'd be interesting to find out why it messes up completely protractor. But as you said that's more on the side of the protractor-http-mock library.