Testcafe Requestlogger Not Intercepting Api Calls
For some reason, I cannot get testcafe's RequestLogger to log any of the API calls that I am making. I've read nearly all of the articles and questions on the RequestLogger and eve
Solution 1:
I suspect that TestCafe runs faster than the code that calls the api.
Before using the logger object you should wait that it has received at least one call.
To check if the logger has received a call, I suggest to do it this way:
awaitwait_for_first_request();
const receivedCalls = logger.requests.length;
if (receivedCalls === 0) {
thrownewError('api has not been called')
}
asyncfunctionwait_for_first_request() {
for (let i = 0; i < 50; i++) {
await t.wait(100);
if (logger.requests.length > 0 ) {
return;
}
}
}
Post a Comment for "Testcafe Requestlogger Not Intercepting Api Calls"