Now, let's move on to our next step definition, which is an assertion step. In there, we should assert that the response from our server should have a 400 HTTP status code:
Then('our API should respond with a 400 HTTP status code', function () { if (error.statusCode !== 400) { throw new Error(); }});
Now, with our API server running in the background, run our E2E tests again. You should see the result of the second step changing from pending to failed:
$ yarn run test:e2e...F--Failures:1) Scenario: Empty Payload When the client creates a POST request to /users And attaches a generic empty payload And sends the request ...