* {{> waitForNumberOfTabs }}
(expectedTabs, sec)
| 3394 | * {{> waitForNumberOfTabs }} |
| 3395 | */ |
| 3396 | async waitForNumberOfTabs(expectedTabs, sec) { |
| 3397 | const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout |
| 3398 | let currentTabs |
| 3399 | let count = 0 |
| 3400 | |
| 3401 | do { |
| 3402 | currentTabs = await this.grabNumberOfOpenTabs() |
| 3403 | await this.wait(1) |
| 3404 | count += 1000 |
| 3405 | if (currentTabs >= expectedTabs) return |
| 3406 | } while (count <= waitTimeout) |
| 3407 | |
| 3408 | throw new Error(`Expected ${expectedTabs} tabs are not met after ${waitTimeout / 1000} sec.`) |
| 3409 | } |
| 3410 | |
| 3411 | async _getContext() { |
| 3412 | if (this.context) { |
nothing calls this directly
no test coverage detected