Skip to content

Conversation

@ignaciosantise
Copy link
Collaborator

Summary

  • Add Maestro E2E testing infrastructure for the POS app
  • Add GitHub Action workflow to run E2E tests on Android
  • Update AGENTS.md with testing guidelines

Changes

E2E Tests (dapps/pos-app/e2e/)

  • payment-flow.yaml - Tests the payment flow: New sale → Enter amount → QR code → Open payment URL

testID Support

  • Added testID prop to Button component
  • Added testIDs to key interactive elements:
    • new-sale-button, settings-button (home screen)
    • charge-button (amount screen)
    • key-0 through key-9, key-dot, key-erase (numeric keyboard)
    • qr-code (scan screen)

GitHub Action (.github/workflows/ci_e2e_tests_pos_android.yaml)

  • Triggers on push to main, PRs, and manual dispatch
  • Builds release APK using mocked keystores
  • Runs Maestro tests on Android emulator
  • Posts results to Slack

AGENTS.md Updates

  • Added testing guidelines about avoiding mocked component tests
  • Added rule to use testID for E2E tests
  • Added minimal comments and no unused variables rules

Test Plan

  • Verify GitHub Action runs successfully
  • Manually run maestro test e2e/ locally to verify flow

- Add payment flow E2E test (new sale -> enter amount -> QR code -> open URL)
- Add testID props to Button component and key interactive elements
- Add GitHub Action workflow for running Maestro tests on Android
- Update AGENTS.md with testing guidelines:
  - Avoid testing mocked components
  - Use testID for E2E tests
  - Minimal comments rule
  - No unused variables rule
Copilot AI review requested due to automatic review settings January 8, 2026 18:27
@vercel
Copy link

vercel bot commented Jan 8, 2026

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

Project Deployment Review Updated (UTC)
react-native-examples Ready Ready Preview, Comment Jan 8, 2026 7:00pm

@claude
Copy link

claude bot commented Jan 8, 2026

Claude finished @ignaciosantise's task in 1m 30s —— View job


Review Complete

Found 3 issue(s)

Issue 1: App ID mismatch between workflow and E2E test

ID: payment-app-id-mismatch-a7b3
File: dapps/pos-app/e2e/payment-flow.yaml:1
Severity: HIGH
Category: configuration

The E2E test file uses appId: com.reown.mobilepos but the workflow builds the app with a different package name. This will cause the test to fail as Maestro won't be able to find the app.

Recommendation: Verify the correct app ID from dapps/pos-app/app.json and update the E2E test file to use the matching package name. The app ID should match the value in expo.android.package or the build configuration.

Issue 2: Insufficient E2E test coverage for error scenarios

ID: payment-edge-case-coverage-2f91
File: dapps/pos-app/e2e/payment-flow.yaml:1
Severity: MEDIUM
Category: code_quality

The payment flow test only covers the happy path. Critical edge cases are not tested: invalid amounts (negative, zero with validation bypassed, exceeding limits), network failures during payment initiation, QR code generation failures, and merchant configuration errors.

Recommendation: Add additional test files for error scenarios:

# e2e/payment-flow-invalid-amount.yaml
- tapOn: { id: "key-0" }
- tapOn: { id: "charge-button" }
- assertVisible: { text: "Amount is required" }

# e2e/payment-flow-no-merchant-config.yaml
# Clear merchant settings first, then verify error handling

Issue 3: Hardcoded amount assertion may fail with formatting variations

ID: payment-amount-assertion-fragile-8c42
File: dapps/pos-app/e2e/payment-flow.yaml:35
Severity: LOW
Category: code_quality

The assertion text: "0.01 USD" is fragile because it depends on exact formatting. If the gateway adds spacing, currency symbols, or uses different decimal formatting (0.01 USD vs $0.01 vs 0.01 USD), the test will fail.

Recommendation: Use a more flexible assertion pattern or verify the amount is visible within a specific container:

# Option 1: Check for amount components separately
- assertVisible: "0.01"
- assertVisible: "USD"

# Option 2: Use regex if Maestro supports it
- assertVisible:
    text: "0\\.01.*USD"

Automated Checks

🔒 External Domain URL Detected (Non-blocking)
URL: https://get.maestro.mobile.dev
Files:

  • .github/workflows/ci_e2e_tests_pos_android.yaml:72
  • dapps/pos-app/e2e/README.md:9

This change introduces URLs pointing to external domains. Please verify that these external dependencies are intentional and review for potential security, privacy, or compliance implications. Approved company domains are: reown.com, walletconnect.com, walletconnect.org

Note: Maestro is a legitimate E2E testing tool. Consider pinning to a specific version rather than using the latest version from the install script for better reproducibility and security.


@@ -0,0 +1,39 @@
appId: com.reown.mobilepos
Copy link

Choose a reason for hiding this comment

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

🤖 Auto Review Issue: App ID mismatch between workflow and E2E test

Severity: HIGH
Category: configuration
Tool: Claude Auto Review

Recommendation: Verify the correct app ID from dapps/pos-app/app.json and update the E2E test file to use the matching package name. The app ID should match the value in expo.android.package or the build configuration.

@@ -0,0 +1,39 @@
appId: com.reown.mobilepos
Copy link

Choose a reason for hiding this comment

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

🤖 Auto Review Issue: Insufficient E2E test coverage for error scenarios

Severity: MEDIUM
Category: code_quality
Tool: Claude Auto Review

Recommendation: Add additional test files for error scenarios:

# e2e/payment-flow-invalid-amount.yaml
- tapOn: { id: "key-0" }
- tapOn: { id: "charge-button" }
- assertVisible: { text: "Amount is required" }

# e2e/payment-flow-no-merchant-config.yaml
# Clear merchant settings first, then verify error handling


# Step 6: Verify amount is $0.01
- assertVisible:
text: "0.01 USD"
Copy link

Choose a reason for hiding this comment

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

🤖 Auto Review Issue: Hardcoded amount assertion may fail with formatting variations

Severity: LOW
Category: code_quality
Tool: Claude Auto Review

Recommendation: Use a more flexible assertion pattern or verify the amount is visible within a specific container:

# Option 1: Check for amount components separately
- assertVisible: "0.01"
- assertVisible: "USD"

# Option 2: Use regex if Maestro supports it
- assertVisible:
    text: "0\\.01.*USD"

Copy link

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 Maestro E2E testing infrastructure to the POS app, enabling automated end-to-end testing of key user flows on Android. The implementation includes test files, component instrumentation with testIDs, a GitHub Actions workflow for CI, and updated developer guidelines.

  • Adds Maestro E2E testing framework with payment flow test coverage
  • Adds testID props to interactive components for test automation
  • Implements CI workflow with Android emulator and Slack notifications

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
dapps/pos-app/e2e/payment-flow.yaml Defines E2E test for payment flow from sale creation to QR code generation
dapps/pos-app/e2e/README.md Provides documentation for running and creating Maestro tests
dapps/pos-app/components/button.tsx Adds testID prop support to Button component
dapps/pos-app/components/numeric-keyboard.tsx Moves testID from child elements to parent Button for better E2E targeting
dapps/pos-app/app/scan.tsx Changes QR tap behavior to open URL in browser and adds testID
dapps/pos-app/app/index.tsx Adds testIDs to home screen buttons
dapps/pos-app/app/amount.tsx Adds testID to charge button
dapps/pos-app/AGENTS.md Documents testing guidelines and coding standards
.github/workflows/ci_e2e_tests_pos_android.yaml Implements CI workflow for running E2E tests on Android emulator

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

## Adding New Tests

1. Create a new `.yaml` file in this directory
2. Start with `appId: com.reown.pos`
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The appId in the example shows 'com.reown.pos' but the actual appId should be 'com.reown.mobilepos' as specified in line 46. This inconsistency could confuse developers adding new tests.

Suggested change
2. Start with `appId: com.reown.pos`
2. Start with `appId: com.reown.mobilepos`

Copilot uses AI. Check for mistakes.
Comment on lines +71 to +73
await Linking.openURL(qrUri);
} catch {
showErrorToast("Failed to open payment URL");
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The function behavior has changed from copying the URL with user feedback (via showSuccessToast) to copying the URL and opening it in a browser. This is a breaking change in user experience: users will now have their browser opened automatically when they tap the QR code, rather than just copying the URL. Consider whether this behavior change is intentional and whether it should be documented in the PR description. If automatic browser opening is the desired behavior, the clipboard copy may be unnecessary since the user didn't explicitly request a copy action.

Suggested change
await Linking.openURL(qrUri);
} catch {
showErrorToast("Failed to open payment URL");
showSuccessToast("Payment URL copied to clipboard");
} catch {
showErrorToast("Failed to copy payment URL");

Copilot uses AI. Check for mistakes.
- name: Create env file
run: |
touch dapps/pos-app/.env
echo ${{ vars.POS_DEV_ENV_FILE }} >> dapps/pos-app/.env
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The command uses '>>' to append to the .env file, but other workflows in the repository use '>' to overwrite (see release-android-base.yaml line 114). Since the file is just created with 'touch', using '>' would be more consistent with existing patterns and more explicit about creating the file content. Additionally, if POS_DEV_ENV_FILE contains multiple lines, this echo command may not handle them correctly without proper quoting. Consider using: echo "${{ vars.POS_DEV_ENV_FILE }}" > dapps/pos-app/.env

Suggested change
echo ${{ vars.POS_DEV_ENV_FILE }} >> dapps/pos-app/.env
echo "${{ vars.POS_DEV_ENV_FILE }}" > dapps/pos-app/.env

Copilot uses AI. Check for mistakes.
disable-animations: true
script: |
adb install dapps/pos-app/android/app/build/outputs/apk/release/app-release.apk
$HOME/.maestro/bin/maestro test dapps/pos-app/e2e/ --format junit --output maestro-report.xml
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The maestro command outputs to 'maestro-report.xml' without specifying a directory, which means it will be created in the current working directory. Since the script runs in the emulator context and the working directory is not explicitly set, the output file location may be unpredictable. Consider using an absolute path or explicitly setting the working directory, for example: '$HOME/.maestro/bin/maestro test dapps/pos-app/e2e/ --format junit --output ${{ github.workspace }}/maestro-report.xml'

Suggested change
$HOME/.maestro/bin/maestro test dapps/pos-app/e2e/ --format junit --output maestro-report.xml
$HOME/.maestro/bin/maestro test dapps/pos-app/e2e/ --format junit --output "${{ github.workspace }}/maestro-report.xml"

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +36
# Step 5: Tap QR code to open payment URL in browser
- tapOn:
id: "qr-code"

# Step 6: Verify amount is $0.01
- assertVisible:
text: "0.01 USD"

Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

After tapping the QR code (line 31), the test expects to assert that "0.01 USD" is visible (line 35). However, tapping the QR code opens an external browser via Linking.openURL (as modified in scan.tsx). Maestro may not be able to interact with or assert text in external browser applications, which could cause this test to fail. Consider either: (1) adding a wait/assertion that handles the app context switch, (2) verifying this behavior works in practice, or (3) restructuring the test to avoid relying on external browser interaction.

Suggested change
# Step 5: Tap QR code to open payment URL in browser
- tapOn:
id: "qr-code"
# Step 6: Verify amount is $0.01
- assertVisible:
text: "0.01 USD"
# Step 5: Verify amount is $0.01 while still in the POS app
- assertVisible:
text: "0.01 USD"
# Step 6: Tap QR code to open payment URL in browser
- tapOn:
id: "qr-code"

Copilot uses AI. Check for mistakes.
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.

2 participants