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

23 lines (20 loc) 815 B
/** * Check if a new window or tab is opened * @param {String} obsolete The type of opened object (window or tab) * @param {String} falseCase Whether to check if a new window/tab was opened * or not */ import {CustomExpect} from "../../common-helpers/custom-expect"; import {browser, $, $$, expect} from '@wdio/globals' export default async function (obsolete: never, falseCase: boolean) { /** * The handles of all open windows/tabs * @type {Object} */ const windowHandles = await browser.getWindowHandles(); if (falseCase) { CustomExpect.expectToHaveLength(windowHandles, 1, 'A new window should not have been opened'); } else { CustomExpect.expectNotToHaveLength(windowHandles, 1, 'A new window has been opened'); } };