This is an example repository for writing E2E tests for wagmi apps with Playwright.
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
).
- Install Foundry
- Install the dependencies with
npm install
- Define the required environment variables in an
.env
file - Run the dev server with
npm run dev
(or it withnpm run build
) - Run the tests with
npm run test
(you can also run tests in ui or debug mode with thetest:ui
ortest:debug
scripts)
This solution is heavily inspired by Thiago Brezinski's and Rommert Zijlstra's solution. I highly recommend reading these articles!