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
16 lines (13 loc) • 505 B
text/typescript
import {browser, $, $$, expect} from '@wdio/globals'
/**
* @param action - only accepts 'accept' or 'dismiss'
* @param accept -> to accept the alert
* @param dismiss -> to dismiss the alert
*/
export default async function (action: string) {
if (action.toLowerCase().trim() !== 'accept')
throw new Error(`Invalid selection for "handleModal" function. Valid selection is "accept"`);
let command = `${action}Alert`;
// Alert can not be dismissed
await browser[command]();
}