-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b554ca
commit 564dd16
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Wallet Mock | ||
Fully functional E2E tests for your dApp. Installs a fully operational Mock Wallet into the [Playwright](https://github.com/microsoft/playwright) Browser Context, making it discoverable through [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) and leveraging [viem](https://github.com/wevm/viem) `Account` and `Transport` interfaces. | ||
|
||
## Quickstart | ||
```ts | ||
import { installMockWallet } from "@johanneskares/mock-wallet"; | ||
import { privateKeyToAccount } from "viem/accounts"; | ||
import { http } from "viem"; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await installMockWallet({ | ||
page, | ||
account: privateKeyToAccount( | ||
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", | ||
), | ||
transport: http(), | ||
}); | ||
}); | ||
|
||
test("Your Test", async ({ page }) => { | ||
... | ||
}); | ||
``` | ||
|
||
Please note! This will execute actual transactions on the blockchain using the Private Key. You can use a [Custom Transport](https://viem.sh/docs/clients/transports/custom.html) to intercept the behavior. | ||
|