-
-
Couldn't load subscription status.
- Fork 751
ApiDataFactory error handling #4201
-
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 using I.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
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.