|
| 1 | +# demo-wallet E2E |
| 2 | + |
| 3 | +Playwright end-to-end tests for the demo-wallet. The suite is **mock-first**: it runs against |
| 4 | +mocked wallet data and never spends real funds, so it is safe to run on every push. |
| 5 | + |
| 6 | +## Layout |
| 7 | + |
| 8 | +| Path | What | |
| 9 | +|------|------| |
| 10 | +| `ui-tests/` | UI specs (onboarding, dashboard, assets, NFT, history, send, swap, staking, amount formatting). Mock-first — wallet data is stubbed via `page.route`. Web-only flows opt into the `webOnly` fixture and skip in extension mode. | |
| 11 | +| `mocks/walletApi.ts` | `page.route` mocks for the wallet's API (Toncenter v3 + rates), plus transfer-emulation / seqno helpers used by the TON Connect transaction flow. | |
| 12 | +| `mock-dapp/` | A **self-contained TON Connect dApp** test fixture (raw `@tonconnect/sdk`) served by Vite on `127.0.0.1:5175`. It exposes connect / sendTransaction / signData / signMessage behind buttons and surfaces every result into DOM test ids. Not product code. | |
| 13 | +| `mock-dapp-tests/` | Two-tab TON Connect specs: the mock dApp (tab 1) drives the redesigned wallet (tab 2) over the real bridge. Each asserts the modal copy + actions and the protocol response. | |
| 14 | +| `ton-connect/` | Drivers for the mock-dApp suite — `MockDapp.ts` (dApp page object) and `mockDappFixture.ts` (two-tab fixture). | |
| 15 | +| `demo-wallet/DemoWallet.ts` | The wallet page object (onboarding, the four TON Connect request modals, internal send). | |
| 16 | +| `pages/`, `qa/` | Wallet page objects and low-level helpers (context launch, extension id, etc.). | |
| 17 | + |
| 18 | +## Configs |
| 19 | + |
| 20 | +| Config | Runs | Servers | |
| 21 | +|--------|------|---------| |
| 22 | +| `e2e.config.ts` (default, `pnpm e2e`) | `ui-tests/**` only | demo-wallet dev server | |
| 23 | +| `e2e.mockdapp.config.ts` | `mock-dapp-tests/**` | mock dApp `:5175` + demo-wallet `:5173` | |
| 24 | + |
| 25 | +The default config `testIgnore`s the two-tab suite (it has its own servers) and the quarantined |
| 26 | +runner specs (see below), so `pnpm e2e` is just the fast mock-first UI suite. |
| 27 | + |
| 28 | +## Running locally |
| 29 | + |
| 30 | +```bash |
| 31 | +# Build the workspace deps the app needs (the full `pnpm build` is not required): |
| 32 | +pnpm --filter @ton/walletkit build && pnpm --filter @demo/wallet-core build |
| 33 | + |
| 34 | +cd apps/demo-wallet |
| 35 | + |
| 36 | +# UI suite (headless): |
| 37 | +ENABLE_HEADLESS=true pnpm e2e |
| 38 | + |
| 39 | +# TON Connect two-tab mock-dApp suite: |
| 40 | +ENABLE_HEADLESS=true npx playwright test --config e2e.mockdapp.config.ts |
| 41 | +``` |
| 42 | + |
| 43 | +`WALLET_MNEMONIC` (a throwaway test seed) is read from `apps/demo-wallet/.env` (gitignored). |
| 44 | +Kill stray dev servers on `:5173` / `:5175` before re-running. |
| 45 | + |
| 46 | +## How the TON Connect suite stays fund-free |
| 47 | + |
| 48 | +`sendTransaction` / `signMessage` would normally need a funded wallet and would broadcast |
| 49 | +on-chain. The suite avoids both: |
| 50 | + |
| 51 | +- **Mocked balance** (`mockWalletApi`) so the wallet's balance guard lets the request through |
| 52 | + and the modal renders. |
| 53 | +- **`VITE_DISABLE_NETWORK_SEND=true`** — the wallet signs and returns the response to the dApp |
| 54 | + over the bridge but skips the on-chain broadcast. No funds move. |
| 55 | + |
| 56 | +The connect handshake and every request ride the real TON Connect bridge. |
| 57 | +`VITE_DISABLE_MANIFEST_DOMAIN_CHECK=true` lets the wallet accept the local mock-dApp manifest |
| 58 | +(served from `127.0.0.1`, which must be dotted — `localhost` is rejected by the manifest host |
| 59 | +guard). |
| 60 | + |
| 61 | +## Allure / TestOps |
| 62 | + |
| 63 | +- The reporter is `allure-playwright`. Cases are matched to TestOps by a **stable `historyId`** |
| 64 | + (the describe chain + test title, set in a shared `beforeEach`), so there is no manual |
| 65 | + `@allureId` pinning: new tests auto-create a case on launch close and survive line shifts and |
| 66 | + file moves. |
| 67 | +- Wrap logical operations in `allure.step('…')` (see `DemoWallet.ts`) so the TestOps execution |
| 68 | + reads as named steps rather than raw Playwright actions. |
| 69 | +- Upload runs in CI only, via secrets — no TestOps endpoint or token lives in this repo. |
| 70 | + |
| 71 | +## Quarantined specs |
| 72 | + |
| 73 | +`connect.spec.ts`, `signData.spec.ts`, `localSendTransaction.spec.ts` and `sendTransaction/**` |
| 74 | +drive an external test-runner backend that is currently unavailable. They are excluded via |
| 75 | +`testIgnore` in `e2e.config.ts` to keep CI within its time budget; re-enable them once that |
| 76 | +backend is restored. |
0 commit comments