Files
safe-wallet/apps/mobile/e2e/utils/setup/open-review-and-execute.yml
TimandGitHub 06a773ddf6 tests(mobile): e2e coverage for WalletConnectGate flows (#7760)
* tests(mobile): add e2e coverage for WalletConnectGate flows

Adds Maestro tests for the two non-signing gate states on the
review-and-execute screen:

- wc-gate-reconnect.yml: expired session renders "Reconnect wallet to
  continue"; tapping restores the session and reveals Execute transaction.
- wc-gate-switch-network.yml: wrong-network state renders "Switch network
  to continue"; tapping clears the flag and reveals Execute transaction.

Wires up the e2e control surface:

- WalletConnectContext.e2e.tsx: mock reconnect() and switchNetworkIfNeeded()
  now flip walletConnectE2eState so the gate transitions correctly.
- TestCtrls: e2eWcGateReconnect and e2eWcGateWrongNetwork buttons.
- connectSignerSetup: setupWcGateReconnect / setupWcGateWrongNetwork seed
  a pending-tx safe with a WC signer in the desired gate state.

Pin [email protected] in package.json resolutions.

Part of WA-1858.

* tests(mobile): extract shared review-and-execute nav for wc-gate tests

Both wc-gate YAML tests duplicated ~30 lines navigating from app start to
the Review-and-Execute screen of the first pending tx. Move that navigation
into apps/mobile/e2e/utils/setup/open-review-and-execute.yml, parameterised
by SETUP_BUTTON_ID, and have both gate tests `runFlow` it. The seeding
button id is now the only piece of per-test configuration.

* tests(mobile): assert wc-gate dismissal by id, not by neighbouring text

The gate-dismissed assertion used a regex matching either "Execute
transaction" or "Insufficient funds". Those are distinct semantic states
(funded vs unfunded signer); coupling them in one assertion lets a
funds-error regression silently pass the gate test.

Replace the text regex with `extendedWaitUntil: notVisible` on the gate
button id. That waits for re-render and asserts the gate is gone in one
step, decoupling the test from the underlying execute-button copy.

* tests(mobile): drop unread fields from WC e2e state overrides

WalletConnectGate and useWalletConnectStatus only read `address`,
`isWrongNetwork`, and `isWalletConnectSigner`. The setup helpers and the
`reconnect` mock were also setting `hasProvider` and `walletInfo` —
unobservable from any production code path, so they only added noise.

- setupWcGateReconnect: drop the override entirely; post-reset defaults
  already model an expired session.
- setupWcGateWrongNetwork: drop hasProvider and walletInfo.
- WalletConnectContext.e2e.tsx reconnect mock: drop hasProvider.

* tests(mobile): add `wc-gate` tag to connect-signer suite

The two child flows (wc-gate-reconnect.yml, wc-gate-switch-network.yml)
declare a `wc-gate` tag, but the parent __suite__.yml didn't surface it.
Tag-based runs (`maestro test --include-tags wc-gate`) now also pick up
the aggregated suite, matching repo convention.

* tests(mobile): annotate wcSigner literal with explicit Signer type

The literal relied on inference plus `as const` on `type`. With an explicit
Signer annotation, future widening or narrowing of the discriminated union
in signersSlice will surface here at compile time instead of failing
silently in the e2e flow. The `as const` workaround is no longer needed.

* tests(mobile): reuse setupPendingTxSafe from WC gate setup

setupWcGateBase duplicated the pending-tx safe scaffolding already in
setupHelpers.ts (base config, signer registration, active safe/signer).
The only delta was the signer's `type: 'walletconnect'` and the extra
setExecutionMethod dispatch.

Extend setupPendingTxSafe with an optional `options.signer` override.
Existing five private-key callers are unchanged. setupWcGateBase now
constructs the WC Signer literal and delegates everything else to the
shared helper.

* docs(mobile): document `e2e<PascalCase>` exception for TestCtrls triggers

The repo-wide testID convention is kebab-case, but every TestCtrls
scenario-trigger button uses `e2eConnectSignerOwner`-style camelCase.
That divergence was undocumented, so new contributors would either
churn the convention or get pushed to match it without context.

Codify the exception: product testIDs stay kebab-case; the hidden
e2e-build-only TestCtrls triggers use `e2e<PascalCase>`.

* docs: document `[email protected]` resolution and add resolutions log

The root package.json `resolutions` block had 12 entries with zero
recorded rationale, so each new reviewer has to investigate why a pin
exists. Add `docs/resolutions.md` as the canonical home for that
rationale and seed it with the `[email protected]` entry — a benign dedup
(no CVE) added to align the transitive version under viem.

Future contributors are asked to update the log alongside any new
resolutions entry.
2026-04-28 10:35:30 +02:00

50 lines
1.2 KiB
YAML

appId: ${APP_ID}
tags:
- util
---
# ===========================================
# Open Review and Execute Flow
# ===========================================
# Shared flow for navigating from app start to the Review and Execute screen
# of the first pending transaction. Use after a TestCtrls button has seeded
# Redux with a pending-tx safe and any required signer/session state.
#
# Environment variables:
# SETUP_BUTTON_ID: testID of the TestCtrls button that seeds the scenario
# Example: 'e2eWcGateReconnect'
# Seed Redux state for the scenario
- tapOn:
id: '${SETUP_BUTTON_ID}'
# Wait for pending transactions list to load
- extendedWaitUntil:
visible:
id: 'pending-tx-list'
timeout: 10000
# Tap on the first pending transaction (Send)
- extendedWaitUntil:
visible:
text: 'Send'
timeout: 10000
- tapOn:
text: 'Send'
index: 0
# Wait for the Confirm transaction screen
- extendedWaitUntil:
visible:
text: 'Confirm transaction'
timeout: 10000
# Tap Continue to navigate to the review screen
- assertVisible:
text: 'Continue'
- tapOn:
text: 'Continue'
# Wait for the review screen to load
- waitForAnimationToEnd:
timeout: 2000