Skip to content

feat(rn_cli_wallet): Maestro E2E tests for payment edge cases#457

Merged
ignaciosantise merged 5 commits intomainfrom
feat/maestro-insufficient-funds-double-scan
Apr 7, 2026
Merged

feat(rn_cli_wallet): Maestro E2E tests for payment edge cases#457
ignaciosantise merged 5 commits intomainfrom
feat/maestro-insufficient-funds-double-scan

Conversation

@ignaciosantise
Copy link
Copy Markdown
Collaborator

@ignaciosantise ignaciosantise commented Apr 6, 2026

Summary

  • 4 new Maestro E2E tests: insufficient funds, double-scan same QR, expired link, and cancelled payment flows
  • Refactored shared flows: decoupled pay-merchant-info wait from pay_open_and_paste_url and pay_open_via_deeplink so each test controls its own wait — enabling reuse for error scenarios that skip the merchant info screen
  • ResultView testIDs + accessibility labels: added specific nativeID and accessibilityLabel to result icons (pay-result-success-icon, pay-result-insufficient-funds-icon, pay-result-error-icon, pay-result-expired-icon, pay-result-cancelled-icon) for reliable assertions without string dependencies
  • create-payment.js: supports optional WPAY_AMOUNT env var for custom payment amounts (defaults to 1)
  • ESLint fix: resolved minimatch is not a function error by pinning eslint-plugin-react/minimatch to v5
graph TD
    A[create-payment.js] -->|gateway_url| B[pay_open_and_paste_url]
    A -->|gateway_url| C[pay_open_via_deeplink]
    B --> D[pay_single_option_nokyc]
    B --> E[pay_multiple_options_nokyc]
    B --> F[pay_multiple_options_kyc]
    C --> G[pay_single_option_nokyc_deeplink]
    B --> H[pay_insufficient_funds 🆕]
    B --> I[pay_double_scan 🆕]
    B --> J[pay_expired_link 🆕]
    B --> K[pay_cancelled 🆕]

    style H fill:#f96,stroke:#333
    style I fill:#f96,stroke:#333
    style J fill:#f96,stroke:#333
    style K fill:#f96,stroke:#333
Loading

Test plan

  • Run maestro test .maestro/pay_insufficient_funds.yaml — verify "Not enough funds" error screen
  • Run maestro test .maestro/pay_double_scan.yaml — verify rejection on second scan
  • Run maestro test .maestro/pay_expired_link.yaml — verify "Your payment has expired" screen
  • Run maestro test .maestro/pay_cancelled.yaml — verify "This payment was cancelled" screen
  • Run existing pay tests to confirm no regressions from shared flow refactor
  • Verify yarn lint passes in rn_cli_wallet

🤖 Generated with Claude Code

ignaciosantise and others added 2 commits April 6, 2026 16:27
…iew testIDs

Add new Maestro tests for insufficient funds, double-scan, expired link,
and cancelled payment flows. Refactor shared flows to decouple merchant-info
wait from open/paste steps, making flows reusable for error scenarios.
Add specific testIDs and accessibility labels to ResultView icons for
reliable E2E assertions without string dependencies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add minimatch v5 resolution for eslint-plugin-react to fix
"minimatch is not a function" error caused by minimatch v9 ESM exports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 6, 2026 19:28
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 6, 2026

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

Project Deployment Actions Updated (UTC)
pos-demo Ready Ready Preview, Comment Apr 6, 2026 8:45pm

Request Review

@claude
Copy link
Copy Markdown

claude bot commented Apr 6, 2026

Claude finished @ignaciosantise's task in 2s —— View job


PR Review

  • Gather context
  • Read changed files
  • Run license compliance check
  • Run breaking changes check
  • Run data classification check
  • Compile findings

Found 1 issue(s)

Issue 1: Hardcoded payment IDs will become stale test fixtures

ID: pay-cancelled-hardcoded-pid-a3f1
File: .maestro/pay_cancelled.yaml:7 and .maestro/pay_expired_link.yaml:7
Severity: MEDIUM
Category: code_quality

Context:

  • Pattern: Both tests hardcode specific payment IDs (pay_24a2ecc101KNHMZ1B8GJMR16VXAZ2EXXMN, pay_b8a2ecc101KNHRNWXD2VF8SGZDS7WK19ZA) via evalScript
  • Risk: If the backend ever purges or invalidates these historical payment records, the tests will fail with a network/404 error rather than the expected cancellation/expiry UI — masking whether the actual error-handling code works
  • Impact: Silent CI failures unrelated to app logic; wrong error surfaced (payment not found vs. payment cancelled/expired)
  • Trigger: Any backend data retention policy that cleans up old terminated payments

Recommendation: Document a procedure for refreshing these IDs (or add a comment with the creation steps), and consider whether WPAY_CANCELLED_PAYMENT_URL / WPAY_EXPIRED_PAYMENT_URL env vars should be used instead for easier rotation:

# pay_cancelled.yaml
- evalScript: ${output.gateway_url = WPAY_CANCELLED_PAYMENT_URL}

This avoids hardcoding while keeping the zero-API-call approach for these static states.

Fix this →

Subagent findings:

  • ✅ License compliance — all new deps use permissive licenses (MIT, BlueOak-1.0.0)
  • ✅ Breaking changes — shared flow refactor correctly compensated in all existing consumers
  • ✅ Data classification — credentials use env vars; hardcoded payment IDs are already-terminated, non-sensitive fixtures

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds new Maestro end-to-end tests for WalletConnect Pay error/edge-case flows in rn_cli_wallet, refactors shared Maestro flows so tests can control their own waits, and updates UI identifiers to make result-screen assertions more reliable. It also adjusts the Maestro payment creation script to allow custom amounts, and updates ESLint-related dependencies/resolutions.

Changes:

  • Added 4 new Maestro E2E tests covering insufficient funds, double-scan, expired link, and cancelled payment flows.
  • Refactored shared Maestro “open payment” flows to remove embedded merchant-info waits; updated existing pay tests to add explicit waits where needed.
  • Added additional testIDs for result icons; extended Maestro payment creation script to accept WPAY_AMOUNT; updated ESLint deps/resolutions.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
wallets/rn_cli_wallet/package.json Adds ESLint plugin deps and a selective resolutions override for eslint-plugin-react’s minimatch.
wallets/rn_cli_wallet/yarn.lock Lockfile updates reflecting new ESLint plugin deps and added minimatch@5.1.6.
wallets/rn_cli_wallet/src/modals/PaymentOptionsModal/ResultView.tsx Adds testIDs for error-state result icons to support Maestro assertions.
.maestro/scripts/create-payment.js Adds optional WPAY_AMOUNT support when creating payments via API.
.maestro/flows/pay_open_and_paste_url.yaml Removes embedded wait for merchant info so callers decide what to wait for.
.maestro/flows/pay_open_via_deeplink.yaml Removes embedded wait for merchant info so callers decide what to wait for.
.maestro/pay_single_option_nokyc.yaml Adds explicit wait for pay-merchant-info after opening/pasting URL.
.maestro/pay_single_option_nokyc_deeplink.yaml Adds explicit wait for pay-merchant-info after opening deep link.
.maestro/pay_multiple_options_nokyc.yaml Adds explicit wait for pay-merchant-info after opening/pasting URL.
.maestro/pay_multiple_options_kyc.yaml Adds explicit wait for pay-merchant-info after opening/pasting URL.
.maestro/pay_insufficient_funds.yaml New Maestro test validating insufficient-funds result screen and icon.
.maestro/pay_expired_link.yaml New Maestro test validating expired-payment result screen and icon.
.maestro/pay_double_scan.yaml New Maestro test that completes a payment, then re-submits the same URL and asserts an error result.
.maestro/pay_cancelled.yaml New Maestro test validating cancelled-payment result screen and icon.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread wallets/rn_cli_wallet/package.json Outdated
Comment thread wallets/rn_cli_wallet/package.json Outdated
Comment thread .maestro/scripts/create-payment.js
Comment thread wallets/rn_cli_wallet/src/modals/PaymentOptionsModal/ResultView.tsx
Remove eslint-plugin-react direct dep (minimatch resolution suffices).
Pin eslint-plugin-ft-flow to ^2.0.1 for @react-native/eslint-config compat.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Maestro on Android doesn't reliably match combined id + text selectors
in assertVisible. Split into assertVisible by id + copyTextFrom/assertTrue
for button text verification, matching the pattern used in existing tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Result button testID now encodes state: pay-button-result-action-{success|errorType}
- Extract getResultButtonTestId and getActionButtonText utils in ResultView
- Remove fragile text assertions from error tests (id suffices)
- Add retry tap on "Add" in KYC test for slow webview

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ignaciosantise ignaciosantise merged commit a6fffee into main Apr 7, 2026
14 of 16 checks passed
@ignaciosantise ignaciosantise deleted the feat/maestro-insufficient-funds-double-scan branch April 7, 2026 14:36
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