test-ids

Standardize testID constants in React Native with hierarchical naming conventions.

3|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/guicheffer/devorch-cli --skill test-ids
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-ids
Source: https://github.com/guicheffer/devorch-cli/tree/main/templates/skills/testing/test-ids
Command: npx skills add https://github.com/guicheffer/devorch-cli --skill test-ids

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of creating reliable and maintainable automated tests for React Native applications by establishing a consistent pattern for defining and using testID attributes.

Core Features & Use Cases

  • Hierarchical Naming: Enforces a feature-component-element-variant naming convention to prevent collisions and improve discoverability.
  • Constant Definitions: Promotes defining testIDs as constants within feature-specific files, enabling easier refactoring and preventing typos.
  • Cross-Platform Compatibility: Provides guidance for using the same testIDs in both unit tests (React Native Testing Library) and E2E tests (Maestro).
  • Use Case: When writing tests for a new user profile screen, you can quickly define and use testIDs like profile-screen-header, profile-screen-edit-button, and profile-screen-avatar ensuring consistency and testability.

Quick Start

Define test IDs for your React Native components using the feature-component-element naming convention.

Frequently Asked Questions about test-ids

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize React Native testIDs for automated testing?

Standardize React Native testIDs by enforcing a hierarchical `feature-component-element-variant` naming convention. This pattern prevents identifier collisions and ensures reliable element location during automated testing across different components and features.

What is the best way to prevent testID collisions in React Native components?

Preventing testID collisions requires a hierarchical naming convention like `feature-component-element-variant`. Defining these identifiers as constants within feature-specific files further eliminates typos and ensures unique element identification across the application.

Can I use the same React Native testIDs for both unit and E2E tests?

Yes, the same React Native testIDs can be used for both unit and E2E tests. This cross-platform compatibility allows unified element identification across React Native Testing Library for unit tests and Maestro for E2E testing.

How do I structure testID constants for a new React Native feature?

Structure testID constants by defining them within feature-specific files using the `feature-component-element` naming convention. For example, a user profile screen uses constants like `profile-screen-header` and `profile-screen-edit-button` to maintain testability.

Why define React Native testIDs as constants instead of inline strings?

Defining React Native testIDs as constants prevents typos and enables easier refactoring. Grouping these constants in feature-specific files ensures consistent usage across unit and E2E tests, maintaining reliable automated testing workflows.