# metamask-testing-tools

> This is a collection of tools for testing metamask, metamask flask and metamask snaps.

Latest version **2.3.1** (published 2026-05-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install metamask-testing-tools
pnpm add metamask-testing-tools
yarn add metamask-testing-tools
bun add metamask-testing-tools
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.3.1 |
| Published | 2026-05-08 |
| First published | 2023-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20 |
| Dependencies | 8 |
| Unpacked size | 51.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | Hugo Dias <hugomrdias@gmail.com> (hugodias.me) |
| Maintainers | hugomrdias |
| Keywords | metamask, testing, snap, flask, playwright |

## Links

- npm: https://www.npmjs.com/package/metamask-testing-tools
- Repository: hugomrdias/metamask
- Homepage: https://github.com/hugomrdias/metamask/tree/main/packages/tools
- npm.io page: https://npm.io/package/metamask-testing-tools

## Dependencies (8)

- [conf](https://npm.io/package/conf.md) ^15.0.2
- [fflate](https://npm.io/package/fflate.md) ^0.8.2
- [p-retry](https://npm.io/package/p-retry.md) ^8.0.0
- [p-wait-for](https://npm.io/package/p-wait-for.md) ^6.0.0
- [eth-rpc-errors](https://npm.io/package/eth-rpc-errors.md) ^4.0.3
- [@playwright/test](https://npm.io/package/@playwright/test.md) ^1.57.0
- [@metamask/providers](https://npm.io/package/@metamask/providers.md) ^22.1.1
- [@metamask/snaps-utils](https://npm.io/package/@metamask/snaps-utils.md) ^12.2.0

## Alternatives

- [@snazzah/davey](https://npm.io/package/@snazzah/davey.md) — 1.5M weekly downloads
- [@vendure/testing](https://npm.io/package/@vendure/testing.md) — 8.3K weekly downloads
- [vue-simple-context-menu](https://npm.io/package/vue-simple-context-menu.md) — 6.6K weekly downloads
- [cypress-webpack-preprocessor-v5](https://npm.io/package/cypress-webpack-preprocessor-v5.md) — 2.1K weekly downloads
- [@backstage/plugin-catalog-backend-module-puppetdb](https://npm.io/package/@backstage/plugin-catalog-backend-module-puppetdb.md) — 1.3K weekly downloads

## Recent versions

- 2.3.1 (latest) — 2026-05-08
- 2.3.0 — 2026-01-09
- 2.2.10 — 2025-11-15
- 2.2.9 — 2025-10-29
- 2.2.8 — 2025-09-29
- 2.2.7 — 2025-09-01
- 2.2.6 — 2025-08-01
- 2.2.5 — 2025-07-24
- 2.2.4 — 2025-07-08
- 2.2.3 — 2024-12-28
- 2.2.2 — 2024-10-29
- 2.2.1 — 2024-10-28
- 2.2.0 — 2024-10-28
- 2.1.0 — 2024-10-24
- 2.0.1 — 2024-09-03
- … 26 more at https://npm.io/package/metamask-testing-tools/versions

## README

# metamask-testing-tools

This is a collection of tools for testing metamask, metamask flask and metamask snaps with [Playwright](https://playwright.dev/).

## Install

```bash
pnpm add metamask-testing-tools -D
```

## Usage

This package is meant to be used with [Playwright](https://playwright.dev/). It provides a `createFixture` function that returns a `test` and `expect` function that can be used to write tests.

More information on writing tests with Playwright can be found [here](https://playwright.dev/docs/test-intro).

```js
// tests.spec.js

import { createFixture } from 'metamask-testing-tools'

const { test, expect } = createFixture({
  download: {
    flask: true,
  },
  snap: {
    snapId: 'npm:@filsnap',
  },
})

test('should get address mainnet', async ({ metamask, page }) => {
  const result = await metamask.invokeSnap({
    request: {
      method: 'fil_getAddress',
    },
    page,
  })

  expect(result).toBe('f1jbnosztqwadgh4smvsnojdvwjgqxsmtzy5n5imi')
})
```

## Docs

Check <https://hugomrdias.github.io/filsnap-testing/modules/metamask_testing_tools.html>

## ENV variables

These variables can be used to override the default values.

- `GITHUB_TOKEN` - GitHub API token to download metamask from github releases.
- `METAMASK_TAG` - Tag of metamask to download. Defaults to `latest`.
- `METAMASK_MNEMONIC` - Seed to use for metamask.
- `METAMASK_PASSWORD` - Password to use for metamask.
- `METAMASK_SNAP_ID` - Snap ID to use for metamask.
- `METAMASK_SNAP_VERSION` - Snap version to use for metamask.

---
_Source: https://npm.io/package/metamask-testing-tools · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
