Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Puppeteer | 84,633 | 12,128 | 14,026 | 10 hours ago | 828 | July 20, 2023 | 270 | apache-2.0 | TypeScript | |
Node.js API for Chrome | ||||||||||
Codeceptjs | 3,962 | 215 | 186 | 12 hours ago | 173 | August 05, 2023 | 341 | mit | JavaScript | |
Supercharged End 2 End Testing Framework for NodeJS | ||||||||||
Qawolf | 3,209 | 2 | 14 | 7 months ago | 30 | February 24, 2020 | other | TypeScript | ||
🐺 Create browser tests 10x faster | ||||||||||
Puppeteer Examples | 2,377 | 3 years ago | 14 | apache-2.0 | JavaScript | |||||
Puppeteer example scripts for running Headless Chrome from Node. | ||||||||||
Reactopt | 1,970 | 4 | 1 | 6 years ago | 24 | December 07, 2017 | 9 | JavaScript | ||
A CLI React performance optimization tool that identifies potential unnecessary re-rendering | ||||||||||
Awesome Regression Testing | 1,944 | a month ago | 3 | cc-by-sa-4.0 | ||||||
🕶️ A curated list of resources around the topic: visual regression testing | ||||||||||
Ui Testing Best Practices | 1,502 | 4 months ago | 3 | cc-by-sa-4.0 | ||||||
The largest UI testing best practices list (last update: March 2023) | ||||||||||
Awesome Jest | 1,385 | a day ago | mit | |||||||
🕶Awesome Jest packages and resources | ||||||||||
Puphpeteer | 1,319 | 15 | 12 | 9 months ago | 13 | December 01, 2020 | 64 | mit | PHP | |
A Puppeteer bridge for PHP, supporting the entire API. | ||||||||||
Spearmint | 1,249 | 11 days ago | 5 | mit | TypeScript | |||||
Testing, simplified. || An inclusive, accessibility-first GUI for generating clean, semantic Javascript tests in only a few clicks of a button. |
You can find active and updated fork at chainsafe/dappeteer
E2E testing for dApps using Puppeteer + MetaMask
$ npm install -s dappeteer
import puppeteer from 'puppeteer'
import dappeteer from 'dappeteer'
async function main() {
const browser = await dappeteer.launch(puppeteer)
const metamask = await dappeteer.getMetamask(browser)
// create or import an account
// await metamask.createAccount()
await metamask.importAccount('already turtle birth enroll since...')
// you can change the network if you want
await metamask.switchNetwork('ropsten')
// 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()
dappeteer.launch(puppeteer[, launchOptions])
: returns an instance of browser
, same as puppeteer.launch
, but it also installs the MetaMask extension. It supports all the regular puppeteer.launch
options as a second argument with the addition of two extra ones:
metamaskPath
: Path to the MetaMask extension (by default it uses the one bundled)
extensionUrl
: URL of the MetaMask extension, by default it is chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/popup.html
but if you use a different version you might need to change it use the right extension id.
dappeteer.getMetaMask(browser)
: returns a promise that resolves to an object that allows you to interact with MetaMask by using the following methods:
metamask.createAccount([password])
: it commands MetaMask to create a new account, it resolves when it's done. It can only be used while you haven't signed in yet, otherwise it throws. The password is optional, it defaults to password1234
.
metamask.importAccount(seed[, password])
: it commands MetaMask to import an account, you need to provide the twelve words seed. It can only be used while you haven't signed in yet, otherwise it throws. The password is optional, it defaults to password1234
.
metamask.switchAccount(accountIndex)
: it commands MetaMask to switch to a different account, by passing the index/position of the account in the accounts list.
metamask.importPK(privateKey)
: it commands MetaMask to import an private key. It can only be used while you haven't signed in yet, otherwise it throws.
metamask.lock()
: signs out from MetaMask. It can only be used if you arelady signed it, otherwise it throws.
metamask.unlock([password])
: it unlocks the MetaMask extension. It can only be used in you locked/signed out before, otherwise it throws. The password is optional, it defaults to password1234
.
metamask.switchNetwork(networkName)
: it changes the current selected network. networkName
can take the following values: "main"
, "ropsten"
, "rinkeby"
, "kovan"
, "localhost"
.
metamask.addNetwork(url)
: it adds a custom network to MetaMask.
metamask.confirmTransaction([{ gas, gasLimit }])
: commands MetaMask to submit a transaction. For this to work MetaMask has to be in a transaction confirmation state (basically promting the user to submit/reject a transaction). You can (optionally) pass an object with gas
and/or gasLimit
, by default they are 20
and 50000
respectively.
metamask.sign()
: commands MetaMask to sign a message. For this to work MetaMask must be in a sign confirmation state.
metamask.approve()
: enables the app to connect to MetaMask account in privacy mode