* {{> waitForNumberOfTabs }}
(expectedTabs, sec)
| 2761 | * {{> waitForNumberOfTabs }} |
| 2762 | */ |
| 2763 | async waitForNumberOfTabs(expectedTabs, sec) { |
| 2764 | const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeoutInSeconds |
| 2765 | let currentTabs |
| 2766 | let count = 0 |
| 2767 | |
| 2768 | do { |
| 2769 | currentTabs = await this.grabNumberOfOpenTabs() |
| 2770 | await this.wait(1) |
| 2771 | count += 1000 |
| 2772 | if (currentTabs >= expectedTabs) return |
| 2773 | } while (count <= waitTimeout) |
| 2774 | |
| 2775 | throw new Error(`Expected ${expectedTabs} tabs are not met after ${waitTimeout / 1000} sec.`) |
| 2776 | } |
| 2777 | |
| 2778 | /** |
| 2779 | * {{> switchTo }} |
nothing calls this directly
no test coverage detected