Guardiantest

Web3 E2E Testing Framework
Alternatives To Guardiantest
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Cypress44,9894,0035,32110 hours ago210July 20, 20231,394mitJavaScript
Fast, easy and reliable testing for anything that runs in a browser.
Javascript Testing Best Practices21,983
a month ago61mitJavaScript
📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (July 2023)
Golang Developer Roadmap16,230
7 months ago22
Roadmap to becoming a Go developer in 2020
Nightwatch11,44422817 hours ago327July 31, 2023222mitJavaScript
Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
Detox10,57832930111 hours ago544August 02, 2023217mitJavaScript
Gray box end-to-end testing and automation framework for mobile apps
Testcafe9,69483073514 hours ago441July 27, 202362mitJavaScript
A Node.js tool to automate end-to-end web testing.
Protractor8,790137,07213,9715 months ago103May 13, 2020682mitJavaScript
E2E test framework for Angular apps
Origin8,3751521811 hours ago76May 31, 2021193apache-2.0Go
Conformance test suite for OpenShift
Gitignore.io7,755
a month ago8mitSwift
Create useful .gitignore files for your project
Cypress Realworld App4,830
2 days ago12mitTypeScript
A payment application to demonstrate real-world usage of Cypress testing methods, patterns, and workflows.
Alternatives To Guardiantest
Select To Compare


Alternative Project Comparisons
Readme

guardianui logo

GuardianTest is an open-source, end-to-end testing framework for web3 developers building on EVM-compatible chains.


Installation

Dependencies

Installing Node.js

  • Check if you already have Node installed by opening a terminal or command prompt instance and executing node -v. You should see a version number in the return.
  • If you do not have Node already installed, go to Node.js and select the version associated with your operating system.

Installing Foundry

  • Check if you already have Anvil installed through Foundry by opening a terminal or command prompt instance and executing anvil -V. You should see a version number in the return. If you do not, follow one of the guides below.

Mac, Linux, and Windows

Docker

CI

Installing GuardianTest

You can install GuardianTest using either npm or yarn:

npm

npm install --save-dev @guardianui/test

yarn

yarn add -D @guardianui/test

Installing Playwright Browsers

You will need to have the latest Playwright browser drivers installed.

npx playwright install

Configuration

Playwright

At your repo's top-level directory create a file called playwright.config.ts. You can find a default configuration in our GuardianTest Configuration Guide

If you already are using Playwright and already have a playwright.config.ts:

  • Add /.*gui.(js|ts|mjs)/ to the testMatch entry to make sure Playwright recognizes our tests
    • If you do not have a testMatch entry in the config, add one like shown in the example below
    • If you have existing Playwright tests that are either named with the testName.spec.ts or testName.test.ts naming conventions make the following your testMatch entry: [/.*gui\.(js|ts|mjs)/, /.*(spec|test)\.(js|ts|mjs)/]
  • Set fullyParallel to false
  • Set workers to 1

env

Create another file called .env in your repo's top-level directory, or add the following to your existing .env file if you already have one. Comment out whichever line you do not use with a # at the start.

# Must fill in one of these API keys; only need one
GUARDIAN_UI_INFURA_API_KEY=
GUARDIAN_UI_ALCHEMY_API_KEY=
GUARDIAN_UI_CHAINSTACK_API_KEY=

package.json

To be able to run tests, add the following to your app's package.json scripts section:

"test:gui": "npx playwright test --project=chromium --headed"

Writing Your First Test

Follow our guide to write your first test


What GuardianTest enables

  • Engage with local deployments, staging deployments, OR live production
  • Perform tests on Ethereum, Polygon, Arbitrum, or Optimism (more coming soon)
  • Pin tests to any block
  • Interact with a site using a wallet
  • Mock ERC20 balances and allowances
  • Validate target contract addresses from app interactions
  • Perform any other actions or validation Playwright offers

Why it's good

  • Does not rely on MetaMask or any other specific wallet where the brittleness of the tests is caused by changes from the wallet provider
  • Creates a closer to production testing environment
    • No modified WAGMI connector
    • Looks like mainnet to the site
  • Enables easy mocking of ERC20 balances and allowances
  • Enables mocking of any other contract state
  • Enables developers to verify wallet interactions
  • Enables developers to test app behavior through a transaction completing

How it works

  • Spins up an Anvil fork of the desired network at the time of test run
  • Uses Playwright to run browser interactions and engage with the site
  • Injects a wallet to the browser that's connected to the Anvil fork
  • Checks eth_sendTransaction and eth_sendRawTransaction RPC requests when instructed to via gui.validateContractInteraction

Documentation

For full documentation and examples, visit the GuardianTest Docs.

Community

Check out the following places for more GuardianUI-related content:

Contributing

If you're interested in contributing, please read the contributing docs before submitting a pull request.

Resources

Popular Testing Projects
Popular End To End Testing Projects
Popular Software Quality Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Typescript
Testing
Blockchain
Ethereum
Dapp
Web3
E2e