Skip to content
Agentmart
Submit a tool

Cursor rules · Automattic/wp-calypso

1 Cursor rule file from Automattic/wp-calypso: dashboard-testing.

Template by Automattic

IndexedGPL-2.0★ 12,646
Write a review

Install

Works with Cursor. Read the repository before you give any tool access to your data.

curl -fsSL https://raw.githubusercontent.com/Automattic/wp-calypso/trunk/.cursor/rules -o rules

Read it and adapt it to your project before use.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

The .cursor/rules folder of Automattic/wp-calypso (12,646 stars): 1 rule files, 42 lines in all (dashboard-testing).

Use cases: testing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

What's in it

Cursor project rules (.cursor/rules/*.mdc): instructions Cursor applies when it edits matching files.

For
Cursor
File
.cursor/rules/dashboard-testing.mdc

First lines (shown under the repo's GPL-2.0 license)

---
description: Rules for writing tests for dashboard screen / components
globs: client/dashboard/**/test/**
alwaysApply: false
---

# Writing tests for dashboard screens / components

Tests MUST verify user-visible behavior, not implementation details. Test what a user can see or do, not how the component is built internally.

CRITICAL: consult these reference examples:
- @client/dashboard/sites/test/index.test.tsx - DataViews assertions
- @client/dashboard/sites/overview/test/index.test.tsx - more complex assertions for cards / sections in the screen
- @client/dashboard/sites/settings-php/test/index.test.tsx - form submission

## Setup

- Put the test file under the `test/` subdirectory, with the same name as the component file but with the `.test.tsx` extension.
- Use the component name (surrounded by `<>`) as the top-level `describe()` block.
- Use `test()` instead of `it()` for test cases.
- Use the custom `render()` function from @client/dashboard/test-utils.tsx — it wraps components with all required providers (QueryClient, Router, Auth, Analytics).
- If the component uses `useSuspenseQuery()`, wait for a stable element (e.g., heading) before asserting.

## Assertions

- Assert on what the user sees on the screen.
- Query by accessible role using e.g. `screen.findByRole()`, `screen.getByRole()`,  `screen.queryByRole()`, and `within()`.
- Never query by test ID, CSS class, or DOM structure.
- If an element isn't reachable by role, fix the component's accessibility instead.
- Prefer simple, readable assertions over complex logic.

## Mocking

- DO NOT mock React components, hooks, or modules.
- DO NOT mock TanStack queries.
- Only mock network requests at the boundary using `nock` to intercept REST API calls to `https://public-api.wordpress.com`.

## Test data

- Keep test objects minimal — include only properties relevant to the test.
- Use `as Type` to cast partial objects instead of filling unused fields.

Signals

Stars
12,646
Forks
2,038
Open issues
2,778
Last commit (this folder)
Feb 19, 2026 (8 months ago)
Last release
Jun 2, 2021 (5 years ago)

From GitHub (fetched Oct 24, 2026).

Details

License
GPL-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Automattic

Cite this page

Cursor rules · Automattic/wp-calypso. Agent Mart. https://agentmart.dev/templates/automattic-wp-calypso-cursor-rules (last updated 2026-10-24)