detox

detox is a cursor rule for Cursor from sanjeed5/awesome-cursor-rules-mdc. It costs 1,393 tokens per session, scanned A, original, CC0-1.0.

A set of rules for writing end-to-end tests with Detox in React Native applications. End-to-end tests operate the app like a user and check complete flows, while the Page Object Model keeps screen interactions in reusable classes.

In plain words
What is it for?
Use it to test React Native flows such as logging in, tapping controls, entering text, and checking that screens or elements appear correctly.
Why use it?
It helps reduce fragile tests and repeated selectors when the mobile interface changes. The guidance aims to make tests more readable, stable, and maintainable.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import LoginPage from '../pages/LoginPage';.

Good fit Use it to test React Native flows such as logging in, tapping controls, entering text, and checking that screens or elements appear correctly.

Compare 6 cursor rules from other repositories ↓
About the project

awesome-cursor-rules-mdc is a generator that creates Cursor MDC rule files from structured library information, using semantic search and language models to gather and organize guidance. Developers use it to produce reusable rules for libraries in Cursor, and the catalogue includes 200 of those rules.

sanjeed5/awesome-cursor-rules-mdc · 3,588 stars · on GitHub

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/sanjeed5/awesome-cursor-rules-mdc
agentmods
npx agentmods add rules/sanjeed5/awesome-cursor-rules-mdc/detox

Made for: Cursor.

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

agentmods badge for detox

README.md
[![agentmods](https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/detox/github.svg)](https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/detox)
Your own site
<a href="https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/detox"><img src="https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/detox/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for detox

Your own site · 80×15
<a href="https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/detox"><img src="https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/detox.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,393 This file is loaded in full into every session.
When invoked 1,393 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.01393 $0.01393
Opus 5.5 $0.00557 $0.00557
Sonnet 5.5 $0.00279 $0.00279
Haiku 4.5 $0.00139 $0.00139

Measured 3mo ago against content hash d073f274d7f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

detox 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 3mo 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.

rules-mdc/detox.mdc · 174 lines

How it starts

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

detox Best Practices

Detox is the definitive choice for E2E testing in React Native. These rules ensure your tests are fast, stable, and easy to maintain, leveraging modern JavaScript and Detox's gray-box capabilities.

1. Test Organization with Page Object Model (POM)

Always structure your tests using the Page Object Model. This abstracts UI interactions and selectors, making tests readable and resilient to UI changes.

❌ BAD: Direct selectors and repeated logic

// login.e2e.js
describe('Login Flow', () => {
  it('should log in successfully', async () => {
    await element(by.id('emailInput')).typeText('[email protected]');
    await element(by.id('passwordInput')).typeText('password123');
    await element(by.id('loginButton')).tap();
    await expect(element(by.id('homeScreen'))).toBeVisible();
  });
});

✅ GOOD: Page Object Model

// pages/LoginPage.js
class LoginPage {
  constructor() {
    this.emailInput = element(by.id('emailInput'));
    this.passwordInput = element(by.id('passwordInput'));
    this.loginButton = element(by.id('loginButton'));
  }

  async login(email, password) {
    await this.emailInput.typeText(email);
    await this.passwordInput.typeText(password);
    await this.loginButton.tap();
  }

  async isVisible() {
    await expect(this.emailInput).toBeVisible();
  }
}
export default new LoginPage();

// tests/login.e2e.js
import LoginPage from '../pages/LoginPage';
import HomeScreen from '../pages/HomeScreen';

describe('Login Flow', () => {
  beforeEach(async () => {
    await device.reloadReactNative();
  });

  it('should log in successfully', async () => {
    await LoginPage.login('[email protected]', 'password123');
    await HomeScreen.isVisible();
  });
});

2. Stable Selectors are Paramount

Prioritize by.id for all interactive elements. Fallback to by.text only when by.id is not feasible (e.g., dynamic content). Avoid fragile selectors like by.type or by.label if a more stable alternative exists.

Read the full file on GitHub · 174 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. 3mo ago First seen · 174 lines · 0 tokens per session scan A d073f274d7f6

Subscribe to this mod's changes

detox is a cursor rule published in the GitHub repository sanjeed5/awesome-cursor-rules-mdc (3,588 stars, last pushed 9d ago), licensed CC0-1.0. It adds 1,393 tokens to every session, about $0.0056 per session on Opus 5.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.

Related

detox compared with cursor rules from other repositories

detox next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
detoxsanjeed5/awesome-cursor-rules-mdcCursor rule3.6k9d agoCC0-1.0A1,393Cursor
web-pages-e2e-test-maintenanceTACC/HPCPerfStatsCursor rule60todayLGPL-2.1A0Cursor
local-compose-db-lifecycle-for-web-testsTACC/HPCPerfStatsCursor rule60todayLGPL-2.1A9Cursor
cypress-e2e-testing-cursorrules-prompt-fileXD3an/awesome-ai-coding-all-in-oneCursor rule14todaynoneA709Cursor
vasu-playwright-utilsvasu31dev/playwright-ts-libCursor rule258mo agoMITA14Cursor
ponytailDietrichGebert/ponytailCursor rule204k11d agoMITA604Cursor
angular-20angular/angularCursor rule102ktodayMITA0Cursor