playwright
/playwright
Wspiera testy w Playwright: E2E w wielu przeglądarkach, auto-waiting, porównania wizualne i tracing, przy automatyzacji nowoczesnych aplikacji i debugowaniu niestabilności.
- Autor
- G1Joshi ↗
- Repozytorium
- Agent-Skills ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 01.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 2
Brak sygnałów. Repozytorium zmienione 01.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Wspiera testy w Playwright: E2E w wielu przeglądarkach, auto-waiting, porównania wizualne i tracing, przy automatyzacji nowoczesnych aplikacji i debugowaniu niestabilności.
Oryginalny opis (EN)
Expert Playwright testing assistance covering cross-browser E2E, auto-waiting, visual comparisons, and tracing. Use when automating modern web applications, testing Chromium/Firefox/WebKit, or debugging flakiness.
Jak działa
- When to Use
- Quick Start
- Core Concepts
- Common Patterns
- Best Practices
- Troubleshooting
- References
Podgląd SKILL.md
---
name: playwright
description: Expert Playwright testing assistance covering cross-browser E2E, auto-waiting, visual comparisons, and tracing. Use when automating modern web applications, testing Chromium/Firefox/WebKit, or debugging flakiness.
---
# Playwright
Playwright is Microsoft's modern automation library. It enables reliable end-to-end testing for modern web apps across Chromium, WebKit, and Firefox.
## When to Use
- **Modern Web End-to-End Automation**: The industry standard for cross-browser testing across Chromium, WebKit (Safari), and Firefox.
- **Multi-Tab & Multi-Origin Testing**: Testing complex workflows spanning popups, payment gateways, and multiple browser tabs seamlessly.
- **Mobile Emulation & Geolocation**: Simulating iPhone, Pixel, network throttling, and geographic permissions reliably.
- **API Testing Alongside UI**: Sending REST and GraphQL requests directly within tests via `request` context.
## Quick Start
```typescript
import { test, expect } from "@playwright/test";
test.describe("Navigation", () => {
test("should navigate to login", async ({ page }) => {
await page.goto("https://example.com");
await page.getByRole("button", { name: "Log in" }).click();
await expect(page).toHaveURL(/.*login/);
});
});
```
## Core Concepts
### Auto-Waiting & Resilient Locators
Playwright automatically waits for elements to be attached, visible, stable, and receive events before clicking:
```typescript
// tests/checkout.spec.ts
import { test, expect } from "@playwright/test";
test("customer can complete checkout", async ({ page }) => {
await page.goto("/catalog");
// Locates using accessible role and auto-waits
await page.getByRole("button", { name: "Add to Cart" }).first().click();
await page.getByRole("link", { name: "View Cart" }).click();
await expect(page.getByTestId("cart-total")).toHaveText("$49.99");
await page.getByRole("button", { name: "Checkout" }).click();
await expect(page).toHaveURL(/.*checkout\/success/);
});
```
### Trace Viewer for Post-Mortem Debugging
Records DOM snapshots, console logs, network waterfalls, and action videos during test runs:
```bash
# Run tests and record trace on failure
npx playwright test --trace on-first-retry
# View interactive trace viewer
npx playwright show-trace trace.zip
```
### Network Mocking & HAR Replay
Intercepts requests and fulfills them with mock responses:
```typescript
test("displays error banner on API failure", async ({ page }) => {
await page.route("**/api/v1/inventory", (route) => {
route.fulfill({
status: 503,
body: JSON.stringify({ error: "Service Unavailable" }),
});
});
await page.goto("/inventory");
await expect(
page.getByText("Inventory service is currently offline"),
).toBeVisible();
});
```
## Common Patterns
### Page Object Model with Locator Auto-Waiting
**Problem**: Raw selector strings scattered across test files cause maintenance headaches when UI layouts change.
**Solution**:
Encapsulate selectors and actions in Page Objects:
```typescript
import { Page, Locator } from "@playwright/test";
export class LoginPage {
readonly page: Page;
readonly usernameInput: Locator;
readonly passwordInput: Locator;
readonly loginButton: Locator;
constructor(page: Page) {
this.page = page;
this.usernameInput = page.getByLabel("Username");
this.passwordInput = page.getByLabel("Password");
this.loginButton = page.getByRole("button", { name: "Log in" });
}
async login(user: string, pass: string) {
await this.usernameInput.fill(user);
await this.passwordInput.fill(pass);
await this.loginButton.click();
}
}
```
## Best Practices
**Do**:
- Prefer User-Facing Locators: Use `page.getByRole()`, `page.getByText()`, and `page.getByLabel()` over fragile CSS selectors.
- Use Web-First Assertions: Always use `await expect(locator).toBeVisible()` which automatically retries until passing.
- Reuse Storage State for Fast Authentication: Save auth cookies with `storageState` to log in once rather than in every test.
- Run in Parallel Across Browsers: Leverage Playwright's native worker parallelization across Chromium, WebKit, and Firefox.
**Don't**:
- Use `page.waitForTimeout(5000)`: Static delays cause flakiness; wait for locators or network states instead.
- Rely on XPath selectors: XPath selectors break easily when DOM hierarchies shift.
- Share state between tests: Use independent `BrowserContext` instances to ensure zero test cross-contamination.
## Troubleshooting
| Error | Cause | Solution |
| :------------------------------------------------------------- | :--------------------------------------------------------- | :-------------------------------------------------------------------------- |
| `TimeoutError: page.waitForSelector: Timeout 30000ms exceeded` | Target element never entered visible DOM state. | Check selector in Playwright Inspector using `npx playwright test --debug`. |
| `Target closed / browser disconnected` | Container or system ran out of shared memory (`/dev/shm`). | Run container with `--shm-size=2gb` or set `chromiumSandbox: false`. |
| `Strict mode violation: getByRole(...) resolved to 2 elements` | Selector matches more than one visible element. | Disambiguate using `.first()`, index, or more specific locator text. |
## References
- [Playwright Documentation](https://playwright.dev/)
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · G1Joshi/Agent-Skills | 100 | MIT |
| magnus919/agent-skills | 100 | MIT |
| kriscard/kriscard-claude-plugins | 100 | MIT |
| zenobi-us/dotfiles | 100 | MIT |
| dreamlab-ai/agentbox | 100 | AGPL-3.0 |
| DroBov1Tya/dusk_code | 100 | MIT |
| ivy00johns/skill-madness | 100 | MIT |
| musingfox/cc-plugins | 100 | MIT |
| netease-youdao/LobsterAI | 100 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki 240acd1fa760 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100playwright-testing
Pisze i utrzymuje testy end-to-end w Playwright: konfiguracja, page objects, uwierzytelnianie, mockowanie API, porównania wizualne, testy w wielu przeglądarkach i integracja z CI. - 100playwright-end-to-end-browser-automation
Automatyzuje testy end-to-end w wielu przeglądarkach, z lokatorami z auto-oczekiwaniem, nagraniami wideo i analizą trace. - 98playwright-use-chrome
Konfiguruje Playwright tak, by używał zainstalowanej w systemie przeglądarki Google Chrome zamiast pobierać duże pakiety Chromium, WebKit i Firefox zajmujące 1,5 do 2 GB. - 100e2e-playwright
Pomaga pisać testy end-to-end w Playwright: odporne lokatory, auto-waiting, przechwytywanie sieci, ponowne użycie logowania, równoległość i eliminowanie niestabilności. - 100playwright-testing
Tworzy i naprawia testy Playwright dla Chromium, Firefox i WebKit: scaffolding, projekty przeglądarek, locatory dostępnościowe zamiast kruchych selektorów CSS, asercje web-first, Page Object, trace viewer, sharding i emulacja mobilna. - 95playwright-e2e-automation
Prowadzi przez automatyzację testów E2E w Playwright: architektura Page Object Model, testy w wielu przeglądarkach, mockowanie sieci, testy wizualnej regresji i integracja z CI.