-
Notifications
You must be signed in to change notification settings - Fork 39
chore: added workflow for e2e tests + new tests #484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 49d3d45
Merge branch 'develop' into chore/cicd
ignaciosantise 44a8a99
chore: building packages locally instead of uploading a snapshot + do…
ignaciosantise 3f2d933
chore: workflow improvements
ignaciosantise f04f28f
chore: workflow improvements
ignaciosantise 4c505db
chore: use commit sha for expo action
ignaciosantise 168e061
chore: improved skip-ci step
ignaciosantise 33c08ee
chore: workflow improvements
ignaciosantise 2a7ac02
chore: added new tests
ignaciosantise 9055e78
chore: changed aws credentials action version, fixed testIDs
ignaciosantise 6144a24
chore: trivial commit
ignaciosantise 3958a6d
chore: added working dir before installing app deps
ignaciosantise a8b3d6e
chore: changed wallet sample package name
ignaciosantise b206fd5
chore: build time improvements
ignaciosantise c2a3e73
chore: removed build artifact upload
ignaciosantise bec85cd
chore: workflow fix
ignaciosantise 16ef3c3
chore: build locally without eas build
ignaciosantise 19da7ef
chore: ci improvements
ignaciosantise 7c5cc55
chore: fixed gradle command
ignaciosantise 52d3d66
chore: removed pod install step as its installed in prebuild
ignaciosantise 4694c5d
chore: upload only artifacts from maestro folder
ignaciosantise cd49318
chore: save cache despite build and test results
ignaciosantise 6f39039
chore: changed ios simulator
ignaciosantise 25c5321
chore: workflow changes
ignaciosantise 58436de
chore: updated macos runner
ignaciosantise c906a9a
chore: upload maestro artifacts correctly
ignaciosantise 0d08c4a
chore: added project id to workflow
ignaciosantise a66b6ad
chore: changed maestro command and screenshot path
ignaciosantise 198ac34
chore: disable tests to save cache
ignaciosantise 14d1e42
chore: disable slack messages
ignaciosantise f7173b5
chore: enable maestro tests on android
ignaciosantise 5c52e9f
chore: maestro path changes
ignaciosantise e1b2537
chore: fixed qr load video path
ignaciosantise 5213076
chore: fixed tests
ignaciosantise 67b31b0
chore: enabled test on ios
ignaciosantise 2c6c81f
chore: test changes
ignaciosantise 24f24d4
chore: test changes
ignaciosantise 3879fb4
chore: changes in screenshots path
ignaciosantise da6f1e7
chore: changed onramp text
ignaciosantise 1b97daf
chore: onramp test changes
ignaciosantise d4d01aa
chore: install new packages after restoring cache
ignaciosantise afcf35b
chore: added input to upload artifacts + scoped aws env variables
ignaciosantise dc7db89
chore: changed derived data path for cache
ignaciosantise 1b8f5f3
chore: changed maestro upload folder
ignaciosantise b80b244
chore: added retry logic if a test fails
ignaciosantise b4e8bf1
chore: enable slack notifications + workflow runs on PRs and pushes
ignaciosantise 479650a
chore: run ci on PR open only
ignaciosantise 66abece
chore: improved slack notification
ignaciosantise 9166a3b
chore: changed maestro upload path
ignaciosantise 223a301
chore: changed maestro upload path
ignaciosantise 66f6ca3
Merge branch 'develop' into chore/cicd
ignaciosantise File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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##*:}" | ||
|
|
||
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Missing Test Script Causes Workflow FailureBoth Additional Locations (1) |
||
|
|
||
| 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 ===" | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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