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 (15 loc) • 1.09 kB
text/typescript
import getElementTextByIndex from "../action/getElementTextByIndex";
import {PageConfigTypes} from "../../../custom-types/pageConfig-types";
import {CustomExpect} from "../../common-helpers/custom-expect";
export default async function (elementPosition: number = 0, pageConfig: PageConfigTypes, falseCase: boolean, expectedText: string, ignoreCaseCheck = false) {
let elementTextByIndex = (await getElementTextByIndex(elementPosition, pageConfig));
if (ignoreCaseCheck) {
elementTextByIndex = expectedText.toLowerCase();
expectedText = expectedText.toLowerCase();
}
if (falseCase) {
CustomExpect.expectNotToContain(elementTextByIndex, expectedText, `Element "${pageConfig.pageId}.${pageConfig.elementKey}" at position "${elementPosition}" contains the text "${expectedText}"`);
} else {
CustomExpect.expectToContain(elementTextByIndex, expectedText, `Element "${pageConfig.pageId}.${pageConfig.elementKey}" at position "${elementPosition}" does not contain the text "${expectedText}", text found : "${elementTextByIndex}"`);
}
};