Wallet dapp E2E testing
Use @wallets-e2e/core with the appropriate wallet driver to exercise the real browser extension and
the real dapp. Preserve the consuming project's framework, package manager, selectors, server
command, and test conventions; this skill supplies the wallet lifecycle and evidence model.
A wallet-touching feature is not finished when the code compiles. It is finished when a real extension has driven it and left video plus screenshots a reviewer can watch.
Get the packages first
- Project home and issues: github.com/yehia67/e2e-wallets
- Core package: npmjs.com/package/@wallets-e2e/core
- MetaMask package: npmjs.com/package/@wallets-e2e/metamask
- Leather package: npmjs.com/package/@wallets-e2e/leather
- MCP server (how agents run the suite and collect artifacts): npmjs.com/package/@wallets-e2e/mcp
core 0.2.0, metamask 0.2.1, leather 0.1.4, evidence 0.1.0 and mcp 0.2.1 are the
mutually compatible set. Install that set; never substitute repository source for the public
package. Recheck registry metadata rather than trusting this note to stay current.
For a normal consuming application, start with
references/package-consumer-examples.md. Its examples use
only public @wallets-e2e/* imports and a caller-owned unpacked extension path. Do not make package
users copy implementation files or adapt repository fixtures as an installation method.
Prefer the MCP when it is connected
If the wallets-e2e MCP tools (list_guides, start_run, get_run, get_report) are available,
use them instead of shelling out to Playwright:
get_guidefeature-to-test, then the wallet guide.- Write the test against published packages.
list_projects→start_run(it returns arunIdimmediately; a testnet tx can take ~10 minutes).- Poll
get_run.executed=0is a failure. get_reporton every finished run, pass or fail. Hand the HTML report, videos, and screenshots to the reviewer.get_reportembeds representative screenshots;get_artifactfetches extras.
For video setup and review, read references/setup-and-reporting.md
before running the suite. The video attachment is an mp4 of full-size frames built from
screenshots (FFmpeg with libx264 on PATH or artifacts.ffmpegPath); videoSource: 'chromium'
keeps Playwright's WebM recordings composed app → wallet → app, which crop the page once a wallet
popup has opened. Show the video directly when the client supports local video playback;
otherwise link it and the HTML report, or build the evidence site (get_report with
evidence: true). Verify the complete requested journey in the video: a connection-only clip does
not prove an approve/deposit flow. Prove every write with settleWrite (hash → receipt → state).
If those tools are missing, tell the user to add:
{
"mcpServers": {
"wallets-e2e": {
"command": "npx",
"args": ["-y", "@wallets-e2e/mcp"],
"env": {
"WALLETS_E2E_MCP_ROOT": "/absolute/path/to/this/dapp",
"WALLETS_E2E_SEED_PHRASE": "throwaway test wallet",
"WALLETS_E2E_ETH_ADDRESS": "0x...",
"WALLETS_E2E_PASSWORD": "..."
}
}
}
}Then fall back to npx playwright test / npx playwright show-report with the same honesty rules.
When to use this skill
Most often you reach this skill immediately after building something, not as a separate testing task. Example: "develop a USDC deposit feature" means implement the frontend and contracts, then prove a real MetaMask approval and deposit with video of the popups and a mined receipt.
Start at references/feature-to-test.md. It is the workflow every other reference plugs into: name the flow, add test ids, write the test, assert on the chain, run it through the MCP, read the artifacts, fix, re-run.
Route the task
Read only the references needed for the requested work:
- You just finished a feature and need to cover it — read references/feature-to-test.md first, then the wallet-specific reference below.
- For fixture setup, Playwright configuration, videos, screenshots, traces, HTML reports, CI uploads, and artifact review, read references/setup-and-reporting.md.
- For copy-ready npm/pnpm installation and tests in an application that consumes the packages, read references/package-consumer-examples.md.
- For MetaMask, EVM networks, Sepolia, ETH, arbitrary contract interactions, ERC20 approval, EIP-712/EIP-2612 signatures, deposits, custom RPCs, and injected-provider receipt polling, read references/metamask-evm.md.
- For Leather, Stacks networks, message signing, STX transfers, contract calls, and Stacks receipt polling, read references/leather-stacks.md.
- For
.featurefiles andplaywright-bdd, read references/bdd.md. - When a popup, connection, RPC, artifact, or timeout behaves unexpectedly, read references/troubleshooting.md.
Agent workflow
Inspect the repository before editing. Find the Playwright config, fixtures, dapp server command, wallet package, extension build path, test selectors, environment-variable convention, and existing focused tests. Reuse them rather than creating a parallel harness. If the package is absent, install a verified compatible public release. If none exists, report that blocker instead of cloning or linking toolkit source. Reuse existing local environment variables, funded test wallets, and deployed contracts. Check the project's deployment-address configuration before considering new deployment or wallet setup. Do not regenerate wallets, redeploy contracts, or replace the real example flow with a synthetic recording harness when the user wants evidence from their existing tests.
Identify the chain and wallet explicitly: MetaMask takes an
EvmNetwork; Leather takes a supported Stacks network. Do not infer a live network from an RPC URL or dapp label.Separate non-spending smoke coverage from live-chain spending coverage. Import, network, and connect tests should run without spending. Gate transfers and contract writes behind the repository's explicit opt-in environment variable.
Implement the smallest complete user journey. A reliable wallet flow is:
import → navigate dapp → select network → connect → trigger wallet action → approve/sign → wait for receipt → assert dapp and chain stateRun focused tests through the MCP when it is connected (
start_run/get_run/get_report). Otherwise use the project's package manager. Do not report success for a command that was skipped, not run, or intentionally failed. An intentional failure is valid only for proving failure artifacts and must be labelled as such.Generate review evidence on every finished run: preserve the HTML report, videos, screenshots, traces, and a short result summary with exact paths. Visually inspect relevant frames/screenshots; file existence alone does not prove that a wallet or dapp was recorded. Give those artifacts to the human reviewer so they can watch the real transactions.
Non-negotiable invariants
- Use
createExtensionTestfor the extension-loaded persistent context and cleanup. UsewithWalletReportingfor the list plus unfiltered HTML reporters and artifact defaults. - Put every dapp-side action that opens a wallet window inside the driver method's
triggercallback. The driver begins listening before invoking the callback. Clicking earlier creates the classic “popup appeared but the test timed out” race. - Import once per fresh profile and switch the wallet to the intended network before connecting or submitting a chain-aware action.
- Use the action matching the wallet screen, not the contract name:
connectToDappfor connection;confirmTransactionfor any standard on-chain transaction/contract write; MetaMaskapproveTokenPermissiononly for its specialized ERC20 allowance screen; andconfirmSignaturefor EIP-712/EIP-2612 signatures. Contract reads require no wallet confirmation. - Never treat popup closure, a dapp hash, or a pending receipt as success. Wait for mining, fail on a reverted/aborted result, then assert a meaningful state change. Wait for every dependent transaction before starting the next operation.
- For browser EVM reads and receipts, prefer
createInjectedEvmRpc(page)so the test uses the exact provider and network active in MetaMask. HTTP RPC resolution is for deployment scripts or callers that explicitly require it. - Never log, embed, commit, attach, or publish a valuable seed phrase/private key. Use a dedicated throwaway fixture wallet loaded from local environment variables. Treat videos, screenshots, and traces as sensitive because onboarding may record secret entry.
- Live-chain tests consume gas and tokens. Do not fund, deploy, transfer, approve, or deposit without the user's scope or the repository's explicit opt-in gate.
- Keep tests observable: assert the imported address, active chain, connected address, transaction hash shape, mined status, and balance/state delta appropriate to the flow.
- Do not run Git write operations on the user's behalf. Leave staging, commits, branches, merges, rebases, resets, stashes, tags, cleaning, and pushes to the user; use read-only Git inspection only.
- All user-facing setup and code examples must consume public package entrypoints. Repository source, workspace dependencies, internal scripts, and monorepo example paths are contributor concerns and must not be presented as a user installation path.
Completion standard
A wallet E2E change is complete only when the requested behavior is implemented, focused tests have actually run, dependent type/build checks pass, and the retained evidence answers what happened in the dapp and wallet. Report the exact pass/fail/skip counts, identify any spending tests not run, and give the reviewer the HTML report plus video and screenshot paths.