ApiDataFactory error handling #4201
Unanswered
jburke-idam
asked this question in
Q&A
Replies: 1 comment
-
looks like this doesn't handle the error here https://github.com/codeceptjs/CodeceptJS/blob/3.x/lib/helper/ApiDataFactory.js#L345 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've just switched our tests over to using ApiDataFactory to create test users. It seems like calls to
I.have
that result in error responses return a null value, but I would have expected them to fail the test at that point. What actually happens is that the test carries on and I get an unexpected failure later on so the error doesn't make any sense. Obviously I'm not normally expecting error responses while setting up the test data, but this has made tracking down problems while writing the tests a bit tricky (turned out it was password validation that was throwing the 400)My workaround has been to add a check that the response from
I.have
actually has a value, but is that the best solution? I tried usingI.seeResponseCodeIsSuccessful
but that didn't work either.Or is there a way to have
I.have
actually fail if it doesn't get a 2xx response?Thanks,
James
Beta Was this translation helpful? Give feedback.
All reactions