test(demo-wallet): redesign e2e suite — UI mocks + TON Connect mock-dApp#485
test(demo-wallet): redesign e2e suite — UI mocks + TON Connect mock-dApp#485lesyuk wants to merge 6 commits into
Conversation
…App (TON-1701) UI-mock specs (mock-first via page.route on the walletkit API): unlock, dashboard, assets, nft, history, send, swap, staking, amount-formatting + page objects and a shared walletApi mock. No real wallet/funds — a fresh wallet + mocked Toncenter v3. TON Connect mock-dApp two-tab suite (connect / sendTransaction / signData / signMessage) driven by a self-contained @tonconnect/sdk mock-dApp fixture; asserts the redesigned modal copy + per-type actions. sendTransaction runs without funds via a mocked balance + disableNetworkSend (the wallet signs and responds to the dApp over the bridge but skips the on-chain broadcast). Stable Allure historyId (describe-chain + test title) for zero-manual TestOps linking. DemoWallet expect*Modal assertion helpers; mockdapp + tonconnect Playwright configs.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds a complete mock-first E2E test infrastructure for the demo-wallet: a new ChangesDemo-wallet E2E Infrastructure and Test Suites
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
…quarantine runner specs (TON-1701) The default e2e.config.ts swept every spec under ./e2e — including the two-tab suites (which need extra webServer tabs) and the allure-test-runner specs (whose backend currently returns 500). With --retries=3 that blew the 30-min CI budget (reached 99/122 tests before cancel; 120 "case data 500" errors in the log). - testIgnore ton-connect/** and mock-dapp-tests/** — they run via their own configs (e2e.tonconnect.config.ts / e2e.mockdapp.config.ts), which start the minter :5174 / mock-dApp :5175 tabs themselves. - testIgnore + quarantine the runner specs (connect / signData / sendTransaction / localSendTransaction) until the allure-test-runner backend is restored. - e2e_web.yml: after the ui-tests run, also run the self-contained mock-dApp suite (e2e.mockdapp.config.ts); aggregate exit codes so both report into allure-results. After this the default web e2e run is the mock-first e2e/ui-tests suite (64 tests, 12 files) plus the mock-dApp TON Connect suite.
There was a problem hiding this comment.
Actionable comments posted: 11
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/e2e_web.yml:
- Around line 90-97: The CI step is missing the dedicated TON Connect test suite
because it only runs the default e2e config and e2e.mockdapp.config.ts, while
e2e.config.ts now excludes ton-connect specs. Update this workflow step to also
invoke the dedicated TON Connect Playwright config so
apps/demo-wallet/e2e/ton-connect/connect.spec.ts runs in CI, and keep the
existing exit-code aggregation behavior in the same shell block.
In `@apps/demo-wallet/e2e.mockdapp.config.ts`:
- Around line 30-45: Reject invalid dot-less mock dApp overrides in the e2e mock
config: in e2e.mockdapp.config.ts, the APP_URL assignment still trusts
process.env.MOCK_DAPP_URL as-is, which allows localhost to bypass the local
server and fail WalletKit’s host guard. Update the APP_URL setup to validate the
override hostname and only accept a dotted host like 127.0.0.1, otherwise fall
back to the default mock-dApp URL; keep this logic close to APP_URL,
WALLET_SOURCE, and mockDappServer so the source of truth remains clear.
In `@apps/demo-wallet/e2e/mock-dapp-tests/connect.spec.ts`:
- Around line 37-45: The rejection test currently asserts the dApp is
disconnected using the initial empty state, so it can pass without verifying the
rejection reached the bridge. Update the connect flow in connect.spec.ts, around
test('Rejecting the connect request leaves the dApp disconnected'), to wait for
an explicit mock-dapp terminal rejection signal before checking dapp-connected,
then assert the disconnected state afterward using the existing wallet and dapp
helpers.
In `@apps/demo-wallet/e2e/mock-dapp/vite.config.ts`:
- Around line 18-27: The mock dApp’s Vite config is resolving `@tonconnect/sdk`
through appkit-minter, which couples demo-wallet to another app’s dependency
graph and the SDK’s internal dist layout. Update the setup around the
sdkCjs/sdkEsm resolution in vite.config.ts so demo-wallet declares
`@tonconnect/sdk` itself and imports/aliases it directly from its own package
graph, removing the createRequire path into appkit-minter.
In `@apps/demo-wallet/e2e/mocks/walletApi.ts`:
- Around line 469-473: The traces mock route in walletApi currently ignores the
request pagination parameters and always returns the full events set, so "Load
more" cannot be tested correctly. Update the page.route(TRACES_RE) handler to
read the request's limit and offset query params and pass a sliced page of
events into tracesBody, while still preserving the account stamping logic used
for toEvent. Keep the fix localized to the traces mock helper so pagination
behavior matches the real /api/v3/traces endpoint.
In `@apps/demo-wallet/e2e/qa/WalletApp.ts`:
- Around line 71-76: The recovery flow in WalletApp’s mount wait only reloads
the page and returns after domcontentloaded, so it can still hand back before
the app is mounted. Update the retry path in the mount-wait logic that uses
hasContent(), page.reload(), and the `#root` > * locator to wait again for the
first root child to be attached after the reload, so the recovery remains
synchronous before continuing.
In `@apps/demo-wallet/e2e/ton-connect/connect.spec.ts`:
- Around line 43-45: The approve-path assertion in connect.spec.ts is only
checking widget.connectButton visibility, which is also covered by the other
case and can hide a missing connected transition. Update the test around the
approval flow in the ton-connect connect spec to assert a connected-only signal
from the widget after approval, such as connected wallet text or connected
state, using the existing widget and connectButton-related selectors/methods to
locate the right UI state.
In `@apps/demo-wallet/e2e/ui-tests/assets.spec.ts`:
- Around line 69-81: Scope the fiat check to the specific asset row being tested
in the asset fiat test, since the current page-wide dollar text match can pass
because of the default GRAM row. In the test that uses mockWalletApi,
createWalletOnDashboard, and AssetsPage, give the mocked jetton a non-zero
balance so it renders a fiat amount, then assert the dollar value within that
jetton’s row instead of using a global page.getByText('$') lookup; use the
existing asset row locator pattern around gramName as a guide for targeting the
correct row.
In `@apps/demo-wallet/e2e/ui-tests/dashboard.spec.ts`:
- Around line 24-30: The fiat-total test is too broad because the current
`getByText('$').first()` and integer-only regex can match unrelated dashboard
text. Update `test('Renders the fiat total once balance and rates load', ...)`
in `dashboard.spec.ts` to scope assertions to the total widget via the specific
container or by checking the full formatted mocked amount rendered by
`BalanceTotal`, so the locator uniquely targets that component instead of any
matching text on the page.
In `@apps/demo-wallet/e2e/ui-tests/staking.spec.ts`:
- Around line 34-38: The Max staking test is too weak because
`expect(...).not.toHaveValue('')` only checks that the input changed, not that
it used the correct reserve-adjusted amount. Update the `Max fills the stake
amount keeping the gas reserve` test in `staking.spec.ts` to assert the exact
expected value after clicking the `Max` button, using the `stake-amount-input`
test id and the balance/reserve behavior described in the test setup so
regressions in the filled amount will fail.
In `@apps/demo-wallet/e2e/ui-tests/swap.spec.ts`:
- Around line 34-39: The Max-fill assertion in swap.spec.ts is too weak because
it only checks that the From input is non-empty. Update the test around the Max
button and fromInput locator to assert the filled value is strictly below the
mocked 12.5 GRAM balance, so it verifies the gas reserve behavior rather than
just any populated value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 400d52e4-73f5-440a-985d-8237eb98359b
⛔ Files ignored due to path filters (1)
apps/demo-wallet/e2e/mock-dapp/vite.svgis excluded by!**/*.svg
📒 Files selected for processing (35)
.github/workflows/e2e_web.ymlapps/demo-wallet/e2e.config.tsapps/demo-wallet/e2e.mockdapp.config.tsapps/demo-wallet/e2e.tonconnect.config.tsapps/demo-wallet/e2e/demo-wallet/DemoWallet.tsapps/demo-wallet/e2e/mock-dapp-tests/connect.spec.tsapps/demo-wallet/e2e/mock-dapp-tests/signData.spec.tsapps/demo-wallet/e2e/mock-dapp-tests/signMessage.spec.tsapps/demo-wallet/e2e/mock-dapp-tests/transaction.spec.tsapps/demo-wallet/e2e/mock-dapp/index.htmlapps/demo-wallet/e2e/mock-dapp/main.tsapps/demo-wallet/e2e/mock-dapp/tonconnect-manifest.jsonapps/demo-wallet/e2e/mock-dapp/vite.config.tsapps/demo-wallet/e2e/mocks/walletApi.tsapps/demo-wallet/e2e/pages/AssetsPage.tsapps/demo-wallet/e2e/pages/HistoryPage.tsapps/demo-wallet/e2e/pages/NftPage.tsapps/demo-wallet/e2e/pages/UnlockWalletPage.tsapps/demo-wallet/e2e/pages/index.tsapps/demo-wallet/e2e/qa/WalletApp.tsapps/demo-wallet/e2e/ton-connect/MockDapp.tsapps/demo-wallet/e2e/ton-connect/connect.spec.tsapps/demo-wallet/e2e/ton-connect/mockDappFixture.tsapps/demo-wallet/e2e/ton-connect/twoTabFixture.tsapps/demo-wallet/e2e/ui-tests/UITestFixture.tsapps/demo-wallet/e2e/ui-tests/assets.spec.tsapps/demo-wallet/e2e/ui-tests/dashboard.spec.tsapps/demo-wallet/e2e/ui-tests/formatting.spec.tsapps/demo-wallet/e2e/ui-tests/helpers.tsapps/demo-wallet/e2e/ui-tests/history.spec.tsapps/demo-wallet/e2e/ui-tests/nft.spec.tsapps/demo-wallet/e2e/ui-tests/send.spec.tsapps/demo-wallet/e2e/ui-tests/staking.spec.tsapps/demo-wallet/e2e/ui-tests/swap.spec.tsapps/demo-wallet/e2e/ui-tests/unlock.spec.ts
| # 1) Default config: mock-first ui-tests only (see e2e.config.ts testIgnore). | ||
| # 2) Self-contained two-tab TON Connect mock-dApp suite (starts mock-dApp :5175 + | ||
| # demo-wallet :5173 with broadcast/manifest checks disabled). Aggregate exit codes | ||
| # so both runs execute and both report into allure-results. | ||
| set +e | ||
| xvfb-run pnpm e2e; r1=$? | ||
| xvfb-run pnpm exec playwright test --config e2e.mockdapp.config.ts; r2=$? | ||
| exit $(( r1 || r2 )) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Run the dedicated TON Connect config in CI.
apps/demo-wallet/e2e.config.ts now ignores **/ton-connect/**, but this step only runs the default config plus e2e.mockdapp.config.ts. That leaves apps/demo-wallet/e2e/ton-connect/connect.spec.ts unexecuted in CI.
Suggested change
set +e
xvfb-run pnpm e2e; r1=$?
- xvfb-run pnpm exec playwright test --config e2e.mockdapp.config.ts; r2=$?
- exit $(( r1 || r2 ))
+ xvfb-run pnpm exec playwright test --config e2e.tonconnect.config.ts; r2=$?
+ xvfb-run pnpm exec playwright test --config e2e.mockdapp.config.ts; r3=$?
+ exit $(( r1 || r2 || r3 ))📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # 1) Default config: mock-first ui-tests only (see e2e.config.ts testIgnore). | |
| # 2) Self-contained two-tab TON Connect mock-dApp suite (starts mock-dApp :5175 + | |
| # demo-wallet :5173 with broadcast/manifest checks disabled). Aggregate exit codes | |
| # so both runs execute and both report into allure-results. | |
| set +e | |
| xvfb-run pnpm e2e; r1=$? | |
| xvfb-run pnpm exec playwright test --config e2e.mockdapp.config.ts; r2=$? | |
| exit $(( r1 || r2 )) | |
| # 1) Default config: mock-first ui-tests only (see e2e.config.ts testIgnore). | |
| # 2) Self-contained two-tab TON Connect mock-dApp suite (starts mock-dApp :5175 + | |
| # demo-wallet :5173 with broadcast/manifest checks disabled). Aggregate exit codes | |
| # so both runs execute and both report into allure-results. | |
| set +e | |
| xvfb-run pnpm e2e; r1=$? | |
| xvfb-run pnpm exec playwright test --config e2e.tonconnect.config.ts; r2=$? | |
| xvfb-run pnpm exec playwright test --config e2e.mockdapp.config.ts; r3=$? | |
| exit $(( r1 || r2 || r3 )) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/e2e_web.yml around lines 90 - 97, The CI step is missing
the dedicated TON Connect test suite because it only runs the default e2e config
and e2e.mockdapp.config.ts, while e2e.config.ts now excludes ton-connect specs.
Update this workflow step to also invoke the dedicated TON Connect Playwright
config so apps/demo-wallet/e2e/ton-connect/connect.spec.ts runs in CI, and keep
the existing exit-code aggregation behavior in the same shell block.
| // After a successful connect the dApp's widget shows its connected (disconnect) control. | ||
| await expect(widget.connectButton).toBeVisible(); | ||
| }); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Assert a connected-only signal in the approval path.
Line 44 and Line 52 verify the same thing, so the “approve” case can still pass when the dApp never transitions out of its pre-connect state. Please assert a connected-only indicator here (for example, connected wallet text/state) instead of generic button visibility.
Also applies to: 51-52
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/demo-wallet/e2e/ton-connect/connect.spec.ts` around lines 43 - 45, The
approve-path assertion in connect.spec.ts is only checking widget.connectButton
visibility, which is also covered by the other case and can hide a missing
connected transition. Update the test around the approval flow in the
ton-connect connect spec to assert a connected-only signal from the widget after
approval, such as connected wallet text or connected state, using the existing
widget and connectButton-related selectors/methods to locate the right UI state.
…te, harden mock-dApp, readable steps (TON-1701)
- Remove the superseded minter two-tab connect suite + its config: the mock-dApp
suite covers connect, and appkit↔wallet is covered by the minter's own gasless e2e.
- mockdapp config: reject a `localhost` MOCK_DAPP_URL override (WalletKit's manifest
host guard rejects dot-less hosts — fail fast instead of a confusing run).
- mock-dApp connect reject: assert the rejection actually round-trips back to the
dApp (#dapp-error via onStatusChange's error handler) instead of an empty
#dapp-connected, which was also the initial state (false pass).
- Declare @tonconnect/sdk as a demo-wallet devDependency (catalog) and drop the
cross-app Vite alias hack in the mock-dApp fixture — resolve it directly.
- Wrap DemoWallet / helpers flows in named allure.step() so TestOps shows readable
steps ("Approve connect request", …) instead of raw Playwright actions.
…stOps) (TON-1701)
…automation (TON-1701) CodeRabbit round-2 (test quality): - walletApi traces mock honors limit/offset (so pagination/"Load more" advances). - recoverIfBlank waits for the app to actually mount (#root children) after the reload. - assets/dashboard fiat assertions scoped to the row / total widget (not page-wide $). - staking/swap Max assert the exact reserve-adjusted amount (reserve kept), not just non-empty. §18 TON Connect — paste-to-connect / queue / guards (mock-first, two-tab): - guards: request modals (connect/sign-data) are non-dismissible (Esc + backdrop ignored); the Connect-to-dApp paste modal IS dismissible. - queue: two concurrent requests are shown one modal at a time (the second only after the first resolves) — asserts the wallet's request queue sequencing. - paste routing: a clipboard tc:// link auto-routes to a connect request, is suppressed while the paste modal is open, and non-TON clipboard text is ignored. Adds a mock-dApp "two requests" control + allure-wrapped DemoWallet/MockDapp helpers.
…inline ui-test steps - Remove internal test-plan section numbers, tracker IDs and TestOps project numbers from e2e comments and test/describe names (this is a public repo); keep behavior descriptions and repo-relative source code-refs. - Wrap the inline import/create-wallet ui-test flows in named allure.step so the Allure/TestOps execution reads as logical steps, on par with the page objects.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
apps/demo-wallet/e2e/ton-connect/MockDapp.ts (1)
79-93: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMinor: selector inconsistency between
settledCount()andwaitForSettledCount().
settledCount()reads viagetByTestId('dapp-settled-count')whilewaitForSettledCount()resolves the same node viagetElementById('dapp-settled-count'). This works only as long as the element'sdata-testidandidstay identical. Aligning both on one accessor avoids silent breakage if the mock-dApp markup diverges.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/demo-wallet/e2e/ton-connect/MockDapp.ts` around lines 79 - 93, `settledCount()` and `waitForSettledCount()` are using two different selectors for the same `dapp-settled-count` element, which can drift if the mock dApp markup changes. Update `MockDapp` so both methods use the same accessor pattern (either `getByTestId` or `getElementById`) when reading/waiting on the settled-count node, keeping the selector choice consistent within `settledCount()` and `waitForSettledCount()`.apps/demo-wallet/e2e/demo-wallet/DemoWallet.ts (1)
199-208: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winParameterize the payload-specific sign-data assertion.
Text Messageis only the text variant label in the upstream modal implementation. Since this helper is named generically, a bytes/cellsignDatarequest would fail here even if the modal is correct. Either pass the expected payload label intoexpectSignDataModal()or limit this helper to invariant copy only.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/demo-wallet/e2e/demo-wallet/DemoWallet.ts` around lines 199 - 208, The sign-data modal helper is asserting a payload-specific label, which makes the generic `expectSignDataModal()` fail for non-text `signData` requests. Update `DemoWallet.expectSignDataModal()` to either accept the expected payload label as an argument and assert against it, or remove the `Text Message` check so it only verifies invariant modal content. Keep the existing `open()`, `step()`, and `sign-data-request` locator flow intact while adjusting the assertion to match the payload variant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/demo-wallet/e2e/demo-wallet/DemoWallet.ts`:
- Around line 220-230: Add a brief settle/poll period in waitForOneRequestModal
after Promise.race resolves and before counting visible modals, because the
current immediate snapshot can miss a second modal that appears a tick later.
Update the logic in DemoWallet.waitForOneRequestModal so it waits for visibility
to stabilize, then re-checks app.getByTestId(...).isVisible() for each candidate
before asserting exactly one visible modal and returning the id.
---
Nitpick comments:
In `@apps/demo-wallet/e2e/demo-wallet/DemoWallet.ts`:
- Around line 199-208: The sign-data modal helper is asserting a
payload-specific label, which makes the generic `expectSignDataModal()` fail for
non-text `signData` requests. Update `DemoWallet.expectSignDataModal()` to
either accept the expected payload label as an argument and assert against it,
or remove the `Text Message` check so it only verifies invariant modal content.
Keep the existing `open()`, `step()`, and `sign-data-request` locator flow
intact while adjusting the assertion to match the payload variant.
In `@apps/demo-wallet/e2e/ton-connect/MockDapp.ts`:
- Around line 79-93: `settledCount()` and `waitForSettledCount()` are using two
different selectors for the same `dapp-settled-count` element, which can drift
if the mock dApp markup changes. Update `MockDapp` so both methods use the same
accessor pattern (either `getByTestId` or `getElementById`) when reading/waiting
on the settled-count node, keeping the selector choice consistent within
`settledCount()` and `waitForSettledCount()`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5b4dd618-efa7-4970-a6d1-9941452577a7
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (25)
apps/demo-wallet/e2e.config.tsapps/demo-wallet/e2e.mockdapp.config.tsapps/demo-wallet/e2e/README.mdapps/demo-wallet/e2e/demo-wallet/DemoWallet.tsapps/demo-wallet/e2e/mock-dapp-tests/connect.spec.tsapps/demo-wallet/e2e/mock-dapp-tests/guards.spec.tsapps/demo-wallet/e2e/mock-dapp-tests/paste-routing.spec.tsapps/demo-wallet/e2e/mock-dapp-tests/queue.spec.tsapps/demo-wallet/e2e/mock-dapp/index.htmlapps/demo-wallet/e2e/mock-dapp/main.tsapps/demo-wallet/e2e/mock-dapp/vite.config.tsapps/demo-wallet/e2e/mocks/walletApi.tsapps/demo-wallet/e2e/qa/WalletApp.tsapps/demo-wallet/e2e/ton-connect/MockDapp.tsapps/demo-wallet/e2e/ton-connect/mockDappFixture.tsapps/demo-wallet/e2e/ui-tests/assets.spec.tsapps/demo-wallet/e2e/ui-tests/dashboard.spec.tsapps/demo-wallet/e2e/ui-tests/formatting.spec.tsapps/demo-wallet/e2e/ui-tests/helpers.tsapps/demo-wallet/e2e/ui-tests/importWallet.spec.tsapps/demo-wallet/e2e/ui-tests/newWallet.spec.tsapps/demo-wallet/e2e/ui-tests/nft.spec.tsapps/demo-wallet/e2e/ui-tests/staking.spec.tsapps/demo-wallet/e2e/ui-tests/swap.spec.tsapps/demo-wallet/package.json
✅ Files skipped from review due to trivial changes (2)
- apps/demo-wallet/e2e/mock-dapp-tests/guards.spec.ts
- apps/demo-wallet/e2e/README.md
🚧 Files skipped from review as they are similar to previous changes (14)
- apps/demo-wallet/e2e/ui-tests/formatting.spec.ts
- apps/demo-wallet/e2e/mock-dapp-tests/connect.spec.ts
- apps/demo-wallet/e2e/mock-dapp/index.html
- apps/demo-wallet/e2e/ui-tests/assets.spec.ts
- apps/demo-wallet/e2e/ui-tests/nft.spec.ts
- apps/demo-wallet/e2e.config.ts
- apps/demo-wallet/e2e/ui-tests/swap.spec.ts
- apps/demo-wallet/e2e/ui-tests/helpers.ts
- apps/demo-wallet/e2e.mockdapp.config.ts
- apps/demo-wallet/e2e/ui-tests/staking.spec.ts
- apps/demo-wallet/e2e/qa/WalletApp.ts
- apps/demo-wallet/e2e/ton-connect/mockDappFixture.ts
- apps/demo-wallet/e2e/ui-tests/dashboard.spec.ts
- apps/demo-wallet/e2e/mocks/walletApi.ts
| async waitForOneRequestModal(testIds: string[]): Promise<string> { | ||
| return await step('Wait for a single request modal to be shown', async () => { | ||
| const app = await this.open(); | ||
| // Resolve as soon as any of the candidate modals is visible. | ||
| await Promise.race(testIds.map((id) => app.getByTestId(id).waitFor({ state: 'visible' }))); | ||
| const visible: string[] = []; | ||
| for (const id of testIds) { | ||
| if (await app.getByTestId(id).isVisible()) visible.push(id); | ||
| } | ||
| expect(visible.length, `exactly one request modal visible, saw: [${visible.join(', ')}]`).toBe(1); | ||
| return visible[0]!; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add a short settle window before asserting “exactly one” modal.
This helper resolves on the first visible modal and snapshots immediately, so a second request modal that mounts a tick later can slip past the visible.length === 1 check. Since queue specs rely on this helper to prove one-at-a-time rendering, add a brief post-visibility settle/poll before counting visible modals.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/demo-wallet/e2e/demo-wallet/DemoWallet.ts` around lines 220 - 230, Add a
brief settle/poll period in waitForOneRequestModal after Promise.race resolves
and before counting visible modals, because the current immediate snapshot can
miss a second modal that appears a tick later. Update the logic in
DemoWallet.waitForOneRequestModal so it waits for visibility to stabilize, then
re-checks app.getByTestId(...).isVisible() for each candidate before asserting
exactly one visible modal and returning the id.
Demo wallet redesign — E2E automation
Mock-first Playwright e2e for the redesigned demo-wallet. No real wallet, no real funds — a fresh wallet plus
page.routemocks on the walletkit API; per-push-CI friendly.UI-mock specs (
e2e/ui-tests/)unlock, dashboard, assets, nft, history, send, swap, staking, amount-formatting + restored page objects and a shared
walletApimock (Toncenter v3 + rates). Web-only flows skip in extension mode via thewebOnlyfixture.TON Connect mock-dApp two-tab suite
A self-contained
@tonconnect/sdkmock-dApp (test fixture, not product code) drives connect / sendTransaction / signData / signMessage over the real bridge, plus paste-to-connect routing, the request queue, and modal-dismissibility guards. Each spec asserts the redesigned modal copy + actions and the protocol response the dApp receives.disableNetworkSend(the wallet signs and responds to the dApp over the bridge but skips the on-chain broadcast).src.TestOps
Stable Allure
historyId(describe chain + test title) → zero-manual case auto-create/match, robust to line shifts / file moves. Namedallure.stepwrappers for readable execution. Upload runs in CI via secrets only.CI
The default config runs the mock-first ui-tests; the two-tab suite runs under its own config (own webServers). A set of specs that drive an external test-runner backend are temporarily quarantined while that backend is unavailable.
Scope
Touches
apps/demo-wallet/e2e/**only — no productsrc/changes. Local + CI green; lint + typecheck clean.Summary by CodeRabbit
New Features
Bug Fixes