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

32 lines (26 loc) 1.66 kB
import {Given, Then} from "@cucumber/cucumber"; import checkTitle from "../helpers/framework-helpers/check/checkTitle"; import checkTitleContains from "../helpers/framework-helpers/check/checkTitleContains"; import checkUrl from "../helpers/framework-helpers/check/checkURL"; import checkURLPath from "../helpers/framework-helpers/check/checkURLPath"; import checkInURLPath from "../helpers/framework-helpers/check/checkInURLPath"; Given(/^the page title is( not)? "([^"]*)?"$/, async (falseCase: boolean, expectedTitle: string) => { console.log(`The page title is ${falseCase ? 'not' : ''} ${expectedTitle}`); await checkTitle(falseCase, expectedTitle); }); Given(/^the page title( not)? contains "([^"]*)?"$/, async (falseCase: boolean, expectedTitle: string) => { console.log(`The page title ${falseCase ? 'not' : ''} contains ${expectedTitle}`); await checkTitleContains(falseCase, expectedTitle); }); Given(/^the page url is( not)? "([^"]*)?"$/, async (falseCase: boolean, expectedUrl: string) => { console.log(`the page url is ${falseCase ? 'not' : ''} ${expectedUrl}`); await checkUrl(falseCase, expectedUrl); }); Then(/^I expect that the path is( not)? "([^"]*)?"$/, async (falseCase: boolean, expectedUrl: string) => { console.log(`I expect that the path is ${falseCase ? 'not' : ''} ${expectedUrl}`); await checkURLPath(falseCase, expectedUrl); }); Then(/^I expect that the path( not)? contains "([^"]*)?"$/, async (falseCase: boolean, expectedUrl: string) => { console.log(`I expect that the path ${falseCase ? 'not' : ''} contains ${expectedUrl}`); await checkInURLPath(falseCase, expectedUrl); });