Closed nielssj closed 9 years ago
Hi @nielssj ! Thanks for the PR. Could you please attach an example of a spec were you are using this functionality?
Here is an example spec. However, I would suggest to expand the example application slightly, adding a few input fields and handler to make a POST request. This will showcase the value of the feature much better, as the request will contain actual POST data collected by the application from the input fields.
I'd be happy to add this, if you agree.
Hi @nielssj . I completely agree. I just pushed an example with POST to the repository. Thank you so much for adding the example. I will go ahead and merge your PR. Thanks!
The way I see it a frontend has two input/output interfaces. First one being user triggered events and form-input on the DOM and the application's response in the form of modifications to the DOM. The second being HTTP requests/responses between the frontend and backend. Due to this I keep coming up with test cases that cannot be fully asserted without inspecting requests made to the backend.
I sketched out a working example of how this can be accomplished. I'm a newbie to the guts of Angular, so it's quite possible that there are better ways to publish and retrieve the list of requests from httpMock module.
I didn't include an example spec but since WebDriver.executeAsyncScript returns a promise your tests can basically do expectations like this:
This is tested and works like a charm in my specs.