Skip to content

fix(e2e): wait for the asset page before reading the balance in disaster recovery - #668

Merged
MRmarioruci merged 3 commits into
mainfrom
fix/e2e-disaster-recovery-bounded-waits
Sep 21, 2026
Merged

MRmarioruci merged 3 commits into
mainfrom
fix/e2e-disaster-recovery-bounded-waits

Conversation

@MRmarioruci

@MRmarioruci MRmarioruci commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Problem

can recover uninstalled station fails often on main, and the reported line moved between steps across runs: 55, 71, 72 and 78. That was one symptom, not four.

The test shared a single 600s budget across a long flow, and two loops inside it could not fail on their own: one polling the station module hash, one polling for the restored balance. Whichever step was slowest consumed the budget, and the failure surfaced as a timeout inside whichever wait the test happened to be in, pointing at a step that was often not the slow one and never saying what it had observed.

Bounding those waits produced the real error:

Error: the ICP balance should be restored after disaster recovery
Expected substring: "5.0"
Received string:    "Main"

The test was reading "Main", the account name, and never a balance. Clicking an asset starts a client side navigation that the test did not wait for, so the page.reload() immediately after re-rendered the account page rather than the asset page. The account page header is the account name, so every subsequent read returned "Main" and the loop could never succeed. The asset page header is either the balance or a placeholder, never an account name, which is what made the value diagnostic.

Changes

pickByAsset waits for the nested /accounts/:accountId/:assetId route, so the click is known to have navigated before anything reads the header. The balance check waits on the live header through a new expectBalance, rather than reloading in a loop: AccountAssetPage mounts its DataLoader with refresh-interval-ms="5000" and never disables it, so the page refreshes its own balance and the reload was never needed. It only served to race the pending navigation. The module hash wait in installCustomWasm stays a bounded poll so a wasm that never installs fails against that step with its own message.

Note

The first commit here is the bounded waits that produced the diagnosis; the second is the fix. Keeping both makes the reasoning reviewable, and the bounded module hash wait is worth keeping on its own.

The test shares one budget across a long flow and contained two loops that
could not fail on their own: one polling the station module hash, one polling
for the restored balance. Whichever step happened to be slowest consumed the
budget, and the failure was reported as a timeout inside whichever wait the
test was sitting in, which is why the reported line moves between steps
across runs.

Both loops become bounded polls with their own timeouts and messages, so a
step that does not complete fails against that step and reports the value it
last read. The entry point into the recovery page is also waited for rather
than clicked immediately, since it only appears once the wallet has noticed
the station is uninstalled.
@MRmarioruci
MRmarioruci requested a review from a team as a code owner September 18, 2026 17:08
@zeropath-ai

zeropath-ai Bot commented Sep 18, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 9762732.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► tests/e2e/disaster-recovery.spec.ts
    Modify disaster recovery flow to wait for link visibility before clicking and simplify balance wait logic
► tests/e2e/page-objects/account-asset.page.ts
    Add expectBalance method to wait for live header balance with extended timeout
Enhancement ► tests/e2e/page-objects/account.page.ts
    Wait for nested asset route navigation before proceeding to read page header
Enhancement ► tests/e2e/page-objects/settings.page.ts
    Introduce polling-based wait for module hash change after installing custom wasm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The test-only changes preserve existing assertions while adding appropriate phase-specific bounds and diagnostics.

Review effort: Balanced
Findings: None

What changed in this PR

Bounds disaster-recovery E2E polling so failures identify the stalled phase and last observed value.

Changes:

  • Replaces unbounded module-hash and balance loops with timed expect.poll.
  • Waits explicitly for the disaster-recovery entry point.
File Description
tests/​e2e/​page-objects/​settings.page.ts Bounds custom WASM installation polling.
tests/​e2e/​disaster-recovery.spec.ts Bounds recovery waits and improves diagnostics.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The bounded wait added in the previous commit reported what the test was
actually reading: the account name, never a balance. Clicking an asset starts
a client side navigation that the test did not wait for, so the reload that
followed re-rendered the account page, whose header is the account name, and
every later read was taken from there.

pickByAsset now waits for the nested asset route, and the balance check waits
on the live header instead of reloading. The page refreshes its own balance
every five seconds, so the reload was never needed and only served to race
the navigation.
@MRmarioruci MRmarioruci changed the title test(e2e): bound the waits in the disaster recovery test fix(e2e): wait for the asset page before reading the balance in disaster recovery Sep 21, 2026
@MRmarioruci
MRmarioruci enabled auto-merge (squash) September 21, 2026 10:14
@MRmarioruci
MRmarioruci merged commit d24c9ba into main Sep 21, 2026
43 of 44 checks passed
@MRmarioruci
MRmarioruci deleted the fix/e2e-disaster-recovery-bounded-waits branch September 21, 2026 13:08
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.

3 participants