pekral/cursor-rules/e2e-testing
Claude Code and agent skill by pekral/cursor-rules
- community
Checking that the SKILL.md file is still in the repository.
Use when writing or stabilizing Playwright end-to-end browser tests against a Laravel app — but only when the project already has Playwright; otherwise defer to manual testing or Pest/Dusk.
Install
npx vskill@latest install pekral/cursor-rules/e2e-testingSKILL.md
The same SKILL.md was published earlier as pekral/cursor-rules/e2e-testing.
Constraints
- Apply
@rules/code-testing/general.mdcfor the deterministic-test contract: tests must be reliable, isolated, and free of arbitrary sleeps. - GATED skill: proceed only when the consuming project already ships Playwright. Never install Playwright unprompted.
- Stable selectors over brittle ones: prefer role and
data-testidover CSS/structure. - No arbitrary
waitForTimeout. Rely on auto-waiting locators and explicit conditions.
Use when
- Writing Playwright E2E browser tests for a Laravel app.
- Stabilizing flaky Playwright tests.
- Wiring Playwright into CI against the app under test.
Preconditions (run first, do not skip)
Check whether Playwright is actually present:
- If neither a
playwright.config.*file nor@playwright/testinpackage.jsonexists, STOP. Do not install Playwright. Defer to: @skills/test-like-human/SKILL.mdfor manual, scenario-based testing, or- Pest feature tests / Laravel Dusk for browser coverage inside the PHP stack.
- Only when Playwright IS present, continue with the patterns below.
File organization
Page Object Model
Encapsulate page structure so specs read as behavior, not selectors.
Stable selectors
Order of preference:
getByRole(...)with an accessible name.getByTestId(...)— adddata-testidto the relevant Blade/Livewire markup.getByLabel/getByTextfor forms and copy.- Raw CSS only as a last resort; it breaks on Tailwind restyles.
Test structure
Running against the Laravel app
Point Playwright at the running app and let it boot php artisan serve (or use an already-running instance / CI app URL).
Use a dedicated testing database/env (.env.testing) so E2E runs never touch development data, and migrate/seed it before the suite.
Auth and network state reuse
Log in once, save storage state, and reuse it so specs skip the login flow.
Wire it via globalSetup and use: { storageState: 'tests/e2e/.auth/user.json' }. Keep .auth/ out of version control. You can also stub backend responses with page.route(...) to isolate the frontend from flaky external services.
CI wiring
Flaky-test avoidance
Per @rules/code-testing/general.mdc, tests must be deterministic.
- Use auto-waiting locators (
locator.click()), neverpage.click(selector)on a maybe-not-ready node. - Replace
await page.waitForTimeout(...)withwaitForResponse,waitForURL, orexpect(locator).toBeVisible(). - Wait for the element state before acting on animated UI:
await locator.waitFor({ state: 'visible' }). - Quarantine genuinely flaky tests with
test.fixme(true, 'flaky — issue #NNN')and link an issue rather than leaving them red. - Reproduce flakiness with
npx playwright test path.spec.ts --repeat-each=10.
Done when
- Preconditions confirmed Playwright is present (otherwise deferred to manual/Pest/Dusk).
- Specs use POM and role/test-id selectors.
- The suite runs against the Laravel app on a dedicated testing env/database.
- Auth/network state is reused where it speeds the suite.
- No arbitrary sleeps; all waits are condition-based.
- CI runs the suite and uploads the report.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/e2e-testing/SKILL.md
Popularity
- Repository stars
- 9
- Repository forks
- 1
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/pekral/cursor-rules/e2e-testing)