Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

waitForAngular does not wait for $httpBackend pass through requests #15593

Closed
mike-bresnahan opened this issue Jan 10, 2017 · 9 comments · Fixed by #15601
Closed

waitForAngular does not wait for $httpBackend pass through requests #15593

mike-bresnahan opened this issue Jan 10, 2017 · 9 comments · Fixed by #15601

Comments

@mike-bresnahan
Copy link

This change #13124 related to this issue #1434 caused this protractor issue angular/protractor#3948.

Node v6.9.2
Protractor 4.0.14
Angular 1.5.8
Chrome 55.0.2883.87
Windows 7

@petebacondarwin
Copy link
Contributor

I think we need to come up with a better way to get hold of the "original" httpBackend service for this.

@petebacondarwin
Copy link
Contributor

I think the easiest option is to change the ngMock implementation to be a decorator that caches the original $httpBackend service somewhere that ngMockE2E can use.

@mike-bresnahan
Copy link
Author

Couldn't ngMock's decorator then also support a passThrough() API similar to ngMockE2E's? Then there might be no need to load ngMockE2E into a unit/integration test.

BTW, I personally have no need to use passThrough() in unit/integration tests and the whole idea smells bad to me, but there seems to be some momentum for it.

@petebacondarwin
Copy link
Contributor

One could add the passThrough to ngMock but as you say it is not a good idea for unit tests, so I would rather not add it to the public API. Instead, we accepted that people are using the ngMockE2E in this way and letting them fudge it.

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 12, 2017
The fix from angular#13124 enabled ngMock and ngMockE2E to work together but
did it in a way that meant that the "real" `$httpBackend` service that
was used in pass-through depended upon a different `$browser` service
to the rest of the app.

This broke Protractor since it watches the `$browser` for outstanding
requests and the pass through requests were being tracked by the wrong
`$browser` instance.

Closes angular#15593
@petebacondarwin
Copy link
Contributor

@mike-bresnahan - you can see I have put together a PR for this. Can you take a look?

petebacondarwin added a commit that referenced this issue Jan 12, 2017
The fix from #13124 enabled ngMock and ngMockE2E to work together but
did it in a way that meant that the "real" `$httpBackend` service that
was used in pass-through depended upon a different `$browser` service
to the rest of the app.

This broke Protractor since it watches the `$browser` for outstanding
requests and the pass through requests were being tracked by the wrong
`$browser` instance.

Closes #15593
@mike-bresnahan
Copy link
Author

mike-bresnahan commented Jan 12, 2017

Interestingly, the outstandingRequestCount issue was fixed in 1.6 by 4f6f2bc. There are still two $browser services in 1.6, but the primary one keeps track of passThrough requests along with other requests.

@gkalpak
Copy link
Member

gkalpak commented Jan 12, 2017

Since #15601, there should be one $browser instance.

@mike-bresnahan
Copy link
Author

mike-bresnahan commented Jan 12, 2017

Yes I understand that. I was just trying to be clear that 4f6f2bc fixed the outstandingRequestCount issue, but it did not fix the "2 $browser instance" issue, thus #15601 still has merit.

@petebacondarwin
Copy link
Contributor

@mike-bresnahan glad that we were able to help.

ellimist pushed a commit to ellimist/angular.js that referenced this issue Mar 15, 2017
The fix from angular#13124 enabled ngMock and ngMockE2E to work together but
did it in a way that meant that the "real" `$httpBackend` service that
was used in pass-through depended upon a different `$browser` service
to the rest of the app.

This broke Protractor since it watches the `$browser` for outstanding
requests and the pass through requests were being tracked by the wrong
`$browser` instance.

Closes angular#15593
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants