agentleFS
grafanagrafana/mcp-grafana/.claude/skills/frontend-testing-strategy/SKILL.md

frontend-testing-strategy

Skill3.7k starsChanged 16 days agoApache-2.0View on GitHub

Write and review meaningful frontend unit, component, and E2E tests; diagnose weak assertions and flaky async tests. Read repository testing guidance for commands and fixtures.

3 other projects use a version of this.

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projectsWeek of Nov 8: 0 new projectsWeek of Nov 15: 0 new projectsWeek of Nov 22: 0 new projects
Oct 2026Nov 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Most recently taken up by

Who's talking about grafana/mcp-grafana

The biggest 5 of 54 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 54

Talked about on GitHub and Bluesky (54 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 4

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. grafana/grafana★ 78ksame name
    2. annatchijova/SKILLS★ 9same name
    3. LeonxLJX/web-engineer-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 11 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the repository's runner and fixtures already identified for the task.

    line 8
  2. Distinctive:

    Use unit tests for logic, component/integration tests for collaboration and observable UI behavior, and targeted E2E tests for critical …

    line 15
  3. Distinctive:

    Add tests with features and fixes.

    line 19
  4. Distinctive:

    Verify this using a reversible local change.

    line 20
  5. Distinctive:

    Before updating a failing assertion or snapshot, trace the failure and distinguish an intended behavior change from a regression.

    line 21
  6. Distinctive:

    Use independent expected values: do not call the implementation or duplicate its formula to compute the expectation.

    line 30
  7. Distinctive:

    Prefer real component trees over mocked children.

    line 44
  8. Distinctive:

    Use the runner's typed mock helper rather than scattered unsafe casts.

    line 47
  9. Distinctive:

    Use semantic roles and accessible names for UI queries.

    line 49
  10. Distinctive:

    Use deterministic interactions instead of unsupported DOM geometry hacks.

    line 60
  11. Distinctive:

    Run focused tests in non-watch mode.

    line 62

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Frontend testing strategy

Use the repository's runner and fixtures already identified for the task. These principles work with Jest, Vitest, and other runners. Do not introduce a new runner just to follow this skill. For visualization behavior, also read the panel companion. Do not reload guidance already read.

Choose meaningful coverage

  • Extend existing focused tests. Test production code, not test-local helpers or framework behavior.
  • Use unit tests for logic, component/integration tests for collaboration and observable UI behavior, and targeted E2E tests for critical user journeys. Keep static checks as the foundation.
  • Name each test for the behavior its assertions establish. Consolidate duplicate cases; use table-driven tests for meaningful variants. Avoid testing trivial initial values or mere rendering.
  • Add tests with features and fixes. A regression test must fail without the fix and pass with it. Verify this using a reversible local change; restore production code before finishing.
  • Before updating a failing assertion or snapshot, trace the failure and distinguish an intended behavior change from a regression. Never update expectations merely to obtain a green run.
  • Review AI-generated tests for readability, real coverage, and unnecessary mocks. Coverage percentages do not substitute for a test that catches the intended regression.

Assert the contract

Assert concrete computed values, visible behavior, or exact collaborator arguments. Existence, "did not throw", and lengths that merely mirror input are insufficient by themselves. Use independent expected values: do not call the implementation or duplicate its formula to compute the expectation. A small, reviewed inline snapshot can freeze awkward deterministic values. Broad DOM snapshots are not a substitute for behavioral assertions.

For consumers of theme colors, assert the intended semantic token from the supplied theme, rather than today's hex value. When testing the palette or resolver itself, use independent expected values. For query builders, compare the complete deterministic query, not a fragment.

Set every precondition needed to reach the target branch: flags, input shape, loading state, and permissions. Check that deliberately breaking the behavior makes the test fail. Test names must not claim more than the assertions prove.

Exercise real behavior

Prefer real component trees over mocked children. Mock external boundaries, controlled time, or APIs unavailable in the environment; keep working storage implementations and simple helpers real. Use the repository's real feature-flag test utilities. Restore mocks and timers between tests. Use the runner's typed mock helper rather than scattered unsafe casts.

Use semantic roles and accessible names for UI queries. When those are insufficient, use the repository's stable selectors, scoped to the owning component. Drive interactions through user-facing controls, not internal component state.

Avoid flakes

  • Establish a positive expected state before checking absence: an empty render must not pass.
  • Await asynchronous UI with retrying assertions or find queries, not fixed sleeps. Retry callbacks must throw on failure. Do not repeat side effects inside retry callbacks.
  • Pin time, locale, timezone, randomness, and dimensions when they affect the assertion.
  • Scope locators to avoid previews and duplicate widgets. Wait for renderer or data readiness.
  • Use deterministic interactions instead of unsupported DOM geometry hacks. Avoid reading transient text while virtualized or animated content is settling.
  • Run focused tests in non-watch mode. Report commands, results, and unavailable checks accurately. Retries and broad suppressions must not conceal an unresolved failure.

Review meaningful interaction, error, empty-data, and accessibility states as applicable. Before preview or release, review intentional coverage of critical journeys rather than simply counting tests.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.