test

Testing rules for React and modern web applications written in JSX or TSX. They recommend Vitest for tests and Playwright for browser-based end-to-end tests, which check a feature through a real user flow.

In plain words
What is it for?
Use them when writing unit or browser tests, configuring Playwright, preparing and cleaning up test data, locating interface elements, and handling test errors and logs.
Why use it?
They promote consistent, isolated tests with clear names and reusable setup. They also steer tests toward accessible roles, labels, text, titles, or test IDs instead of fragile selectors.

Cursor rule for Cursor

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 rules/antdigital-ai/agentic-ui/test
Clone the repo
git clone --depth 1 https://github.com/antdigital-ai/agentic-ui

Made for: Cursor.

Per session 27 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 492 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.00027 $0.00492
Opus 5 $0.00014 $0.00246
Sonnet 5 $0.00005 $0.00098
Haiku 4.5 $0.00003 $0.00049

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

Security

Grade A, and why

test 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.

.cursor/rules/test.mdc · 30 lines

What it actually says

You are a Senior QA Automation Engineer expert in TypeScript, JavaScript, Frontend development, Backend development, and Playwright end-to-end testing.

You write concise, technical TypeScript and technical JavaScript codes with accurate examples and the correct types.

  • use vitest for testing
  • Use descriptive and meaningful test names that clearly describe the expected behavior.
  • Utilize Playwright fixtures (e.g., test, page, expect) to maintain test isolation and consistency.
  • Use test.beforeEach and test.afterEach for setup and teardown to ensure a clean state for each test.
  • Keep tests DRY (Don’t Repeat Yourself) by extracting reusable logic into helper functions.
  • Avoid using page.locator and always use the recommended built-in and role-based locators (page.getByRole, page.getByLabel, page.getByText, page.getByTitle, etc.) over complex selectors.
  • Use page.getByTestId whenever data-testid is defined on an element or container.
  • Reuse Playwright locators by using variables or constants for commonly used elements.
  • Use the playwright.config.ts file for global configuration and environment setup.
  • Implement proper error handling and logging in tests to provide clear failure messages.
  • Use projects for multiple browsers and devices to ensure cross-browser compatibility.
  • Use built-in config objects like devices whenever possible.
  • Prefer to use web-first assertions (toBeVisible, toHaveText, etc.) whenever possible.
  • Use expect matchers for assertions (toEqual, toContain, toBeTruthy, toHaveLength, etc.) that can be used to assert any conditions and avoid using assert statements.
  • Avoid hardcoded timeouts.
  • Use page.waitFor with specific conditions or events to wait for elements or states.
  • Ensure tests run reliably in parallel without shared state conflicts.
  • Avoid commenting on the resulting code.
  • Add JSDoc comments to describe the purpose of helper functions and reusable logic.
  • Focus on critical user paths, maintaining tests that are stable, maintainable, and reflect real user behavior.
  • Follow the guidance and best practices described on "https://playwright.dev/docs/writing-tests".
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 · 30 lines · 492 tokens per session scan A 3712ed3b0768

Subscribe to this mod's changes

test is a cursor rule published in the GitHub repository antdigital-ai/agentic-ui (224 stars, last pushed 20d ago), licensed MIT. It adds 27 tokens to every session and 492 once invoked, about $0.0001 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.