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 (12 loc) • 774 B
text/typescript
import {ConfigHelper} from "../../common-helpers/config-helper";
import {PageConfigTypes} from "../../../custom-types/pageConfig-types";
import {CustomExpect} from "../../common-helpers/custom-expect";
import {browser, $, $$, expect} from '@wdio/globals'
export default async function (pageConfig: PageConfigTypes, falseCase: boolean, exactly: number) {
const nrOfElements = $$(pageConfig.selector);
if (falseCase) {
CustomExpect.expectNotToBe(nrOfElements.length, exactly, `Element "${pageConfig.pageId}.${pageConfig.elementKey}" exists for "${exactly}" many times`)
} else {
CustomExpect.expectToBe(nrOfElements.length, exactly, `Element "${pageConfig.pageId}.${pageConfig.elementKey}" does not exist for "${exactly}" many times`)
}
};