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
17 lines (14 loc) • 600 B
text/typescript
import logger from "../../reporting-helpers/logger";
import {browser, $, $$, expect} from '@wdio/globals'
export default async function () {
const currentWindowHandle = await browser.getWindowHandle();
const lastWindowHandle = (await browser.getWindowHandles()).slice(-1)[0];
if (currentWindowHandle === lastWindowHandle) {
await browser.closeWindow();
} else {
await browser.switchToWindow(lastWindowHandle);
await browser.closeWindow();
await browser.switchToWindow(currentWindowHandle);
}
logger.info(`Closing the last opened window`);
};