mercredi 8 juillet 2020

TestCafe RequestLogger - How to wait for all responses to return before doing an assertion on each request object

See the attached screenshot. I have a RequestLogger that captures all the requests to /api/dynamic_reporting/filters/*/find endpoint.

The issue is that when I do an assertion await t.expect(dynamicReportingFindRequest.requests[1].response.statusCode).eql(200,'Did not get 200 OK response'), I get an error Cannot read property 'statusCode' of undefined because the xhr is still pending for requests[1], requests[2]... and hasn't completed yet.

How do I wait for all responses to return before doing an assertion on the requests?

enter image description here

Aucun commentaire:

Enregistrer un commentaire