with one click
playwright
// Patterns for Playwright E2E testing with custom fixtures, role-based selectors, and assertion patterns.
// Patterns for Playwright E2E testing with custom fixtures, role-based selectors, and assertion patterns.
Build, archive, export, and upload the try! Swift Tokyo app to App Store Connect for iOS, macOS, and visionOS using ASC CLI.
Guidelines for building static sites using the Ignite Swift framework.
Guidelines for Android development using the Skip framework (Swift to Kotlin transpilation).
Expert guidance on The Composable Architecture (TCA) for Swift, focusing on ReducerProtocol, macros, and testability.
Definitive guide for Swift 6+ Concurrency, strictly enforcing Sendable, Actors, and Structured Concurrency.
Expert guidance for Vapor 4+ development, focusing on async/await, Fluent, and content negotiation.
| name | playwright |
| description | Patterns for Playwright E2E testing with custom fixtures, role-based selectors, and assertion patterns. |
e2e/playwright.config.tse2e/tests/cd e2e && npx playwright testExtend base test with typed fixtures for multi-browser scenarios:
import { test as base, expect, type Page } from "@playwright/test";
export const test = base.extend<{ roomPage: Page; hostPage: Page }>({
roomPage: async ({ page }, use) => {
await page.goto("/");
await use(page);
},
hostPage: async ({ browser }, use) => {
const context = await browser.newContext();
const page = await context.newPage();
await page.goto("/host");
await use(page);
await page.context().close();
},
});
export { expect };
Save this snippet as a shared fixture module (for example e2e/fixtures.ts or e2e/fixtures.js) and then import from it in your tests, e.g.:
import { test, expect } from "./fixtures.js";
page.getByRole("button", { name: /english/i })page.getByText("Enter chat room code")page.getByText("Label").locator("..").getByRole("button")page.getByRole("listitem").filter({ hasText: "Japanese" })page.locator("input").nth(i).first() to disambiguate multiple matchesawait expect(element).toBeVisible({ timeout: 10_000 })await expect(element).not.toBeVisible({ timeout: 10_000 })await expect(page).not.toHaveURL(/\/login/)expect(count).toBeGreaterThan(0)expect(text?.trim()).toBeTruthy()await expect(element).toBeVisible() auto-retries.await page.waitForLoadState("networkidle") (DISCOURAGED by Playwright docs; used in this project for legacy reasons).await page.waitForTimeout(3_000) (WebSocket propagation, animations).await element.waitFor({ state: "visible", timeout: 15_000 })..isVisible().catch(() => false) for optional elements.await page.screenshot({ path: "test-results/state.png" });
await page.screenshot({ path: "test-results/full.png", fullPage: true });
test.describe("Feature - Aspect", () => { ... })async ({ roomPage: page }) => { ... }import { test, expect } from "./fixtures.js" (note .js extension)