(x: number, y?: number)
| 9 | * @param y Maximum number of seconds (optional). |
| 10 | */ |
| 11 | export const sleep = (x: number, y?: number): Promise<void> => { |
| 12 | let timeout = x * 1000; |
| 13 | if (y !== undefined && y !== x) { |
| 14 | const min = Math.min(x, y); |
| 15 | const max = Math.max(x, y); |
| 16 | timeout = Math.floor(Math.random() * (max - min + 1) + min) * 1000; |
| 17 | } |
| 18 | // console.log(`Sleeping for ${timeout / 1000} seconds`); |
| 19 | logger.info(`Sleeping for ${timeout / 1000} seconds`); |
| 20 | |
| 21 | return new Promise(resolve => setTimeout(resolve, timeout)); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * @param target A Locator or a page |
no outgoing calls
no test coverage detected