Skip to content

Latest commit

 

History

History
61 lines (39 loc) · 1.53 KB

README.md

File metadata and controls

61 lines (39 loc) · 1.53 KB

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