AGENT SKILL

extension-testing

Single MetaMask Extension testing entrypoint. Routes unit, UI and composed-background integration, and Selenium E2E create/maintain work (flakiness, POM anti-patterns) to the right references. Use when writing, fixing, reviewing, or placing Extension tests; when the user mentions MetaMaskController, FixtureBuilderV2, page objects, E2E flake, POM anti-patterns, or asks which Extension testing skill to install.

License 许可
MIT
所属仓库
MetaMask/skills
最近更新
2026-11-14
Stars
★ 25
Forks
11

01 前言 Front Matter

base
true
name
extension-testing
maturity
stable
description
Single MetaMask Extension testing entrypoint. Routes unit, UI and composed-background integration, and Selenium E2E create/maintain work (flakiness, POM anti-patterns) to the right references. Use when writing, fixing, reviewing, or placing Extension tests; when the user mentions MetaMaskController, FixtureBuilderV2, page objects, E2E flake, POM anti-patterns, or asks which Extension testing skill to install.

02 资源文件 10

03 SKILL.md 正文

Extension testing

One skill for MetaMask Extension functional testing. Classify the task, pick the layer, then open only the matching reference.

Flakiness note: Unlike Mobile (where Jest unit flakiness is a separate skill), Extension E2E flakiness lives inside this skill under references/e2e/flakiness.md — create and maintain share one tree.

When To Use

  • Writing, fixing, or reviewing MetaMask Extension unit, integration, or Selenium E2E tests
  • Choosing the right Extension test layer (unit vs integration vs E2E)
  • Creating or updating page objects, flows, or fixtures (FixtureBuilderV2)
  • Fixing E2E flakes or auditing POM anti-patterns
  • MMQA testing-skills work that targets Extension (for example MMQA-2274)

Out of scope: performance, visual (visual-testing / mm CLI), A/B, i18n, Mobile layers, and cross-layer placement audits (phase 2). Keep those separate.

Prerequisites

  • Consumer repo: MetaMask Extension (metamask-extension)
  • Skill installed via yarn skills / @metamask/skills for testing/extension-testing
  • Familiarity with Extension test layout: colocated *.test.ts(x), test/integration/, app/scripts/metamask-controller*.test.js, test/e2e/
  • For E2E: a test build (yarn build:test or yarn start:test) and Chrome (or Firefox MV2) available

Workflow

1. Choose the layer

Read installed knowledge/extension-testing-layers.md (source: ../../knowledge/extension-testing-layers.md) before writing any test. references/layers.md is only a redirect stub.

2. Open only the matching reference

If the work is… Open
Pure logic / helpers / selectors / isolated controller / narrow RTL unit references/unit.md
Full UI + real Redux under test/integration/, or real MetaMaskController composition under app/scripts/ references/integration.md
Create or update Selenium E2E / POM / fixtures references/e2e.md → writing-tests
Fix flaky E2E or POM bad practices / audit anti-patterns references/e2e.md → maintain / flakiness / pom-antipatterns

Do not read every reference up front. Follow the decision tree in installed knowledge/extension-testing-layers.md, then open nested files only when that doc sends you there.

3. Hard rules

  1. Layer gate first. Prefer unit → integration (only when justified) → E2E. Document why unit is insufficient before proposing new E2E.
  2. Integration has two existing homes. Use test/integration/ for real UI + Redux with mocked background RPC; use app/scripts/metamask-controller*.test.js for real composed-background wiring with external I/O mocked. Do not duplicate every scenario across both homes or invent a new integration tree.
  3. E2E is legitimate for real browser/extension/dapp/window boundaries — do not copy Mobile’s “almost never E2E” gate.
  4. For E2E, inspect existing specs, page objects, flows, and fixtures in the feature folder before proposing code.
  5. E2E POM methods must not use try/catch. Locators belong in page objects, not flows or specs. Specs must not call the driver for UI actions. Avoid hardcoded delays without a justifying comment.
  6. Maintain mode: diagnose with references/e2e/flakiness.md, enforce structure with references/e2e/pom-antipatterns.md. Prefer waits and mocks over retries.
  7. Bugbot is a local safety net only (.cursor/BUGBOT.md), never a PR merge gate — see pom-antipatterns.md. Get the code right in this skill first.

Examples

User: Add a unit test for the deep-link parser helper
Agent: layers → unit → references/unit.md
User: Verify MetaMaskController routes watchAsset through the composed controllers
Agent: layers → integration (composed background) → references/integration.md
User: Verify a Redux-driven confirmation alert without a browser
Agent: layers → integration (UI + state) → references/integration.md
User: Add E2E for connecting the test dapp and confirming a tx
Agent: layers → e2e (dapp/window boundary) → references/e2e.md → writing-tests.md
User: This E2E flakes on window handle / stale element
Agent: references/e2e.md → maintain.md → flakiness.md
User: Audit this PR for POM anti-patterns / try/catch in page objects
Agent: references/e2e.md → pom-antipatterns.md

Troubleshooting

Agent opened every reference

Problem: Context bloat; conflicting guidance.

Solution: Stop after the layer decision. Open only the one row in the Workflow table that matches the task.

E2E proposed for pure logic

Problem: Slow, flake-prone coverage for something unit can own.

Solution: Re-read knowledge/extension-testing-layers.md. Document why unit (and integration, if relevant) cannot cover the case before adding E2E.

POM / Bugbot confusion

Problem: Expecting Bugbot CI on the PR to block POM anti-patterns.

Solution: Follow references/e2e/pom-antipatterns.md while writing. Use local CODEBOT / /review / local Bugbot against .cursor/BUGBOT.md as a backstop — not CI.

Deprecated skill still selected

Problem: Agent loads old e2e-testing, unit-testing, or e2e-flakiness-patterns.

Solution: Those are redirect stubs. Prefer this skill (testing/extension-testing) and re-sync with yarn skills.

Security considerations

  • Do not put secrets, private keys, seed phrases, or API keys in skill files, fixtures committed for demos, or example snippets.
  • E2E fixtures and mocks must not embed production credentials.
  • This skill guides test generation only; it is not an enforcement layer. Pair with local review (.cursor/BUGBOT.md) and normal CI lint/tests for hard gates.

04 同仓库更多 Skills

MetaMask
MetaMask/skills

recipe-plan-and-dispatch

Plan a ticket with the engineer before a recipe fix-bug or dev run. Agree the acceptance criteria and an implementation plan, write it as an approved plan file, and print the prompt that starts the run with any agent and model. Never edits product code or starts the run.

★ 25
MetaMask
MetaMask/skills

recipe-library-audit

Run every recipe of a team recipe library on one client with mm-harness, classify each result with the failing node and exact error, and review naming and composability. Produces a per-client table; changes nothing.

★ 25
MetaMask
MetaMask/skills

recipe-performance

Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.

★ 25
MetaMask
MetaMask/skills

x402-payments

Build x402 payment flows using MetaMask Smart Accounts Kit, machine to machine payments over HTTP with ERC-7710 delegations and ERC-7715 Advanced Permissions

★ 25
MetaMask
MetaMask/skills

smart-accounts-kit

Build dApps with MetaMask Smart Accounts Kit — ERC-4337 smart accounts, delegations, and Advanced Permissions (ERC-7715)

★ 25
MetaMask
MetaMask/skills

oh-my-opencode

Multi-agent orchestration plugin for OpenCode. Use when the user wants to install, configure, or operate oh-my-opencode — including agent delegation, ultrawork mode, Prometheus planning, background tasks, category-based task routing, model resolution, tmux integration, or any oh-my-opencode feature. Covers installation, configuration, all agents (Sisyphus, Oracle, Librarian, Explore, Atlas, Prometheus, Metis, Momus), all categories, slash commands, hooks, skills, MCPs, and troubleshooting.

★ 25