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

20 lines (16 loc) 854 B
import waitForElementState from "./waitForElementState"; import {PageConfigTypes} from "../../../custom-types/pageConfig-types"; import logger from "../../reporting-helpers/logger"; import {browser, $, $$, expect} from '@wdio/globals' /** * @param action - only accepts 'click' or 'doubleClick' * @param click -> to click on the element * @param doubleClick -> to double-click on the element */ export default async function (action: string, pageConfig: PageConfigTypes) { if (action.trim() !== 'click' && action.trim() !== 'doubleClick') throw new Error(`Invalid selection for "clickElement" function. Valid selection is "click" OR "doubleClick"`); await waitForElementState(pageConfig, false, "Clickable", 5, 1000); await $(pageConfig.selector)[action](); logger.info(`Clicked on element ${pageConfig.elementKey}`) };