MCPcopy
hub / github.com/codeceptjs/CodeceptJS / closeOtherTabs

Method closeOtherTabs

lib/helper/Puppeteer.js:1157–1167  ·  view source on GitHub ↗

* Close all tabs except for the current one. * * ```js * I.closeOtherTabs(); * ```

()

Source from the content-addressed store, hash-verified

1155 * ```
1156 */
1157 async closeOtherTabs() {
1158 const pages = await this.browser.pages()
1159 const otherPages = pages.filter(page => page !== this.page)
1160
1161 let p = Promise.resolve()
1162 otherPages.forEach(page => {
1163 p = p.then(() => page.close())
1164 })
1165 await p
1166 return this._waitForAction()
1167 }
1168
1169 /**
1170 * Open new tab and switch to it

Callers 9

_afterMethod · 0.95
_startBrowserMethod · 0.95
Playwright_test.jsFile · 0.45
WebDriver_test.jsFile · 0.45
Puppeteer_test.jsFile · 0.45

Calls 2

_waitForActionMethod · 0.95
filterMethod · 0.80

Tested by

no test coverage detected