MCPcopy Create free account
hub / github.com/codeceptjs/CodeceptJS / waitForNumberOfTabs

Method waitForNumberOfTabs

lib/helper/Puppeteer.js:2477–2490  ·  view source on GitHub ↗

* {{> waitForNumberOfTabs }}

(expectedTabs, sec)

Source from the content-addressed store, hash-verified

2475 * {{> waitForNumberOfTabs }}
2476 */
2477 async waitForNumberOfTabs(expectedTabs, sec) {
2478 const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout
2479 let currentTabs
2480 let count = 0
2481
2482 do {
2483 currentTabs = await this.grabNumberOfOpenTabs()
2484 await this.wait(1)
2485 count += 1000
2486 if (currentTabs >= expectedTabs) return
2487 } while (count <= waitTimeout)
2488
2489 throw new Error(`Expected ${expectedTabs} tabs are not met after ${waitTimeout / 1000} sec.`)
2490 }
2491
2492 async _getContext() {
2493 if (this.context && this.context.constructor.name === 'CdpFrame') {

Callers 3

Playwright_test.jsFile · 0.45
WebDriver_test.jsFile · 0.45
Puppeteer_test.jsFile · 0.45

Calls 2

grabNumberOfOpenTabsMethod · 0.95
waitMethod · 0.95

Tested by

no test coverage detected