# Laravel:e2e Playwright

> Generic E2E patterns with Playwright—state setup, seeds, test IDs, auth, environment, and Sail integration

- Skill: `jpcaparas/laravel-e2e-playwright` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jpcaparas/laravel-e2e-playwright`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jpcaparas/laravel-e2e-playwright/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: jpcaparas (https://skillmd.com/u/jpcaparas)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/jpcaparas/laravel-e2e-playwright

---


# E2E Playwright (Laravel)

Keep E2E tests reliable, fast, and maintainable.

## Environment

```
# Sail
sail pnpm playwright:test

# Non‑Sail
pnpm playwright:test
```

Use a dedicated `.env.playwright` and rebuild schema with `migrate:fresh --seed` before running.

## State & Seeds

- Provide seeders for common scenarios (users, roles, demo content)
- Use factories for per‑test setup; reset state between specs

## Test IDs & Selectors

- Prefer `data-testid` attributes over CSS paths
- Keep selectors stable through refactors

## Auth

- Reuse storage state when possible (logged‑in cookies/session)
- Otherwise create user via API/setup to avoid UI login flakiness

## Patterns

- Break large flows into steps; assert key milestones
- Record videos/screenshots only on failure to keep suites fast


