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

25 lines (22 loc) 1.13 kB
import {PageConfigTypes} from "../../../custom-types/pageConfig-types"; import {CustomExpect} from "../../common-helpers/custom-expect"; import {browser, $, $$, expect} from '@wdio/globals' /** * Check if the given element is visible inside the current viewport * @param {String} selector Element selector * @param {String} falseCase Whether to check if the element is visible * within the current viewport or not */ export default async function (pageConfig: PageConfigTypes, falseCase: boolean) { /** * The state of visibility of the given element inside the viewport * @type {Boolean} */ // const isDisplayed = await $(pageConfig.selector).isDisplayedInViewport(); const isDisplayed = await $(pageConfig.selector).isDisplayed(); if (falseCase) { CustomExpect.expectNotToEqual(isDisplayed, true, `Element "${pageConfig.pageId}.${pageConfig.elementKey}" is Displayed in viewport`) } else { CustomExpect.expectToEqual(isDisplayed, true, `Element "${pageConfig.pageId}.${pageConfig.elementKey}" is not Displayed in viewport`) } };