I want to test my angular app with a protractor. The app has an API Module that talks to the server During these tests I want to mock this API Module. I don't want to do full integration tests, but tests from the user input with expected values from the API. Not only could this make the client tests faster, but it would also allow me to test for edge cases, like connection errors.
How can I do this with a protractor? I just started to set up integration tests.
I used the npm protractor module, installed selenium, adjusted the default config and used the onProtractorRunner.js to verify my setup works.
I somehow expect that I will need a spy library like sinon.js or is this already included in protractor?
Edit: I read about this issue in the protractor issue tracker, which could be a way to do it. Basically, you write a Mock Module in the test, that is sent to be executed in the browser/the scope of the application.
Edit: Here are more promising Issues. The first talks about adding Mocks to the Angular App. The second talks about mocking the backend.
This looks really nice, in this case, the Angular App would stay in its original form. However this currently only works with the deprecated ng-scenarios.