Skip to content

BrickheadJohnny/wagmi-playwright-example

Repository files navigation

Wagmi & Playwright example

This is an example repository for writing E2E tests for wagmi apps with Playwright.

Getting started

We've created a Test Client, passed it to the wagmiConfig & used the Mock connector in the tests. Before running the tests we spin up an Anvil node, so we can use it in our tests for onchain interactions (see the webServer property in playwright.config.ts).

  1. Install Foundry
  2. Install the dependencies with npm install
  3. Define the required environment variables in an .env file
  4. Run the dev server with npm run dev (or it with npm run build)
  5. Run the tests with npm run test (you can also run tests in ui or debug mode with the test:ui or test:debug scripts)

Credits

This solution is heavily inspired by Thiago Brezinski's and Rommert Zijlstra's solution. I highly recommend reading these articles!

About

Testing wagmi apps with Playwright and Anvil

Topics

Resources

Stars

Watchers

Forks