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/nedcodes-ok/cursorrules-collection/playwrightgit clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collectionWrote 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/nedcodes-ok/cursorrules-collection/playwright)<a href="https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/playwright"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/playwright.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.00643 | $0.00643 |
| Opus 5 | $0.00321 | $0.00321 |
| Sonnet 5 | $0.00129 | $0.00129 |
| Haiku 4.5 | $0.00064 | $0.00064 |
Grade A, and why
playwright 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 yesterday.
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.
Copies of this mod
1 near-identical copy found in the catalogue:
- playwright — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 57 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Playwright Cursor Rules
You are an expert in Playwright end-to-end testing. Follow these rules:
Test Structure
- One test file per feature or page: tests/auth.spec.ts, tests/checkout.spec.ts
- Use test.describe() to group related tests
- Test names should describe user behavior: test('user can add item to cart and checkout')
- Keep tests independent — no test should depend on another test's state
- Use test.beforeEach for common setup (login, navigation)
Selectors
- Use getByRole() as the primary selector: page.getByRole('button', { name: 'Submit' })
- Use getByText(), getByLabel(), getByPlaceholder() for user-visible elements
- Use getByTestId() only when no accessible selector exists — add data-testid as last resort
- Never use CSS selectors or XPath for elements users interact with
- Chain locators: page.getByRole('listitem').filter({ hasText: 'Product A' })
Assertions
- Use web-first assertions: await expect(page.getByText('Success')).toBeVisible()
- Never use page.waitForTimeout() — use expect with auto-waiting or waitForSelector
- Assert on visible state, not DOM existence: toBeVisible() over toBeAttached()
- Use toHaveURL(), toHaveTitle() for navigation assertions
- Use soft assertions (expect.soft) for non-critical checks within a test
Page Object Model
- Create page objects for reusable interactions: class LoginPage { constructor(private page: Page) {} }
- Page objects expose actions (login, fillForm) not raw locators
- Return new page objects from navigation actions: async goToSettings() { return new SettingsPage(this.page) }
- Keep assertions in tests, not in page objects
Fixtures
- Extend the base test with custom fixtures: test.extend<{ adminPage: AdminPage }>()
- Use fixtures for authenticated state, seeded data, and test accounts
- Store auth state with storageState for reuse across tests
- Use worker-scoped fixtures for expensive setup (database seeding)
Anti-Patterns — Do NOT
- ❌ Using page.waitForTimeout(2000) — always wait for a specific condition
- ❌ Using page.$() or page.$$() — use locator API
- ❌ Testing implementation details (CSS classes, internal state)
- ❌ Sharing state between test files via global variables
- ❌ Hard-coding URLs — use baseURL in playwright.config.ts
- ❌ Ignoring flaky tests — fix the root cause or add proper waiting
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.
- yesterday First seen · 57 lines · 643 tokens per session scan A fda83a373eec
playwright is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It adds 643 tokens to every session, about $0.0032 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-09-03.
Other cursor rules, from other repositories
playwright
Playwright: e2e testing, page objects, fixtures, assertions.
webdriver-management
Selenium WebDriver lifecycle management — driver factory, explicit waits, browser options, and teardown.
page-object-patterns
Page Object Model patterns for Selenium — BasePage, component objects, and fluent interfaces.
testing-fundamentals
Core Cypress testing principles — selector strategy, smart waiting, and spec organization. Apply when writing or reviewing Cypress E2E tests.
cypress-excellence
Advanced Cypress testing patterns and best practices — custom commands, page objects, and network testing.
framework-architecture
Selenium + pytest framework architecture — configuration, fixtures, and dependency management.