1.2.1 • Published 2 months ago

metamask-testing-tools v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

metamask-testing-tools

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

Note: Currently metamask >= v10.28.0 is not supported.

Install

pnpm add metamask-testing-tools -D

Usage

This package is meant to be used with Playwright. 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.

// 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.
1.2.1

2 months ago

1.2.0

2 months ago

1.1.9

8 months ago

1.1.8

8 months ago

1.1.7

8 months ago

1.1.10

8 months ago

1.1.6

8 months ago

1.1.1

10 months ago

1.0.2

11 months ago

1.1.0

10 months ago

1.0.1

11 months ago

1.0.0

11 months ago

1.1.5

9 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

1.0.3

10 months ago

0.1.1

1 year ago

0.1.0

1 year ago