playwright-cucumber-ts-steps
Version:
A collection of reusable Playwright step definitions for Cucumber in TypeScript, designed to streamline end-to-end testing across web, API, and mobile applications.
76 lines (75 loc) • 2.58 kB
TypeScript
import type { CustomWorld } from "../helpers/world";
/**
* Asserts that a cookie with the given name exists in the browser context.
*
* ```gherkin
* Then I see cookie {string}
* ```
*
* @param cookieName - The name of the cookie expected to exist.
*
* @example
* Then I see cookie "session_id"
*
* @remarks
* This step retrieves all cookies from the current Playwright browser context
* and checks if a cookie with `cookieName` is present.
* @category Cookie Assertion Steps
*/
export declare function Then_I_see_cookie(this: CustomWorld, cookieName: string): Promise<void>;
/**
* Asserts that a cookie with the given name does NOT exist in the browser context.
*
* ```gherkin
* Then I do not see cookie {string}
* ```
*
* @param cookieName - The name of the cookie expected NOT to exist.
*
* @example
* Then I do not see cookie "expired_token"
*
* @remarks
* This step retrieves all cookies from the current Playwright browser context
* and asserts that no cookie with `cookieName` is present.
* @category Cookie Assertion Steps
*/
export declare function Then_I_do_not_see_cookie(this: CustomWorld, cookieName: string): Promise<void>;
/**
* Asserts that a cookie with the given name exists and has an exact expected value.
*
* ```gherkin
* Then I see cookie {string} has value {string}
* ```
*
* @param cookieName - The name of the cookie to check.
* @param expectedValue - The exact value the cookie is expected to have.
*
* @example
* Then I see cookie "sessionId" has value "abc123"
*
* @remarks
* This step finds the cookie by name and then asserts that its `value` property
* strictly matches `expectedValue`.
* @category Cookie Assertion Steps
*/
export declare function Then_I_see_cookie_has_value(this: CustomWorld, cookieName: string, expectedValue: string): Promise<void>;
/**
* Asserts that a cookie with the given name exists and its value contains a specific substring.
*
* ```gherkin
* Then I see cookie {string} contains value {string}
* ```
*
* @param cookieName - The name of the cookie to check.
* @param valuePart - The substring expected to be present within the cookie's value.
*
* @example
* Then I see cookie "token" contains value "auth_type"
*
* @remarks
* This step finds the cookie by name and then asserts that its `value` property
* includes the `valuePart` string. Useful for tokens or complex cookie values.
* @category Cookie Assertion Steps
*/
export declare function Then_I_see_cookie_contains_value(this: CustomWorld, cookieName: string, valuePart: string): Promise<void>;