UNPKG

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.

16 lines (13 loc) 545 B
import { When } from "@cucumber/cucumber"; // import { expect } from "@playwright/test"; import type { CustomWorld } from "../helpers/world"; When( "I find href in iframe {string} and store as {string}", async function (this: CustomWorld, iframeSelector: string, key: string) { const iframe = this.page.frameLocator(iframeSelector); const link = await iframe.locator("a[href]").first(); const href = await link.getAttribute("href"); if (!href) throw new Error("No link found in iframe."); this.data[key] = href; } );