e2e-testing

A Playwright end-to-end testing guide for Laravel applications. End-to-end tests operate a real web browser to check complete user scenarios, and this guide applies only when Playwright is already installed.

In plain words
What is it for?
Use it to write or stabilize Playwright tests, check user journeys in a browser, and prepare those tests for continuous integration.
Why use it?
It helps create reliable browser tests without fragile page selectors or arbitrary delays. If Playwright is not present, it directs testing toward manual checks or Laravel's Pest and Dusk tools.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/pekral/cursor-rules/e2e-testing
Any agent
npx skills add pekral/cursor-rules --skill e2e-testing
Clone the repo
git clone --depth 1 https://github.com/pekral/cursor-rules

Made for: Claude Code, Codex.

Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,920 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00043 $0.01920
Opus 5 $0.00022 $0.00960
Sonnet 5 $0.00009 $0.00384
Haiku 4.5 $0.00004 $0.00192

Measured 2d ago against content hash a4ea7f3aa413, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

e2e-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/e2e-testing/SKILL.md · 213 lines

How it starts

The opening of the file, as written. The whole thing — 213 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Constraints

  • Apply @rules/code-testing/general.mdc for 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-testid over 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:

ls playwright.config.* 2>/dev/null
grep -q '@playwright/test' package.json 2>/dev/null && echo "playwright present"
  • If neither a playwright.config.* file nor @playwright/test in package.json exists, STOP. Do not install Playwright. Defer to:
    • @skills/test-like-human/SKILL.md for 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

tests/
  e2e/
    auth/login.spec.ts
    features/search.spec.ts
  pages/
    ItemsPage.ts
  fixtures/
    auth.ts
playwright.config.ts

Page Object Model

Encapsulate page structure so specs read as behavior, not selectors.

import { Page, Locator } from '@playwright/test'

export class ItemsPage {
  readonly page: Page
  readonly searchInput: Locator
  readonly itemCards: Locator
  readonly createButton: Locator

  constructor(page: Page) {
    this.page = page
    // Prefer role/test-id selectors. data-testid is stable across restyles.
    this.searchInput = page.getByTestId('search-input')
    this.itemCards = page.getByTestId('item-card')
    this.createButton = page.getByRole('button', { name: 'Create' })
  }

  async goto() {
    await this.page.goto('/items')
  }

  async search(query: string) {
    await this.searchInput.fill(query)
    // Wait for the real response, not a fixed delay.
    await this.page.waitForResponse(r => r.url().includes('/items') && r.ok())
  }

  itemCount() {
    return this.itemCards.count()
  }
}

Read the full file on GitHub · 213 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 213 lines · 43 tokens per session scan A a4ea7f3aa413

Subscribe to this mod's changes

e2e-testing is a skill published in the GitHub repository pekral/cursor-rules (6 stars, last pushed 7d ago), licensed MIT. It adds 43 tokens to every session and 1,920 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.