write frontend tests

AI Community

Skill notes

References

Before writing any tests, read the testing rules and conventions: autogpt_platform/frontend/TESTING.md — testing strategy, file locations, examples autogpt_platform/frontend/src/tests/AGENTS.md — detailed testing rules, MSW patterns, decision flowchart autogpt_platform/frontend/src/tests/integrations/test-utils.tsx — custom render with providers autogpt_platform/frontend/src/tests/integrations/vitest.setup.tsx — MSW server setup

Step 1: Identify changed frontend files

Also read the diff to understand what changed:

Step 2: Categorize changes and find test targets

For each changed file, determine: Is it a page? (page.tsx) — these are the primary test targets Is it a hook? (use*.ts) — test via the page/component that uses it; avoid direct renderHook() tests unless it is a shared reusable hook with standalone business logic Is it a component? (.tsx in components/) — test via the parent page unless it's complex enough to warrant isolation Is it a helper? (helpers.ts, utils.ts) — unit test directly if pure logic

Step 3: Check for existing tests

For each test target, check if tests already exist: Note which targets have no tests (need new files) vs which have tests that need updating.

Step 4: Identify API endpoints used

For each test target, find which API hooks are used: For each API hook found, locate the corresponding MSW handler: List every MSW handler you will need (200 for happy path, 4xx for error paths).

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
AI
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
88 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@Significant-Gravitas · no license declared
Token usage
Lean
Setup complexity
Plug-and-play
External API key
Not required
Operating systems
Unspecified (assume cross-platform)
Runtime requirements
No explicit requirements detected
Detected file/system behavior
  • Read-only
  • Write / modify
Network behavior
External requests
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

01
Step 1: Identify changed frontend files

Also read the diff to understand what changed:

02
Step 2: Categorize changes and find test targets

For each changed file, determine: Is it a page? (`page.tsx`) — these are the primary test targets Is it a hook? (`use*.ts`) — test via the page/component that uses it; avoid direct `renderHook()` tests unless it is a shared reusable hook with standalone business logic Is it a component? (`.tsx` in `components/`) — test via the parent page unless it's complex enough to warrant isolation Is it a helper? (`helpers.ts`, `utils.ts`) — unit test directly if pure logic

03
Step 3: Check for existing tests

For each test target, check if tests already exist: Note which targets have no tests (need new files) vs which have tests that need updating.

04
Step 4: Identify API endpoints used

For each test target, find which API hooks are used: For each API hook found, locate the corresponding MSW handler: List every MSW handler you will need (200 for happy path, 4xx for error paths).

05
Step 5: Write the test plan

Before writing code, output a plan as a numbered list: Present this plan to the user. Wait for confirmation before proceeding. If the user has feedback, adjust the plan.

06
Step 6: Write the tests

For each test file in the plan, follow these conventions:

07
Step 7: Run and verify

After writing all tests: If tests fail: Read the error output carefully Fix the test (not the source code, unless there is a genuine bug) Re-run until all pass

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.