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.
npx agentmods add rules/verdexhq/verdex-mcp/playwright-test-patterns-guidegit clone --depth 1 https://github.com/verdexhq/verdex-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/verdexhq/verdex-mcp/playwright-test-patterns-guide)<a href="https://agentmods.dev/rules/verdexhq/verdex-mcp/playwright-test-patterns-guide"><img src="https://agentmods.dev/badge/rules/verdexhq/verdex-mcp/playwright-test-patterns-guide.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00115 | $0.08232 |
| Opus 5 | $0.00057 | $0.04116 |
| Sonnet 5 | $0.00023 | $0.01646 |
| Haiku 4.5 | $0.00012 | $0.00823 |
Grade A, and why
playwright-test-patterns-guide 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 1,320 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Idiomatic Playwright Test Patterns
A comprehensive guide for writing clean, maintainable, and production-ready Playwright E2E tests.
Table of Contents
- Core Principles
- Test File Structure
- Assertion Patterns
- Navigation and Waiting
- Authentication Strategies
- Test Organization
- Page Object Models
- Test Data Management
- Error Handling
- Common Patterns Library
- Anti-Patterns to Avoid
- Complete Examples
Core Principles
✅ Idiomatic Playwright Testing
- Auto-waiting is your friend - Trust Playwright's built-in waiting
- Explicit is better than implicit - Make intentions clear
- Arrange-Act-Assert - Clear test structure
- Independent tests - Each test can run alone
- Descriptive names - Tests are documentation
- Minimal setup - Only what's necessary
- Stable selectors - Role-first, semantic locators
❌ Never Do These
- ❌ Manual waits (
page.waitForTimeout(5000)) except for debugging - ❌ Broad
try/catchblocks that hide failures - ❌ Tests that depend on other tests
- ❌ Hard-coded URLs and credentials in test files
- ❌ Generic test names like "test 1" or "works correctly"
- ❌ Unnecessary
waitForSelector(built into locators)
Test File Structure
Basic Test File Template
import { test, expect } from '@playwright/test';
test.describe('Feature Name', () => {
test.beforeEach(async ({ page }) => {
// Setup before each test
await page.goto('/starting-point');
});
test('should do specific thing', async ({ page }) => {
// Arrange: Set up test data/state
// Act: Perform user actions
// Assert: Verify expected outcomes
});
test('should handle error case', async ({ page }) => {
// Test error scenarios
});
});
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.
- 4d ago First seen · 1,320 lines · 115 tokens per session scan A e01e99dbb1fb
playwright-test-patterns-guide is a cursor rule published in the GitHub repository verdexhq/verdex-mcp (17 stars, last pushed 8mo ago), licensed Apache-2.0. It adds 115 tokens to every session and 8,232 once invoked, about $0.0006 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-30.
Other cursor rules, from other repositories
modus-angular-chrome-devtools-testing
Chrome DevTools MCP usage for comprehensive Angular + Vite testing.
vasu-playwright-utils
../../templates/cursor-rules/vasu-playwright-utils.mdc.
browser-ops-demo
Agent rules for browser-ops-demo.
qa-script-executor
QA Script Executor - Executes natural language test scripts using Chrome DevTools MCP and enhances them with technical hints.
project-instructions
Project-level instructions for the 10x Quality Framework.
puppeteer
This guide provides opinionated, actionable best practices for writing robust, performant, and maintainable Puppeteer scripts for web scraping, automation, and testing. It emphasizes modern patterns like page.locator() and efficient resource management.