Skip to content

test(demo-wallet): redesign e2e suite — UI mocks + TON Connect mock-dApp#485

Open
lesyuk wants to merge 6 commits into
mainfrom
feat/TON-1701-demo-wallet-e2e
Open

test(demo-wallet): redesign e2e suite — UI mocks + TON Connect mock-dApp#485
lesyuk wants to merge 6 commits into
mainfrom
feat/TON-1701-demo-wallet-e2e

Conversation

@lesyuk

@lesyuk lesyuk commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

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.route mocks 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 walletApi mock (Toncenter v3 + rates). Web-only flows skip in extension mode via the webOnly fixture.

TON Connect mock-dApp two-tab suite

A self-contained @tonconnect/sdk mock-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.

  • sendTransaction runs without funds: a mocked balance + disableNetworkSend (the wallet signs and responds to the dApp over the bridge but skips the on-chain broadcast).
  • Modal-copy assertions use only strings verified against the components in src.

TestOps

Stable Allure historyId (describe chain + test title) → zero-manual case auto-create/match, robust to line shifts / file moves. Named allure.step wrappers 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 product src/ changes. Local + CI green; lint + typecheck clean.

Summary by CodeRabbit

  • New Features

    • Expanded end-to-end coverage for wallet screens, including Assets, History, NFTs, Send, Swap, Staking, and Unlock.
    • Added broader TON Connect scenarios for connecting, signing messages/data, sending transactions, paste handling, and queued requests.
  • Bug Fixes

    • Improved test reliability for wallet and mock dApp flows by making modal handling and page loading more resilient.
    • Updated CI execution so key E2E suites complete more consistently and report results even when one run fails.

…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.
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
appkit-minter Ready Ready Preview, Comment Jun 30, 2026 8:33am
appkit-template Ready Ready Preview, Comment Jun 30, 2026 8:33am
kit-demo-wallet Ready Ready Preview, Comment Jun 30, 2026 8:33am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a complete mock-first E2E test infrastructure for the demo-wallet: a new e2e.mockdapp.config.ts Playwright config for a two-tab TON Connect suite, a self-contained Vite mock dApp, wallet API route mocks, new page objects, fixture factories, and test suites covering UI flows and TON Connect scenarios. The CI workflow is updated to run both configs sequentially.

Changes

Demo-wallet E2E Infrastructure and Test Suites

Layer / File(s) Summary
Playwright configs and CI workflow split
.github/workflows/e2e_web.yml, apps/demo-wallet/e2e.config.ts, apps/demo-wallet/e2e.mockdapp.config.ts, apps/demo-wallet/package.json
Adds e2e.mockdapp.config.ts with two conditional webServer entries (mock dApp on :5175, demo-wallet on :5173) and environment flags disabling network send and manifest domain checks. Updates e2e.config.ts with testIgnore patterns to exclude TON Connect and quarantined specs. Splits the CI step to run both configs and aggregate exit codes. Adds @tonconnect/sdk to devDependencies.
Mock dApp static app
apps/demo-wallet/e2e/mock-dapp/index.html, apps/demo-wallet/e2e/mock-dapp/main.ts, apps/demo-wallet/e2e/mock-dapp/tonconnect-manifest.json, apps/demo-wallet/e2e/mock-dapp/vite.config.ts
Adds a self-contained Vite-served QA mock dApp: index.html with stable data-testid hooks, main.ts wiring TonConnect SDK actions (connect, sendTransaction, signData, signMessage) to DOM elements including a two-requests queue flow with a settled counter, a TON Connect manifest targeting 127.0.0.1:5175, and a minimal Vite config on port 5175.
Wallet API route mocks
apps/demo-wallet/e2e/mocks/walletApi.ts
Adds route-intercept helpers for Toncenter endpoints: typed interfaces (MockJetton, MockRate, MockNft, MockEvent, MockWalletApiOpts), deterministic response builders for balance/jettons/NFTs/history/rates, and exported installers mockWalletApi, mockRates, mockEmulation, and mockRunGetMethod.
Page objects
apps/demo-wallet/e2e/pages/AssetsPage.ts, .../HistoryPage.ts, .../NftPage.ts, .../UnlockWalletPage.ts, .../index.ts
Adds four Playwright page-object classes for Assets, History, NFT, and Unlock screens with typed locators and waitForPage() helpers. Expands pages/index.ts re-exports.
DemoWallet page object extensions
apps/demo-wallet/e2e/demo-wallet/DemoWallet.ts
Extends DemoWallet with race-safe importWallet waits, signMessage(), four expect*Modal assertion helpers, waitForOneRequestModal, expectNoRequestModal, approveRequestModal, expectRequestModalNotDismissible, clipboard/paste utilities, and Allure-wrapped accept()/sendTonToSelf().
WalletApp blank-page recovery
apps/demo-wallet/e2e/qa/WalletApp.ts
Switches WalletApp.open() to waitUntil: 'domcontentloaded' and adds recoverIfBlank() that reloads once when #root stays empty.
MockDapp page object and fixture factory
apps/demo-wallet/e2e/ton-connect/MockDapp.ts, .../mockDappFixture.ts
Adds the MockDapp page-object with connect/action/result/error methods and queue helpers (fireTwoRequests, settledCount, waitForSettledCount). Adds mockDappFixture() factory producing a persistent two-tab BrowserContext fixture with conditional wallet API mocking and Allure historyId pinning.
UITestFixture Allure historyId and helpers
apps/demo-wallet/e2e/ui-tests/UITestFixture.ts, .../helpers.ts
Adds Allure historyId pinning via beforeEach in UITestFixture and introduces createWalletOnDashboard() helper used across UI specs.
TON Connect two-tab specs
apps/demo-wallet/e2e/mock-dapp-tests/connect.spec.ts, .../transaction.spec.ts, .../signData.spec.ts, .../signMessage.spec.ts, .../guards.spec.ts, .../paste-routing.spec.ts, .../queue.spec.ts
Adds seven two-tab spec files: connect approval/rejection, sendTransaction/signData/signMessage approval/rejection, modal dismissibility guards, global clipboard paste routing, and sequential request queue behavior.
UI test specs
apps/demo-wallet/e2e/ui-tests/dashboard.spec.ts, .../assets.spec.ts, .../history.spec.ts, .../nft.spec.ts, .../send.spec.ts, .../swap.spec.ts, .../staking.spec.ts, .../unlock.spec.ts, .../formatting.spec.ts, .../importWallet.spec.ts, .../newWallet.spec.ts
Adds nine new UI test suites (dashboard, assets, history, NFT, send, swap, staking, unlock, formatting) and adds Allure step wrapping to existing importWallet and newWallet specs.
E2E README
apps/demo-wallet/e2e/README.md
Documents layout, configs, local setup, TON Connect mock-first design, Allure reporting approach, and quarantined specs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • ton-org/kit#473: Updates the e2e signMessage flow to target the redesigned sign-message-request modal via test IDs in apps/appkit-minter, mirroring the same modal refactor applied here to DemoWallet.ts.

Suggested reviewers

  • TrueCarry

🐇 Two tabs open wide,
Mock dApp on one side hops free,
Wallet signs with glee!
No real funds spent today—
Just bunnies testing away~ 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 73.68% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: a demo-wallet e2e suite redesign with UI mocks and a TON Connect mock-dApp.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/TON-1701-demo-wallet-e2e

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b2686a6 and 4350db4.

⛔ Files ignored due to path filters (1)
  • apps/demo-wallet/e2e/mock-dapp/vite.svg is excluded by !**/*.svg
📒 Files selected for processing (35)
  • .github/workflows/e2e_web.yml
  • apps/demo-wallet/e2e.config.ts
  • apps/demo-wallet/e2e.mockdapp.config.ts
  • apps/demo-wallet/e2e.tonconnect.config.ts
  • apps/demo-wallet/e2e/demo-wallet/DemoWallet.ts
  • apps/demo-wallet/e2e/mock-dapp-tests/connect.spec.ts
  • apps/demo-wallet/e2e/mock-dapp-tests/signData.spec.ts
  • apps/demo-wallet/e2e/mock-dapp-tests/signMessage.spec.ts
  • apps/demo-wallet/e2e/mock-dapp-tests/transaction.spec.ts
  • apps/demo-wallet/e2e/mock-dapp/index.html
  • apps/demo-wallet/e2e/mock-dapp/main.ts
  • apps/demo-wallet/e2e/mock-dapp/tonconnect-manifest.json
  • apps/demo-wallet/e2e/mock-dapp/vite.config.ts
  • apps/demo-wallet/e2e/mocks/walletApi.ts
  • apps/demo-wallet/e2e/pages/AssetsPage.ts
  • apps/demo-wallet/e2e/pages/HistoryPage.ts
  • apps/demo-wallet/e2e/pages/NftPage.ts
  • apps/demo-wallet/e2e/pages/UnlockWalletPage.ts
  • apps/demo-wallet/e2e/pages/index.ts
  • apps/demo-wallet/e2e/qa/WalletApp.ts
  • apps/demo-wallet/e2e/ton-connect/MockDapp.ts
  • apps/demo-wallet/e2e/ton-connect/connect.spec.ts
  • apps/demo-wallet/e2e/ton-connect/mockDappFixture.ts
  • apps/demo-wallet/e2e/ton-connect/twoTabFixture.ts
  • apps/demo-wallet/e2e/ui-tests/UITestFixture.ts
  • apps/demo-wallet/e2e/ui-tests/assets.spec.ts
  • apps/demo-wallet/e2e/ui-tests/dashboard.spec.ts
  • apps/demo-wallet/e2e/ui-tests/formatting.spec.ts
  • apps/demo-wallet/e2e/ui-tests/helpers.ts
  • apps/demo-wallet/e2e/ui-tests/history.spec.ts
  • apps/demo-wallet/e2e/ui-tests/nft.spec.ts
  • apps/demo-wallet/e2e/ui-tests/send.spec.ts
  • apps/demo-wallet/e2e/ui-tests/staking.spec.ts
  • apps/demo-wallet/e2e/ui-tests/swap.spec.ts
  • apps/demo-wallet/e2e/ui-tests/unlock.spec.ts

Comment on lines +90 to +97
# 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 ))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Suggested change
# 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.

Comment thread apps/demo-wallet/e2e.mockdapp.config.ts
Comment thread apps/demo-wallet/e2e/mock-dapp-tests/connect.spec.ts
Comment thread apps/demo-wallet/e2e/mock-dapp/vite.config.ts Outdated
Comment thread apps/demo-wallet/e2e/mocks/walletApi.ts Outdated
Comment on lines +43 to +45
// After a successful connect the dApp's widget shows its connected (disconnect) control.
await expect(widget.connectButton).toBeVisible();
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Comment thread apps/demo-wallet/e2e/ui-tests/assets.spec.ts Outdated
Comment thread apps/demo-wallet/e2e/ui-tests/dashboard.spec.ts Outdated
Comment thread apps/demo-wallet/e2e/ui-tests/staking.spec.ts
Comment thread apps/demo-wallet/e2e/ui-tests/swap.spec.ts Outdated
…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.
…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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
apps/demo-wallet/e2e/ton-connect/MockDapp.ts (1)

79-93: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor: selector inconsistency between settledCount() and waitForSettledCount().

settledCount() reads via getByTestId('dapp-settled-count') while waitForSettledCount() resolves the same node via getElementById('dapp-settled-count'). This works only as long as the element's data-testid and id stay 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 win

Parameterize the payload-specific sign-data assertion.

Text Message is only the text variant label in the upstream modal implementation. Since this helper is named generically, a bytes/cell signData request would fail here even if the modal is correct. Either pass the expected payload label into expectSignDataModal() 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4350db4 and bbaaf89.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (25)
  • apps/demo-wallet/e2e.config.ts
  • apps/demo-wallet/e2e.mockdapp.config.ts
  • apps/demo-wallet/e2e/README.md
  • apps/demo-wallet/e2e/demo-wallet/DemoWallet.ts
  • apps/demo-wallet/e2e/mock-dapp-tests/connect.spec.ts
  • apps/demo-wallet/e2e/mock-dapp-tests/guards.spec.ts
  • apps/demo-wallet/e2e/mock-dapp-tests/paste-routing.spec.ts
  • apps/demo-wallet/e2e/mock-dapp-tests/queue.spec.ts
  • apps/demo-wallet/e2e/mock-dapp/index.html
  • apps/demo-wallet/e2e/mock-dapp/main.ts
  • apps/demo-wallet/e2e/mock-dapp/vite.config.ts
  • apps/demo-wallet/e2e/mocks/walletApi.ts
  • apps/demo-wallet/e2e/qa/WalletApp.ts
  • apps/demo-wallet/e2e/ton-connect/MockDapp.ts
  • apps/demo-wallet/e2e/ton-connect/mockDappFixture.ts
  • apps/demo-wallet/e2e/ui-tests/assets.spec.ts
  • apps/demo-wallet/e2e/ui-tests/dashboard.spec.ts
  • apps/demo-wallet/e2e/ui-tests/formatting.spec.ts
  • apps/demo-wallet/e2e/ui-tests/helpers.ts
  • apps/demo-wallet/e2e/ui-tests/importWallet.spec.ts
  • apps/demo-wallet/e2e/ui-tests/newWallet.spec.ts
  • apps/demo-wallet/e2e/ui-tests/nft.spec.ts
  • apps/demo-wallet/e2e/ui-tests/staking.spec.ts
  • apps/demo-wallet/e2e/ui-tests/swap.spec.ts
  • apps/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

Comment on lines +220 to +230
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]!;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant