I can't seem to understand why a POSTMAN Monitor is unable to obey by the setTimeout() rule I have inputted in one of the Requests in the Collection.
I have 3 Requests in a Collection (below). Once the first Request is made, the Second one, Retrieve Request is delayed 25000 ms.
Create Request
Retrieve Request <- setTimeout() Pre-Request Script
Delete Request
The setTimeout() is located in the Pre-Request Script like so:
setTimeout(() => {}, 25000)
The Collections works fine as expected (& passes) if I manually run it. However, if the collection runs in the Monitor, it does not compute it and it all fails.
You can easily see this in the Monitored Console log which shows the Collection run times through in milliseconds and without adhering to the setTimeout():
Also, on Postman's Learning Center it reads that adding delays should definitely work in the Monitor if placed in the Pre-Request or Test Script sections:
Not sure what I'm missing here - help is appreciated.
Update:
Adjusted some settings in the Monitor itself. However, after setting both 'Set Request Timeout' & 'Set delay between Requests' at 25000 ms a piece, running the Collection again in the Monitor, the Console Log still shows that the collection is running Straight through in about a second....
It works as expected just try printing console.log(Date()) in test script of all requests. You can see the time difference is 25 second
Note that settimeout is asynchronous. It doesnt stop the code flow within the test script it resolves after 25 second and within that time all other code wil get executed and waits for settimeout function call tobe completed before exiting the test script