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

23 lines (20 loc) 929 B
/** * Check if the given string is in the URL path * @param {String} falseCase Whether to check if the given string is in * the URL path or not * @param {String} expectedUrlPart The string to check for */ import {CustomExpect} from "../../common-helpers/custom-expect"; import {browser, $, $$, expect} from '@wdio/globals' export default async function (falseCase: boolean, expectedUrlPart: string) { /** * The URL of the current browser window * @type {String} */ const currentUrl = await browser.getUrl(); if (falseCase) { CustomExpect.expectNotToContain(currentUrl, expectedUrlPart, `Current URL "${currentUrl}" contains expected url path "${expectedUrlPart}"`) } else { CustomExpect.expectToContain(currentUrl, expectedUrlPart, `Current URL "${currentUrl}" does not contain expected url path "${expectedUrlPart}"`) } };