playwright-e2e-testing

Write and debug Playwright TypeScript tests for UI, API, and responsive web testing.

Updated Jul 4, 2026
One-click install
npx skills add https://github.com/100Thieves-team/plady-expert-skills --skill playwright-e2e-testing-100thieves-team
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-e2e-testing
Source: https://github.com/100Thieves-team/plady-expert-skills/tree/main/.claude/skills/playwright-e2e-testing
Command: npx skills add https://github.com/100Thieves-team/plady-expert-skills --skill playwright-e2e-testing-100thieves-team

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @playwright/test, and includes references (resource) components.

What problem does it solve? Writing reliable end-to-end tests is hard: flaky selectors, race conditions, and inconsistent environments cause tests to fail unpredictably. This Skill provides proven Playwright with TypeScript patterns for UI flows, API validation, and responsive testing so tests stay stable and maintainable. ## Core Features & Use Cases - E2E Test Authoring: Write tests for user flows, forms, and authentication using role-based locators, web-first assertions, and test.step() structure. - API Testing & Mocking: Validate backend responses via the request fixture and intercept network calls with page.route() for deterministic tests. - Page Object Model & Fixtures: Implement maintainable test architecture with BasePage classes, component objects, fluent interfaces, and custom fixtures. - Use Case: You need to verify a checkout flow works on mobile and desktop. Use this Skill to write viewport-parameterized tests with mocked payment APIs, then debug failures using traces and the Playwright Inspector. ## Quick Start Write a Playwright test that logs in a user, completes the checkout flow, and verifies the order confirmation page on both mobile and desktop viewports.

Frequently Asked Questions about playwright-e2e-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Playwright tests in TypeScript?

Install @playwright/test, create *.spec.ts files, and import test and expect from @playwright/test. Use role-based locators like getByRole and getByLabel, then assert with web-first assertions such as toBeVisible and toHaveURL that auto-retry.

How to mock API responses in Playwright tests?

Use page.route() with a glob pattern like '**/api/users' and call route.fulfill() with a custom status and JSON body. This intercepts network requests before they reach the server, enabling deterministic tests of error and loading states.

What is the best locator strategy in Playwright?

Prioritize getByRole with accessible names, then getByLabel, getByPlaceholder, getByText, and getByTestId. Avoid CSS selectors for interactive elements because they break when styles or markup are refactored.

Why are my Playwright tests flaky and how do I fix them?

Flakiness usually comes from race conditions, animations, or manual waits like page.waitForTimeout(). Replace fixed waits with web-first assertions and specific waitFor conditions, structure flows with test.step(), and disable animations in test environments.

Does Playwright support testing on mobile viewports?

Yes. Set viewport sizes with page.setViewportSize() or use device descriptors like devices['Pixel 5'] in playwright.config.ts projects. You can loop over mobile, tablet, and desktop dimensions to verify responsive behavior such as hamburger menus.

How do I debug a failing Playwright test?

Run with PWDEBUG=1 or npx playwright test --debug to open the Inspector and step through actions. Enable trace: 'on-first-retry' in the config, then inspect traces, screenshots, and videos captured on failure.