Sleep - operation

  • on all platforms

This operations idly waits for a specified amount of time.


To perform this operation in the Suitest Test editor use the Sleep line:

Sleep for 30 seconds

To perform this operation in the Suitest JavaScript API use the sleep command.

await suitest.sleep(300);

Because Sleep specifies a static amount of time to wait, it is generally recommended to favor Assert with timeout over Sleep. Using Sleep extensively may indicate a problem with your test base.

The problem with using a static amount of time is that devices vary in speed and power, so whichever timing you select it may happen too late on some devices and maybe to soon on the others.

However in certain situation using sleep is perfectly fine. Main examples of such situation are:

  • Instrumentation library is not (yet) active on the device.
    Suitest cannot evaluate Assert lines without connection from the instrumentation library so you will have to use Sleep.

  • The device lags after user input for no obvious reason.
    Basically there is nothing you can do but to give the device some time to recover from processing.