Skip to content

Commit 8be6feb

Browse files
authored
chore: MMQA-1334 add AGENTS.md for testing (#25502)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Adds a new tests/AGENTS.md that serves as a single index for test-related work across e2e/, tests/, wdio/, and component-view tests, pointing agents to the canonical testing guidelines and key framework/mocking/fixture entry points. Updates the root AGENTS.md documentation table with a Test Guidelines note directing contributors to tests/AGENTS.md for testing conventions. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation-only changes that add pointers for AI agents; no runtime code, build, or test logic is modified. > > **Overview** > Adds a new `tests/AGENTS.md` that serves as a single index for test-related work across `e2e/`, `tests/`, `wdio/`, and component-view tests, pointing agents to the canonical testing guidelines and key framework/mocking/fixture entry points. > > Updates the root `AGENTS.md` documentation table with a **Test Guidelines** note directing contributors to `tests/AGENTS.md` for testing conventions. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8f76f45. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 4524026 commit 8be6feb

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,6 @@ If the user asks to implement a ticket directly from Jira:
191191
| Storybook | `/docs/readme/storybook.md` |
192192
| Troubleshooting | `/docs/readme/troubleshooting.md` |
193193
| MetaMask Contributor Docs | https://github.com/MetaMask/contributor-docs |
194+
195+
## Test Guidelines
196+
When working on tests, read tests/AGENTS.md for testing conventions.

tests/AGENTS.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# tests/ — AGENTS.md
2+
3+
Single agent index for **e2e/**, **tests/**, and **wdio/**. Pointers only; details live in the canonical sources below.
4+
5+
## Scope
6+
7+
- **e2e/**`e2e/specs/`, `e2e/pages/`, `e2e/selectors/`, config. Specs, Page Objects, selectors. Consumes `tests/framework/` and fixtures.
8+
- **tests/**`tests/framework/`, `tests/api-mocking/`, `tests/docs/`, `tests/regression/`, `tests/smoke/`, etc. Framework, fixtures, mocking, regression/smoke specs.
9+
- **wdio/**`wdio/helpers/`, `wdio/screen-objects/`, `wdio/utils/`. Legacy WebdriverIO/Appium — **deprecated**. Use Detox + e2e/tests or Appwright for performance.
10+
- **component view tests**`app/**/*.view.test.tsx`. Jest component view tests.
11+
12+
### Component-View Tests (Mandatory)
13+
14+
- [.cursor/rules/component-view-testing.mdc](../.cursor/rules/component-view-testing.mdc) — Mock policy, presets/renderers, navigation, test structure.
15+
- [app/util/test/component-view/README.md](../app/util/test/component-view/README.md) — Framework layout, usage, presets, renderers, platform matrix.
16+
- [app/util/test/component-view/COMPONENT_VIEW_TEST_RULES.md](../app/util/test/component-view/COMPONENT_VIEW_TEST_RULES.md) — Detailed rules, allowed mocks, how to write component-view tests.
17+
18+
### Implementation Reference (Component-View)
19+
20+
- Mocks: [util/test/component-view/mocks.ts](../app/util/test/component-view/mocks.ts)
21+
- Presets: [util/test/component-view/presets/](../app/util/test/component-view/presets/)
22+
- Renderers: [util/test/component-view/renderers/](../app/util/test/component-view/renderers/)
23+
- State fixture: [util/test/component-view/stateFixture.ts](../app/util/test/component-view/stateFixture.ts)
24+
25+
## Canonical Sources (read these, do not duplicate)
26+
27+
- [.cursor/rules/e2e-testing-guidelines.mdc](../.cursor/rules/e2e-testing-guidelines.mdc) — Patterns, Page Objects, assertions, gestures, prohibited patterns.
28+
- [docs/readme/e2e-testing.md](../docs/readme/e2e-testing.md) — Setup, run commands, build types, Metro, Detox, Flask; legacy Appium; Appwright.
29+
- [tests/docs/README.md](docs/README.md) — Framework structure, withFixtures, FixtureBuilder, anti-patterns, checklist.
30+
- [tests/docs/MOCKING.md](docs/MOCKING.md) — API mocking, default and test-specific mocks.
31+
- [tests/docs/CONTROLLER_MOCKING.md](docs/CONTROLLER_MOCKING.md) — Controller mocking.
32+
- [tests/docs/MODULE_MOCKING.md](docs/MODULE_MOCKING.md) — Module mocking.
33+
- [tests/framework/index.ts](framework/index.ts) — Assertions, Gestures, Matchers, Utilities, PlaywrightAdapter.
34+
- [tests/framework/fixtures/FixtureHelper.ts](framework/fixtures/FixtureHelper.ts), [FixtureBuilder.ts](framework/fixtures/FixtureBuilder.ts) — Fixtures.
35+
- [AGENTS.md](../AGENTS.md) — Root index; commands, architecture.
36+
- [.github/guidelines/CODING_GUIDELINES.md](../.github/guidelines/CODING_GUIDELINES.md) — Coding standards.
37+
38+
Unit tests under `tests/` (e.g. framework tests): [.cursor/rules/unit-testing-guidelines.mdc](../.cursor/rules/unit-testing-guidelines.mdc).
39+
40+
## Before working
41+
42+
- **e2e/** — Use `withFixtures` + `FixtureBuilder`; Page Object methods only; no `TestHelpers.delay()`; selectors in `e2e/selectors/` or page folder; import from `tests/framework/index.ts`. Commands: [docs/readme/e2e-testing.md](../docs/readme/e2e-testing.md).
43+
- **tests/** — Framework/mocking: read tests/docs/README and MOCKING; keep exports in `tests/framework/index.ts`. Regression/smoke: same as e2e (withFixtures, Page Objects, no delay). Yarn only.
44+
- **wdio/** — Do not extend. New work: Detox + e2e/tests or Appwright (`appwright/tests/`). If maintaining: legacy section in [docs/readme/e2e-testing.md](../docs/readme/e2e-testing.md).
45+
46+
---
47+
48+
**Note:** All tests are being migrated into the **tests/** folder. Prefer adding or moving test code under `tests/` (framework, specs, mocking, resources) where possible; `e2e/` and `wdio/` remain for existing layout until migration completes.

0 commit comments

Comments
 (0)