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
18 lines (14 loc) • 957 B
text/typescript
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, expectedClassName: string) {
const className = await $(pageConfig.selector).getProperty('className');
if (typeof className === 'undefined' || className === null) {
throw new Error(`Element with "${pageConfig.pageId}.${pageConfig.elementKey}" didn't have a class name`);
}
if (falseCase) {
CustomExpect.expectNotToContain(className, expectedClassName, `Element "${pageConfig.pageId}.${pageConfig.elementKey}" contains class name "${expectedClassName}"`)
} else {
CustomExpect.expectToContain(className, expectedClassName, `Element "${pageConfig.pageId}.${pageConfig.elementKey}" does not contain class name "${expectedClassName}"`)
}
};