@coti-cvi/dappeteer
TypeScript icon, indicating that this package has built-in type declarations

2.5.4 • Public • Published

dAppeteer

E2E testing for dApps using Puppeteer + MetaMask

Installation

$ npm install -s @yovelsapir/dappeteer
$ yarn add @yovelsapir/dappeteer

Usage

import puppeteer from 'puppeteer';
import dappeteer from '@yovelsapir/dappeteer';

async function main() {
  const browser = await dappeteer.launch(puppeteer, { metamaskVersion: 'v10.14.0' });
  const metamask = await dappeteer.setupMetamask(browser);

  // you can change the network if you want
  await metamask.switchNetwork('ropsten');

  // you can import a token
  await metamask.addToken('0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa');

  // go to a dapp and do something that prompts MetaMask to confirm a transaction
  const page = await browser.newPage();
  await page.goto('http://my-dapp.com');
  const payButton = await page.$('#pay-with-eth');
  await payButton.click();

  // 🏌
  await metamask.confirmTransaction();
}

main();

Package Sidebar

Install

npm i @coti-cvi/dappeteer

Weekly Downloads

1

Version

2.5.4

License

MIT

Unpacked Size

66.6 MB

Total Files

826

Last publish

Collaborators

  • davidhct1
  • yonine
  • vladi-coti
  • stav-coti