1

When logging requests using the RequestLogger, the requests array records the immediate response which isn't always present if the response takes more than a few seconds to return.

Is there a way to wait for the statusCode to return before the request gets logged, or a way to get the statusCode for the specified request when it has been returned?

Using await t.expect(logger.contains(r => r.response.statusCode === 200)).ok(); didn't work for me.

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
  • 1
    The code `await t.expect(logger.contains(r => r.response.statusCode === 200)).ok();` looks correct. Could you please provide a simple example which I can run locally? – mlosev Nov 19 '19 at 13:04
  • You won't be able to access the url outside my work network. However good to know that the await statement should work. Thanks. – Critical Thinker Nov 19 '19 at 15:36
  • Does this question help you? https://stackoverflow.com/questions/62798820/testcafe-requestlogger-how-to-wait-for-all-responses-to-return-before-doing-an – Rob C Feb 22 '21 at 18:50

0 Answers0