MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / waitForNumberOfTabs

Method waitForNumberOfTabs

lib/helper/Playwright.js:3396–3409  ·  view source on GitHub ↗

* {{> waitForNumberOfTabs }}

(expectedTabs, sec)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 2

grabNumberOfOpenTabsMethod · 0.95
waitMethod · 0.95

Tested by

no test coverage detected