UNPKG

tlc-core-automation-framework-v3-wdio-v9

Version:

Background: - We are following multi-layer automation framework architecture using webdriver.io + cucumber + typescript This core framework has been implemented with generic utility functions and cucumber steps, which can be easily consumed by another fra

19 lines (14 loc) 568 B
import logger from "../../reporting-helpers/logger"; import {browser, $, $$, expect} from '@wdio/globals' export default async function () { const windowHandles = await browser.getWindowHandles(); // Close all tabs but the first one windowHandles.reverse(); for (const [index, handle] of Object.entries(windowHandles)) { await browser.switchToWindow(handle); if (parseInt(index, 10) < windowHandles.length - 1) { await browser.closeWindow(); } } logger.info(`All windows closed except First Window`); };