Open source · MIT · for Playwright and Vitest

The wallet that does what your test says.

A real Wallet Standard wallet your dApp lists next to Phantom — except the approve button is a line in your Playwright test. Connect, sign, send, cancel, fail, switch accounts. In CI. No extension, no devnet.

npm i -D @solana-e2e/wallet @solana-e2e/playwright
A line of test code, wallet.rejectNext(), is tied by strings to a wallet popup whose Reject button presses itself; a toast says the user rejected the request and the test passed.

Everyone writes their own

Four GitHub code searches (1, 2, 3, 4) return more than 100 files of hand-written Wallet Standard mocks injected into Playwright, across dozens of repositories — including Uniswap and ZeroDev — and none of them is a reusable package.

FeatureDriving a real extensionHand-written mocksolana-e2e
No extension download, runs headlessNoYesYes
signAndSendTransaction, signInYesRarelyYes
Reject, fail, approve from the testThrough popupsIf you write itOne line each
Several accounts, change eventsYesRarelyYes
Transaction checked on a local chainNeeds setupRarelyFixture included
Maintained once, for everyonePopups changeCopied per reponpm package

Playground

A small dApp and, next to it, the real @solana-e2e/wallet running in this tab in mock mode, with the buttons a test would press. Every click becomes a line of the Playwright spec below. Nothing leaves your browser unless you point the wallet at your own local chain.

Loading the test wallet…

How it works

In mock mode the request stops at the TestWallet: it signs and answers, and nothing is sent. In rpc mode it continues to Surfpool. The playground above skips the Playwright bridge: the shell and the TestWallet both run inside your tab.

Hover or tap a step to follow it in the diagram.

What you can test now

  • The user cancels

    wallet.rejectNext({ method: "signMessage" })
  • The wallet or the network fails

    wallet.failNext({ code: -32002, message: "Blockhash not found" })
  • A request waits for approval

    wallet.setApproval("manual"); … wallet.approve()
  • The user switches account mid-flow

    wallet.switchAccount("bob")
  • A wallet without sign-and-send

    { disabledFeatures: ["solana:signAndSendTransaction"] }
  • An unsupported transaction version

    { supportedTransactionVersions: ["legacy", 0] }
  • autoConnect on an untrusted site (the default)

    { trusted: false }
  • An extension that loads late

    installTestWallet(page, { late: true })

Two modes

mock

Signs for real, sends nothing. For UI tests and for Vitest + jsdom, where registerTestWallet() replaces a hand-written mock-wallet.ts.

const { wallet } = await registerTestWallet({ accounts: ["alice"] });

rpc

Signs, sends to a local RPC and waits for the commitment. With @solana-e2e/playwright you get a Surfpool chain per worker and a funded wallet per test.

const tx = await localnet.getTransaction(signature);
expect(tx.logs).toContain("Program log: hello");

In CI

Mock-mode specs need nothing but Playwright. For rpc mode, install Surfpool from its release and check the archive's sha256; the full GitHub Actions recipe is in docs/ci.md. This project's own CI runs both kinds on Linux, macOS and Windows.

Limitations

  • The Playwright transport is a bridge to Node, so the injected wallet does not work as is in Cypress or Storybook. In-page use, like this playground, works for mock mode.
  • Chromium is tested in CI for the packages; this site is also tested in WebKit.
  • One visible account at a time, as in Phantom.
  • It is a test tool: never give it a key that holds real funds.