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
25 lines (20 loc) • 743 B
text/typescript
/**
* Check if a cookie with the given name exists
* @param {[type]} name The name of the cookie
* @param {[type]} falseCase Whether or not to check if the cookie exists or
* not
*/
import {CustomExpect} from "../../common-helpers/custom-expect";
import {browser, $, $$, expect} from '@wdio/globals'
export default async function (name: string, falseCase: boolean) {
/**
* The cookie as retrieved from the browser
* @type {Object}
*/
const cookie = await browser.getCookies(name);
if (falseCase) {
CustomExpect.expectToHaveLength(cookie, 0, `Cookie exists`)
} else {
CustomExpect.expectNotToHaveLength(cookie, 0, `Cookie does not exist`)
}
};