Przejdź do treści
Biblioteka skilli
Programowanie · Testowanie

ui-playwright

/ui-playwright

Pisze testy UI w Playwright: lokatory ról, page objects, fixtury, stuby sieci i jeden test na każdy stan story w Storybooku.

Repozytorium
magus ↗
Licencja
MIT
Ostatnia zmiana repozytorium
26.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Pisze testy UI w Playwright: lokatory ról, page objects, fixtury, stuby sieci i jeden test na każdy stan story w Storybooku.

Oryginalny opis (EN)

Writes Playwright UI tests — role locators, page objects, fixtures, network stubs, snapshot policy, one test per Storybook story state. Use when testing a screen, component, or user flow in a browser.

Jak działa

  1. Inputs and outputs
  2. Workflow
  3. Flake control
  4. Config for CI
  5. Verification before done
Sekcje z nagłówków SKILL.md, w oryginale · 82 linii, 611 słów
Podgląd SKILL.md
---
name: ui-playwright
description: Writes Playwright UI tests — role locators, page objects, fixtures, network stubs, snapshot policy, one test per Storybook story state. Use when testing a screen, component, or user flow in a browser.
---

# UI tests with Playwright

Objective: a UI test suite that fails when a user-visible behaviour breaks and stays green
across runs. The contract is the Storybook story set and the spec; the implementation is
not an input.

## Inputs and outputs

| Input | Where it comes from |
|---|---|
| Story files (`*.stories.tsx`) | `CONTRACT_PATHS` — every exported story is a state to test |
| Spec | `SPEC_PATH` — flows, error text, limits |
| Test dir and config | `TEST_DIR`, `playwright.config.*` if present |

Output: `*.spec.ts` files under `TEST_DIR`, a `playwright.config.ts` if none exists, page
objects under `TEST_DIR/pages/`, fixtures under `TEST_DIR/fixtures/`.

## Workflow

1. **Map stories to tests.** For each story export write one test named
   `<Component> · <story> · <expected outcome>`. A story with no test is a gap; a test
   with no story or spec line is an implementation test — delete it.
2. **Locate by role, then label, then test id.** `getByRole('button', { name: 'Save' })`
   first; `getByLabel`, `getByText` next; `getByTestId` only when the element has no
   accessible name, and then record the id as a contract the component must keep. Never
   locate by CSS class or DOM position.
3. **Page objects for flows, not for single components.** A page object exposes actions
   (`login(user)`, `openOrder(id)`) and readable state (`errorText()`); it holds locators,
   nothing else. Component tests call the component directly through `@playwright/experimental-ct-react`
   (or the framework's CT package) with props from the story.
4. **Fixtures own setup and teardown.** Auth, seeded data, and viewport live in
   `test.extend` fixtures; a test body is arrange-act-assert only.
5. **Stub the network at the boundary.** `page.route()` for third-party and backend
   calls in component and flow tests; assert the request shape when the spec defines it.
   E2E tests against a real backend run in a separate project with its own tag.
6. **Assert observable outcomes.** Rendered text, `toBeVisible`, `toHaveValue`,
   `toHaveAttribute('aria-invalid', 'true')`, URL, emitted network request. Never assert
   on internal state, store shape, or that a handler was called.
7. **Snapshots are for layout regressions only.** One `toHaveScreenshot()` per story
   state, `maxDiffPixelRatio` set explicitly, masks for dates and avatars, stored per
   platform. A snapshot never replaces a behavioural assertion.
8. **Every state from the guardrails is a test.** Default, hover, focus, disabled,
   loading, invalid, empty — if the story exists, the test exists; if the story is
   missing, report it as a contract gap rather than skipping the state.

## Flake control

- Web-first assertions only (`expect(locator).toBeVisible()`); no `waitForTimeout`.
- `test.describe.configure({ mode: 'serial' })` only for flows that share a server-side
  state, and say why in a comment.
- `retries: 0` locally, `retries: 1` in CI with `trace: 'on-first-retry'`; a test that
  needs the retry is filed as a bug, not left green.
- Fixed viewport, fixed locale and timezone in the config; freeze `Date` through the
  fixture when the UI renders time.

## Config for CI

```ts
// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
  testDir: './tests/ui',
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 1 : 0,
  reporter: process.env.CI ? [['github'], ['html', { open: 'never' }]] : 'list',
  use: { trace: 'on-first-retry', locale: 'en-US', timezoneId: 'UTC', viewport: { width: 1280, height: 800 } },
  projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
  webServer: { command: 'bun run dev', url: 'http://localhost:5173', reuseExistingServer: !process.env.CI },
});
```

Run headless with `bunx playwright test`; `bunx playwright install --with-deps chromium`
once per CI image.

## Verification before done

- Every story export appears in a test name (grep the stories dir against `TEST_DIR`).
- `bunx playwright test` passes twice in a row locally.
- Negative control: change one expected string in one test, watch it fail, restore it.

Wersje

W bazie nie ma innych skilli o nazwie ui-playwright.

Migawka bazy z 13.11.2026 · wersja paczki a4422095dc6b (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 1 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 95qa-e2e-playwright
    Pisze i porządkuje zestawy testów Playwright w TypeScript: konfigurację, lokatory, uwierzytelnianie, mocki i sharding w CI.
  • 95frontend-playwright-testing
    Pisze stabilne testy end-to-end i komponentowe w Playwright: lokatory ról, asercje, ponowne użycie logowania i konfigurację CI.
  • 82playwright
    Określa standardy testów E2E w Playwright: strukturę specyfikacji, selektory, fixtures, page objects i uruchamianie w CI.
  • 100playwright-testing
    Wspiera pisanie testów E2E w Playwright: automatyzacja przeglądarki, regresja wizualna, Page Objects, fixture'y i niezawodne wzorce testowe.
  • 100playwright-e2e-testing
    Pisze, poprawia i przegląda testy E2E w Playwright dla aplikacji Next.js, w tym lokatory, logowanie i testy niestabilne.
  • 100playwright-testing
    Automatyzuje testy UI i E2E z Playwright MCP: sprawdza stronę, robi zrzuty ekranu, uruchamia Playwright i pisze testy przeglądarkowe.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.