Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
fed0933
chore: wip ci cd
ignaciosantise Oct 9, 2025
49d3d45
Merge branch 'develop' into chore/cicd
ignaciosantise Oct 15, 2025
44a8a99
chore: building packages locally instead of uploading a snapshot + do…
ignaciosantise Oct 15, 2025
3f2d933
chore: workflow improvements
ignaciosantise Oct 15, 2025
f04f28f
chore: workflow improvements
ignaciosantise Oct 15, 2025
4c505db
chore: use commit sha for expo action
ignaciosantise Oct 15, 2025
168e061
chore: improved skip-ci step
ignaciosantise Oct 15, 2025
33c08ee
chore: workflow improvements
ignaciosantise Oct 15, 2025
2a7ac02
chore: added new tests
ignaciosantise Oct 15, 2025
9055e78
chore: changed aws credentials action version, fixed testIDs
ignaciosantise Oct 16, 2025
6144a24
chore: trivial commit
ignaciosantise Oct 16, 2025
3958a6d
chore: added working dir before installing app deps
ignaciosantise Oct 16, 2025
a8b3d6e
chore: changed wallet sample package name
ignaciosantise Oct 16, 2025
b206fd5
chore: build time improvements
ignaciosantise Oct 16, 2025
c2a3e73
chore: removed build artifact upload
ignaciosantise Oct 16, 2025
bec85cd
chore: workflow fix
ignaciosantise Oct 16, 2025
16ef3c3
chore: build locally without eas build
ignaciosantise Oct 16, 2025
19da7ef
chore: ci improvements
ignaciosantise Oct 16, 2025
7c5cc55
chore: fixed gradle command
ignaciosantise Oct 16, 2025
52d3d66
chore: removed pod install step as its installed in prebuild
ignaciosantise Oct 16, 2025
4694c5d
chore: upload only artifacts from maestro folder
ignaciosantise Oct 16, 2025
cd49318
chore: save cache despite build and test results
ignaciosantise Oct 16, 2025
6f39039
chore: changed ios simulator
ignaciosantise Oct 16, 2025
25c5321
chore: workflow changes
ignaciosantise Oct 17, 2025
58436de
chore: updated macos runner
ignaciosantise Oct 17, 2025
c906a9a
chore: upload maestro artifacts correctly
ignaciosantise Oct 17, 2025
0d08c4a
chore: added project id to workflow
ignaciosantise Oct 17, 2025
a66b6ad
chore: changed maestro command and screenshot path
ignaciosantise Oct 17, 2025
198ac34
chore: disable tests to save cache
ignaciosantise Oct 17, 2025
14d1e42
chore: disable slack messages
ignaciosantise Oct 17, 2025
f7173b5
chore: enable maestro tests on android
ignaciosantise Oct 17, 2025
5c52e9f
chore: maestro path changes
ignaciosantise Oct 17, 2025
e1b2537
chore: fixed qr load video path
ignaciosantise Oct 17, 2025
5213076
chore: fixed tests
ignaciosantise Oct 17, 2025
67b31b0
chore: enabled test on ios
ignaciosantise Oct 17, 2025
2c6c81f
chore: test changes
ignaciosantise Oct 20, 2025
24f24d4
chore: test changes
ignaciosantise Oct 20, 2025
3879fb4
chore: changes in screenshots path
ignaciosantise Oct 20, 2025
da6f1e7
chore: changed onramp text
ignaciosantise Oct 20, 2025
1b97daf
chore: onramp test changes
ignaciosantise Oct 20, 2025
d4d01aa
chore: install new packages after restoring cache
ignaciosantise Oct 20, 2025
afcf35b
chore: added input to upload artifacts + scoped aws env variables
ignaciosantise Oct 20, 2025
dc7db89
chore: changed derived data path for cache
ignaciosantise Oct 20, 2025
1b8f5f3
chore: changed maestro upload folder
ignaciosantise Oct 20, 2025
b80b244
chore: added retry logic if a test fails
ignaciosantise Oct 20, 2025
b4e8bf1
chore: enable slack notifications + workflow runs on PRs and pushes
ignaciosantise Oct 20, 2025
479650a
chore: run ci on PR open only
ignaciosantise Oct 20, 2025
66abece
chore: improved slack notification
ignaciosantise Oct 20, 2025
9166a3b
chore: changed maestro upload path
ignaciosantise Oct 20, 2025
223a301
chore: changed maestro upload path
ignaciosantise Oct 20, 2025
66f6ca3
Merge branch 'develop' into chore/cicd
ignaciosantise Oct 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 231 additions & 0 deletions .github/scripts/run-android-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
#!/bin/bash
set -e # Exit on error
set -x # Print commands

###############################################################################
# Android Emulator Test Runner
#
# This script installs apps on Android emulator, captures debug info,
# and runs Maestro tests.
#
# Usage: ./run-android-tests.sh <working-directory>
###############################################################################

WORKING_DIR="${1:-.}"
DEBUG_DIR="$WORKING_DIR/debug-artifacts"
APP_PACKAGE="com.reown.appkit.expomultichain"
WALLET_PACKAGE="com.walletconnect.web3wallet.rnsample.internal"

###############################################################################
# Setup and Preparation
###############################################################################

echo "Setting up debug directory..."
mkdir -p "$DEBUG_DIR"

echo "Waiting for emulator to be ready..."
adb wait-for-device

echo "Waiting for boot completion..."
adb shell 'while [ "$(getprop sys.boot_completed)" != "1" ]; do sleep 2; done'
echo "Boot completed!"
adb devices

###############################################################################
# Start Logcat Capture
###############################################################################

echo "Starting logcat capture..."
adb logcat -c
adb logcat > "$DEBUG_DIR/full-logcat.txt" &
LOGCAT_PID=$!

# Ensure logcat is killed on script exit
trap "kill $LOGCAT_PID 2>/dev/null || true" EXIT

###############################################################################
# Install Applications
###############################################################################

echo "Installing APKs..."
adb install -r "$WORKING_DIR/app-dev.apk"
adb install -r "$WORKING_DIR/wallet.apk"

echo "Verifying app installation..."
if ! adb shell pm list packages | grep -q "$APP_PACKAGE"; then
echo "ERROR: App not installed correctly"
exit 1
fi

if ! adb shell pm list packages | grep -q "$WALLET_PACKAGE"; then
echo "ERROR: Wallet not installed correctly"
exit 1
fi

echo "Checking APK details:"
adb shell dumpsys package "$APP_PACKAGE" | grep -A 5 "versionName" || true

echo "Clearing app data for clean state..."
adb shell pm clear "$APP_PACKAGE" || true

echo "Waiting for system to settle..."
sleep 5

###############################################################################
# Capture Debug Information
###############################################################################

echo "=== CAPTURING DEBUG INFO ==="

# Network state (critical for WalletConnect)
echo "Capturing network state..."
{
echo "Network state:"
adb shell dumpsys connectivity
adb shell settings get global airplane_mode_on
} > "$DEBUG_DIR/network_state.txt"

# Memory info
echo "Capturing memory info..."
adb shell dumpsys meminfo "$APP_PACKAGE" > "$DEBUG_DIR/meminfo.txt" || true

# Process info
echo "Capturing process info..."
adb shell ps | grep reown > "$DEBUG_DIR/processes.txt" || true

# Manual app launch test
echo "Attempting manual app launch..."
adb shell monkey -p "$APP_PACKAGE" -c android.intent.category.LAUNCHER 1
sleep 5

# Verify app is running
if ! adb shell ps | grep -q "$APP_PACKAGE"; then
echo "WARNING: App may not be running"
fi

# Screenshot before tests
echo "Taking screenshot..."
adb shell screencap /sdcard/app_state_before_maestro.png
adb pull /sdcard/app_state_before_maestro.png "$DEBUG_DIR/" || true

# Current activity
echo "Current activity before Maestro:"
adb shell dumpsys activity activities | grep -E "mResumedActivity|mFocusedActivity" || true

###############################################################################
# Run Maestro Tests
###############################################################################

echo "=== RUNNING MAESTRO TESTS ==="

# Track test results for GitHub Actions output
# Define tests array: filename:display_name
tests=(
"basic-smoke-test:Basic Smoke Test"
"wallet-qr-load:Wallet QR Load"
"switch-network:Switch Network"
"account-activity:Account Activity"
"send:Send"
"swaps:Swaps"
"onramp:Onramp"
)

# Initialize result tracking
test_results=""
failed_tests=""
passed_count=0
failed_count=0

# Run each test and track results
MAX_RETRIES=2

for test_pair in "${tests[@]}"; do
test_file="${test_pair%%:*}"
test_name="${test_pair##*:}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: External URL Security Review Needed

External Domain URL Detected: https://get.maestro.mobile.dev - 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

Fix in Cursor Fix in Web

echo ""
echo "📱 Running $test_name..."

# Record start time
start_time=$(date +%s)

# Retry logic
attempt=0
test_passed=false

while [ $attempt -le $MAX_RETRIES ]; do
if [ $attempt -gt 0 ]; then
echo "⚠️ Retry attempt $attempt for $test_name..."
sleep 3 # Brief pause between retries
fi

if (cd "$WORKING_DIR/.maestro" && maestro test "$test_file.yaml"); then
test_passed=true
break
else
attempt=$((attempt + 1))
fi
done

end_time=$(date +%s)
duration=$((end_time - start_time))

if [ "$test_passed" = true ]; then
echo "✅ $test_name passed (${duration}s)"
if [ $attempt -gt 0 ]; then
test_results="${test_results}✅ $test_name (${duration}s, passed after $attempt retries)\n"
else
test_results="${test_results}✅ $test_name (${duration}s)\n"
fi
passed_count=$((passed_count + 1))
else
echo "❌ $test_name failed after $MAX_RETRIES retries (${duration}s)"
test_results="${test_results}❌ $test_name (${duration}s, failed after $MAX_RETRIES retries)\n"
failed_tests="${failed_tests}• $test_name\n"
failed_count=$((failed_count + 1))
fi
done

# Output results to GitHub Actions
if [ -n "$GITHUB_OUTPUT" ]; then
echo "test_results<<EOF" >> "$GITHUB_OUTPUT"
echo -e "$test_results" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"

echo "failed_tests<<EOF" >> "$GITHUB_OUTPUT"
echo -e "$failed_tests" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"

echo "passed_count=$passed_count" >> "$GITHUB_OUTPUT"
echo "failed_count=$failed_count" >> "$GITHUB_OUTPUT"
fi

# Print summary
echo ""
echo "=== TEST SUMMARY ==="
echo "Passed: $passed_count"
echo "Failed: $failed_count"
echo ""
echo -e "$test_results"

# Exit with error if any tests failed
if [ $failed_count -gt 0 ]; then
echo "Some tests failed"
exit 1
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Missing Test Script Causes Workflow Failure

Both run-ios-tests.sh and run-android-tests.sh scripts depend on a .maestro/run-tests.sh file that isn't created or provided by the workflow. This causes the test execution to fail when attempting to use the missing script.

Additional Locations (1)

Fix in Cursor Fix in Web


echo "All tests passed! ✓"

###############################################################################
# Post-Test Diagnostics
###############################################################################

echo "Checking for crashes..."
if adb logcat -d | grep -E "FATAL EXCEPTION|AndroidRuntime|Process:.*com.reown" > "$DEBUG_DIR/crashes.txt"; then
echo "WARNING: Crashes detected, check $DEBUG_DIR/crashes.txt"
else
echo "No crashes found" > "$DEBUG_DIR/crashes.txt"
fi

echo "=== TEST RUN COMPLETE ==="

Loading
Loading