Search code examples
postmansettimeoutsleeppause

Postman Collection Run does not pause for setTimeout calls


I put a simple setTimeout(function(), 10000) call in the Tests section of a request.

Works fine when I run the step by itself.

When I do a Collection Run, the step just gets executed and Postman moves on without pausing.

Is this by design?

I'd rather not have to put a delay of X seconds for every step.


Solution

  • it works as expected , check the console to see when was the request send

    make sure request is saved:

    enter image description here

    THe orange indication shows that it is unsaved , you have to save it

    use the below command in pre-request script.

      let moment = require("moment")
      console.log("before:", moment())
    
      setTimeout(function () { console.log("after:", moment()) }, 10000)
    

    and check in console:

    enter image description here