UNPKG

@nice-digital/wdio-cucumber-steps

Version:

Shared step definitions for Cucumber JS BDD tests in WebdriverIO

20 lines 724 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.closeAllButFirstTab = void 0; /** * Close all but the first tab * @param {String} obsolete Type of object to close (window or tab) */ async function closeAllButFirstTab() { const windowHandles = await browser.getWindowHandles(); // Close all tabs but the first one windowHandles.reverse(); for (const [index, handle] of windowHandles.entries()) { await browser.switchToWindow(handle); if (index < windowHandles.length - 1) { await browser.closeWindow(); } } } exports.closeAllButFirstTab = closeAllButFirstTab; //# sourceMappingURL=closeAllButFirstTab.js.map