Skip to content

yivlad/testing-wagmi

 
 

Repository files navigation

testing wagmi

Quick example of how to write tests for wagmi using React Testing Library and Playwright.

Getting started

  1. Clone repository and install dependencies:
pnpm install
  1. Install Anvil to run local Ethereum node.
  2. Add environment variables from .env.example (recommened to use direnv)
  3. Run dev server
pnpm dev

Unit/integration tests

Unit and integration tests are run by Vitest and rendered with a custom render function from React Testing Library. See components/Connect.test.tsx and components/SendTip.test.tsx for more info.

Run

  1. Start Anvil in terminal session
pnpm anvil
  1. Start Vitest in watch mode in different terminal session
pnpm test

End-to-end tests

End-to-end tests use Playwright. See test/pages/index.test.ts for more info.

Run

  1. Start Anvil in terminal session
pnpm anvil
  1. Start dev server in different terminal session (make sure NEXT_PUBLIC_PLAYWRIGHT_ENABLED is set to true)
pnpm dev
  1. Start Playwright test runner
pnpm test:e2e

About

Example of how to write tests for wagmi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 89.8%
  • CSS 9.5%
  • JavaScript 0.7%