Question

I have a custom WebSockets server that triggers route changes in a AngularJS client. I would like to carry out e2e integration tests using protractor. As the route change events are every 30 seconds and involve multiuser interactions, it seems like creating a mock of the service is the best approach. Is there a recommended way of doing this in protractor?

Was it helpful?

Solution

I am not sure if this is exactly what you are looking for, but you can define mock services in Protractor and then upload them to the browser using Protractors browser.addMockModule function. The uploaded module will replace the real one that the application would normally use. See the following blog post for more details.

http://eitanp461.blogspot.com/2014/01/advanced-protractor-features.html

OTHER TIPS

I recently had a similar problem and solved it using addMockModule as stated above. I wrote a post about it describing my solution.

http://www.functionalimperative.com/2015/04/22/protractor-socket-mocks.html

I found organizing my code a certain way helped when mocking the socket modules.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top