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) • 848 B
text/typescript
import {CustomExpect} from "../../common-helpers/custom-expect";
import {browser, $, $$, expect} from '@wdio/globals'
/**
* The expected path has to be full string after the domain.
* Example : http://localhost:3000/venues/ ---->expected path is "/venues/"
*/
export default async function (falseCase: boolean, expectedPath: string) {
let currentUrl = (await browser.getUrl()).replace(/http(s?):\/\//, '');
const domain = `${currentUrl.split('/')[0]}`;
currentUrl = currentUrl.replace(domain, '');
if (falseCase) {
CustomExpect.expectNotToEqual(currentUrl, expectedPath, `Current URL "${currentUrl}" and expected path "${expectedPath}" are matching`)
} else {
CustomExpect.expectToEqual(currentUrl, expectedPath, `Current URL "${currentUrl}" and expected path "${expectedPath}" are not matching`)
}
};