Skip to content

๐ŸŒ๐Ÿผโ€E2E testing for dApps using Puppeteer + MetaMask

License

Notifications You must be signed in to change notification settings

TuMicro/dappeteer

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

dAppeteer

E2E testing for dApps using Puppeteer + MetaMask

Installation

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

Usage

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

async function main() {
  const [metamask, page] = await dappeteer.bootstrap(puppeteer, { metamaskVersion: 'v10.15.0' });

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

  // you can import a token
  await metamask.addToken({
    tokenAddress: '0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa',
    symbol: 'KAKI',
  });

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

  // ๐ŸŒ
  await metamask.confirmTransaction();
}

main();

About

๐ŸŒ๐Ÿผโ€E2E testing for dApps using Puppeteer + MetaMask

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 89.1%
  • JavaScript 9.3%
  • HTML 1.3%
  • Solidity 0.3%