angularjs - Asserting $http request payloads without mocking them -
i'm writing protractor tests verify successful creation of reports in our application. report created via series of complex ui interactions within dialog , saved via ajax post request rest api.
i've written tests complex ui interactions within modal, i'm @ loss how test post request within same protractor tests. ideally, i'd able make assertions against payload of post request verify ui sending correct data api.
it's important note not want mock http call--i need go through, since subsequent protractor tests navigate report , perform additional checks. first thought somehow hook $httpbackend.passthrough() method, haven't had success that.
any ideas how accomplish this?
since subsequent protractor tests navigate report , perform additional checks
if check report contains data matches submitted, are, albeit indirectly, testing post went through successfully. there reasonable argument enough e2e test: tests application behaves user want. user doesn't care how it's achieved: post, websockets, carrier pigeon ;-)
keep in mind usual aim of such tests them fail if broken. if post isn't done correctly, subsequent tests verify displayed report fail.
the downside have bit less information has gone wrong if managed test post well. however, unit tests can help. if have failing unit test localises issue, write fix makes pass. if don't have failing unit test, can investigate issue debugging, add failing test highlights issue, , fix code passes.
Comments
Post a Comment