Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @tobelabs/chainwright

## 0.11.1

### Patch Changes

- Update the README.md

## 0.11.0

### Minor Changes
Expand Down
42 changes: 20 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Chainwright is an end-to-end testing toolkit for Web3 dapps built on Playwright.

## Requirements

- Node.js `>=22`
- `@playwright/test@1.61.1` (peer dependency)
- Node.js `>=22.18`
- `@playwright/test@1.62.1` (peer dependency)

## Operating Systems
Supports the following operating systems:
Expand Down Expand Up @@ -77,7 +77,7 @@ yarn add -D chainwright @playwright/test

### 1. Create wallet setup files

Create a setup directory (default: `tests/wallet-setup`) and add `*.setup.ts` files with a wallet name in the filename, for example:
Create a setup directory (default: `tests/wallet-setup`) and add files with a `*.setup.ts` domain in the filename, for example:

- `base.setup.ts`
- `base-two.setup.ts`
Expand Down Expand Up @@ -145,9 +145,9 @@ export default defineWalletSetup(
);
```

To support multiple profiles in a single wallet (for example, MetaMask), only setup files from the second profile onward need an explicit, distinct profile name.
To support multiple profiles in a single wallet (for example, MetaMask), only setup files from the second profile onward need a distinct profile name.

`main.setup.ts` can use the default profile, while `main-two.setup.ts` (and any additional setup files) should declare a unique profile name. Then, in any fixture that should use that profile, pass the exact `profileName` value.
`main.setup.ts` can use the default profile, while `main-two.setup.ts` (and any additional setup files) should declare a unique profile name. Then, in any fixture that should use that profile, pass the exact `profileName`.

Example:
- `main.setup.ts`: uses the default profile
Expand Down Expand Up @@ -192,7 +192,7 @@ These are Chainwright's wallet extensions and their versions:
- **Phantom**: v26.10.0 [Source](https://github.com/amaify/chainwright/releases/tag/v0.1.0)
- **Solflare**: v2.19.1 [Source](https://github.com/amaify/chainwright/releases/tag/v0.1.0)
- **Meteor**: v0.7.0 [Source](https://github.com/amaify/chainwright/releases/tag/v0.1.0)
- **Keplr**: v0.13.39 [Source](https://github.com/chainapsis/keplr-wallet/releases/tag/v0.13.39)
- **Keplr**: v0.13.39 [Source](https://github.com/amaify/chainwright/releases/tag/v0.1.0)

Example:

Expand Down Expand Up @@ -248,8 +248,6 @@ bun chainwright --metamask --force

# Overriding multiple existing wallet cache during setup
bun chainwright --wallets metamask phantom petra --force

# NOTE: These command will work with other package managers. npm, pnpm, and yarn.
```

To specify a directory:
Expand All @@ -258,7 +256,7 @@ To specify a directory:
bun chainwright <directory path> <wallet>

Example:
bun chainwright ./src/e2e/your-tests --metamask
bun chainwright ./src/e2e/setup-files --metamask
```

Useful flags:
Expand Down Expand Up @@ -326,7 +324,7 @@ const testWithFixture = testWithChainwright(fixture({ profileName: "profile name

## Worker-Scoped Fixture

Use worker-scoped fixtures when tests in a `test.describe()` block can safely share a wallet context. Setup and teardown run once per worker instead of per test, which speeds up CI runs and reduces flakiness caused by repeated wallet initialization.
Use worker-scoped fixtures when you want your tests to share the same wallet context. Setup and teardown run once per worker instead of per test, which speeds up CI runs and reduces flakiness caused by repeated wallet initialization.

```ts
import { type Page } from "@playwright/test";
Expand Down Expand Up @@ -396,6 +394,9 @@ jobs:
test:
runs-on: ubuntu-22.04
timeout-minutes: 60
strategy:
matrix:
node-version: [24]

steps:
- name: Checkout code
Expand All @@ -405,18 +406,15 @@ jobs:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v5
with:
version: 10

- name: Use Node LTS
uses: actions/setup-node@v6
uses: pnpm/setup@v2
with:
node-version: 24.x
cache: "pnpm"
runtime: node@${{ matrix.node-version }}
version: 11
install: false
cache: true

- name: Install dependencies
run: pnpm install
run: pnpm install --no-frozen-lockfile

- name: Install XVFB
run: sudo apt-get install -y xvfb
Expand Down Expand Up @@ -468,9 +466,9 @@ Extra Phantom/Solflare fixtures:
defineWalletSetup(password, setupFn, config?)
```

- `password: string` - wallet unlock password saved in cache metadata
- `setupFn: ({ context, walletPage }) => Promise<void>` - runs onboarding/import flow
- `config?: { profileName?: string; slowMo?: number, extensionSource?: {...} }` - useful for setting up multiple wallet profiles, running the setup in slow motion `slowMo` and using a custom extension source.
- `password: string` - wallet unlock password saved as a `.txt` file in the wallet cache
- `setupFn: ({ context, walletPage }) => Promise<void>` - runs onboarding/setup flow
- `config?: { profileName?: string; slowMo?: number, extensionSource?: {downloadUrl: "...", localPath: "...", sha256: "..."} }` - useful for setting up multiple wallet profiles, running the setup in slow motion `slowMo` and using a custom extension source.

### `testWithChainwright`

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chainwright",
"version": "0.11.0",
"version": "0.11.1",
"description": "Playwright Web3 wallet testing framework for end-to-end dApp automation with MetaMask, Phantom, Solflare, Petra, Meteor, and Keplr",
"type": "module",
"license": "MIT",
Expand Down
Loading