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.
150 lines (149 loc) • 5.55 kB
TypeScript
import type { CustomWorld } from "../helpers/world";
/**
* Asserts that a Local Storage item with the given key exists for the current page's origin.
*
* ```gherkin
* Then I see local storage item {string}
* ```
*
* @param key - The key of the Local Storage item expected to exist.
*
* @example
* Then I see local storage item "token"
*
* @remarks
* This step executes `localStorage.getItem(key)` in the browser's context.
* It asserts that the returned value is not `null`, indicating the item exists.
* @category Storage Assertion Steps
*/
export declare function Then_I_see_local_storage_item(this: CustomWorld, key: string): Promise<void>;
/**
* Asserts that a Local Storage item with the given key does NOT exist for the current page's origin.
*
* ```gherkin
* Then I do not see local storage item {string}
* ```
*
* @param key - The key of the Local Storage item expected NOT to exist.
*
* @example
* Then I do not see local storage item "oldFeatureFlag"
*
* @remarks
* This step executes `localStorage.getItem(key)` in the browser's context.
* It asserts that the returned value is strictly `null`, indicating the item does not exist.
* @category Storage Assertion Steps
*/
export declare function Then_I_do_not_see_local_storage_item(this: CustomWorld, key: string): Promise<void>;
/**
* Asserts that a Local Storage item with the given key exactly equals the expected value.
*
* ```gherkin
* Then I see local storage item {string} equals {string}
* ```
*
* @param key - The key of the Local Storage item.
* @param expectedValue - The exact value the item is expected to have.
*
* @example
* Then I see local storage item "token" equals "abc123"
*
* @remarks
* This step executes `localStorage.getItem(key)` in the browser's context.
* It asserts strict equality between the retrieved value and `expectedValue`.
* @category Storage Assertion Steps
*/
export declare function Then_I_see_local_storage_item_equals(this: CustomWorld, key: string, expectedValue: string): Promise<void>;
/**
* Asserts that a Local Storage item with the given key contains the expected substring.
*
* ```gherkin
* Then I see local storage item {string} contains {string}
* ```
*
* @param key - The key of the Local Storage item.
* @param part - The substring expected to be contained within the item's value.
*
* @example
* Then I see local storage item "userSession" contains "loggedIn"
*
* @remarks
* This step executes `localStorage.getItem(key)` in the browser's context.
* It asserts that the retrieved value (if not null) includes the `part` substring.
* @category Storage Assertion Steps
*/
export declare function Then_I_see_local_storage_item_contains(this: CustomWorld, key: string, part: string): Promise<void>;
/**
* Asserts that a Session Storage item with the given key exists for the current page's origin.
*
* ```gherkin
* Then I see session storage item {string}
* ```
*
* @param key - The key of the Session Storage item expected to exist.
*
* @example
* Then I see session storage item "sessionId"
*
* @remarks
* This step executes `sessionStorage.getItem(key)` in the browser's context.
* It asserts that the returned value is not `null`, indicating the item exists.
* @category Storage Assertion Steps
*/
export declare function Then_I_see_session_storage_item(this: CustomWorld, key: string): Promise<void>;
/**
* Asserts that a Session Storage item with the given key does NOT exist for the current page's origin.
*
* ```gherkin
* Then I do not see session storage item {string}
* ```
*
* @param key - The key of the Session Storage item expected NOT to exist.
*
* @example
* Then I do not see session storage item "tempData"
*
* @remarks
* This step executes `sessionStorage.getItem(key)` in the browser's context.
* It asserts that the returned value is strictly `null`, indicating the item does not exist.
* @category Storage Assertion Steps
*/
export declare function Then_I_do_not_see_session_storage_item(this: CustomWorld, key: string): Promise<void>;
/**
* Asserts that a Session Storage item with the given key exactly equals the expected value.
*
* ```gherkin
* Then I see session storage item {string} equals {string}
* ```
*
* @param key - The key of the Session Storage item.
* @param expectedValue - The exact value the item is expected to have.
*
* @example
* Then I see session storage item "sessionId" equals "xyz789"
*
* @remarks
* This step executes `sessionStorage.getItem(key)` in the browser's context.
* It asserts strict equality between the retrieved value and `expectedValue`.
* @category Storage Assertion Steps
*/
export declare function Then_I_see_session_storage_item_equals(this: CustomWorld, key: string, expectedValue: string): Promise<void>;
/**
* Asserts that a Session Storage item with the given key contains the expected substring.
*
* ```gherkin
* Then I see session storage item {string} contains {string}
* ```
*
* @param key - The key of the Session Storage item.
* @param part - The substring expected to be contained within the item's value.
*
* @example
* Then I see session storage item "userState" contains "authenticated"
*
* @remarks
* This step executes `sessionStorage.getItem(key)` in the browser's context.
* It asserts that the retrieved value (if not null) includes the `part` substring.
* @category Storage Assertion Steps
*/
export declare function Then_I_see_session_storage_item_contains(this: CustomWorld, key: string, part: string): Promise<void>;