I've read about how Protractor works, I've written several E2E tests in it and still I feel uncomfortable about using it with $httpBackend
service and I think it's possible I'm missing an important part of the picture.
In order to have the HTTP calls mocked out, I'd need to use $httpBackend
service provided within Angular's ngMockE2E
module. To have that module included in the application I'm testing, I'd need to configure it when bootstrapping my main module, as its dependency, like this:
angular.module('myApp', ['ngMockE2E', 'bunch-of-other-dependencies'])
It effectively means I need to have the separate initialization for my E2E tests from the production initialization. This also means I need to have the separate index.html
.
Maintaining those 2 additional files that are "almost" identical to its roots seems cumbersome. Moreover, separate index and module definition means that the tests will be testing on slightly different application than the production, which for me seems to be against its purpose.
Do I understand the puzzle here correctly or am I missing something? Are there any better solutions to run backendless E2E tests with Angular? Or maybe at least there are some workarounds to minimize the impact of the maintenance annoyances, if they are really unevitable?