Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
54cf061
chore: added working sample app
ignaciosantise Oct 3, 2025
a0f21d0
chore: WIP github action
ignaciosantise Oct 3, 2025
e8ab7ce
Merge branch 'feat/multichain' into chore/examples
ignaciosantise Oct 6, 2025
ac10788
chore: added useProvider hook usage
ignaciosantise Oct 6, 2025
9233dfd
Merge branch 'feat/multichain' into chore/examples
ignaciosantise Oct 6, 2025
bbd1cb4
chore: updated eas config + added maestro tests
ignaciosantise Oct 7, 2025
59cc2fc
Merge pull request #480 from reown-com/chore/dev-update
ignaciosantise Oct 8, 2025
c0ec849
Merge branch 'develop' into chore/examples
ignaciosantise Oct 9, 2025
5fa1cc2
chore: updated appkit dep
ignaciosantise Oct 9, 2025
aa4bcce
chore: moved test script to root
ignaciosantise Oct 9, 2025
d649ccc
chore: solved issues with expo-ci-cd. disabled on PRs for now
ignaciosantise Oct 9, 2025
ea99a4b
chore: solved snapshot issue
ignaciosantise Oct 9, 2025
6f84246
chore: exclude example app from workspace lint
ignaciosantise Oct 9, 2025
b28dfaf
chore: prettier fixes
ignaciosantise Oct 9, 2025
98a63fe
chore: added chageset file check in snapshot action
ignaciosantise Oct 9, 2025
e202ec6
chore: added changeset test
ignaciosantise Oct 9, 2025
16bede6
chore: remove changeset file
ignaciosantise Oct 9, 2025
a581973
chore: fixed changeset action to comment the pre release version in t…
ignaciosantise Oct 9, 2025
da6d081
chore: removed expo-ci-cd workflow until its fully implemented
ignaciosantise Oct 9, 2025
fed0933
chore: wip ci cd
ignaciosantise Oct 9, 2025
c9694a3
chore: improvements
ignaciosantise Oct 14, 2025
dc60610
Merge pull request #483 from reown-com/chore/examples
ignaciosantise Oct 15, 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
134b0b7
chore: added empty test action
ignaciosantise Oct 16, 2025
364214a
Merge pull request #486 from reown-com/chore/test-action
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
39615c8
Merge pull request #484 from reown-com/chore/cicd
ignaciosantise Oct 21, 2025
27ff3ab
chore(deps): bump hono from 4.9.9 to 4.10.2 in /examples/expo-multichain
dependabot[bot] Oct 22, 2025
b2e4801
chore: export all connected accounts on useAccount hook
ignaciosantise Oct 23, 2025
f65a954
chore: changed branch name in cicd action
ignaciosantise Oct 23, 2025
3097655
Merge pull request #490 from reown-com/chore/test
ignaciosantise Oct 23, 2025
d657f72
chore: added Account type
ignaciosantise Oct 23, 2025
c56583d
Merge pull request #487 from reown-com/dependabot/npm_and_yarn/exampl…
ignaciosantise Oct 23, 2025
a5a8bc9
chore: solve ts issue
ignaciosantise Oct 23, 2025
993c0c1
chore: export useAccount return type
ignaciosantise Oct 30, 2025
940800e
chore: improved hook type
ignaciosantise Oct 30, 2025
e26bb46
chore: improved hook type
ignaciosantise Oct 30, 2025
5366d16
chore: renamed network type
ignaciosantise Oct 30, 2025
56b1e51
feat: accept caipNetworkId as param on appkit.switchNetwork
ignaciosantise Oct 30, 2025
d15641b
chore: fixed test
ignaciosantise Oct 30, 2025
402bb30
chore: removed unused button
ignaciosantise Oct 30, 2025
474a544
chore: changeset file
ignaciosantise Oct 30, 2025
2ad3a7a
chore: added JSDocs + throwing error if network is not found
ignaciosantise Oct 30, 2025
6114f4f
Merge pull request #489 from reown-com/chore/all-accounts
ignaciosantise Oct 30, 2025
79bfff3
Merge pull request #495 from reown-com/feat/switch-chain
ignaciosantise Oct 30, 2025
0e475b6
chore: round qr code logo borders
ignaciosantise Nov 4, 2025
5b8eb47
chore: changeset file
ignaciosantise Nov 4, 2025
a5c2e34
chore: improvements
ignaciosantise Nov 4, 2025
0e2c0ed
chore: qr code improvements
ignaciosantise Nov 5, 2025
20d0d6b
chore: return empty array if not connected
ignaciosantise Nov 5, 2025
fd620bd
chore: added changeset file
ignaciosantise Nov 5, 2025
7d078de
chore: added useAppKitTheme hook
ignaciosantise Nov 5, 2025
43d1579
chore: export hook
ignaciosantise Nov 5, 2025
61a4164
chore: added JSDocs to hooks, improved context check
ignaciosantise Nov 5, 2025
d98d04e
chore: added useAppKitTheme test
ignaciosantise Nov 5, 2025
cbaf886
chore: fix test
ignaciosantise Nov 5, 2025
73cf2e0
chore: changed border radius of logo area
ignaciosantise Nov 13, 2025
95ac83d
fix: renew uri after failure
ignaciosantise Nov 13, 2025
5308d3c
chore: changeset
ignaciosantise Nov 13, 2025
bd88f31
chore: code improvements
ignaciosantise Nov 13, 2025
2d7eb36
chore: code improvements
ignaciosantise Nov 13, 2025
d77095e
chore: adapt screen to large wallet names
ignaciosantise Nov 14, 2025
d8c49ea
fix: solved retry connection logic race condition
ignaciosantise Nov 14, 2025
b92831d
chore: changed border radius of qr code
ignaciosantise Nov 14, 2025
8351447
Merge pull request #497 from reown-com/chore/qr-borders
ignaciosantise Nov 14, 2025
38611b0
Merge pull request #498 from reown-com/fix/use-account-clear
ignaciosantise Nov 14, 2025
da44cdd
chore: fixed useAppKitTheme tests
ignaciosantise Nov 14, 2025
32f6413
Merge branch 'develop' into chore/use-theme-hook
ignaciosantise Nov 14, 2025
67efd2c
chore: made themeVariables default value be an empty object again
ignaciosantise Nov 14, 2025
ab4eec5
chore: changed useAppKitContext error message
ignaciosantise Nov 14, 2025
2cdbf19
Merge pull request #501 from reown-com/fix/renew-uri
ignaciosantise Nov 14, 2025
b9bdeed
chore: added themecontroller tests
ignaciosantise Nov 14, 2025
d4601ce
chore: removed unnecesary undefined
ignaciosantise Nov 14, 2025
a731d15
chore: correctly clean themeVariables if called with setThemeVariable…
ignaciosantise Nov 14, 2025
32e7408
chore: setThemeVariables change
ignaciosantise Nov 14, 2025
048885f
Merge pull request #499 from reown-com/chore/use-theme-hook
ignaciosantise Nov 14, 2025
a2dd045
chore: show rejection alert in case the user rejects the connection
ignaciosantise Nov 14, 2025
99868bb
chore: clear uri on retry
ignaciosantise Nov 14, 2025
b73fdb4
chore: solved dependabot alert
ignaciosantise Nov 14, 2025
4a77f2b
Merge pull request #502 from reown-com/chore/reject-alert
ignaciosantise Nov 14, 2025
4c60b5f
fix: clear old uri before creating a new one on connecting view
ignaciosantise Nov 14, 2025
78d3670
chore: moved lastRetry value to a ref
ignaciosantise Nov 14, 2025
5cb1e29
chore: improved logic
ignaciosantise Nov 14, 2025
56e1c81
Merge pull request #503 from reown-com/fix/clear-old-uri
ignaciosantise Nov 14, 2025
927be36
fix: improved theme logic
ignaciosantise Nov 14, 2025
b599e77
chore: code improvements
ignaciosantise Nov 14, 2025
a7f1584
chore: fixed tests
ignaciosantise Nov 14, 2025
e26d1dd
fix: set NotifyInSync to true to avoid omitting events
normanzb Jan 18, 2026
a73e553
fix: resolve high-severity security vulnerabilities via package resol…
ignaciosantise Jan 22, 2026
4a95d18
fix: remove glob resolution that breaks react-native-builder-bob
ignaciosantise Jan 22, 2026
6389490
chore: add changeset for security vulnerability fixes
ignaciosantise Jan 22, 2026
b5400aa
fix: use js-yaml 3.14.2 instead of 4.1.1 to maintain API compatibility
ignaciosantise Jan 22, 2026
64982b0
chore: fix changeset and remove unnecessary hono resolution
ignaciosantise Jan 22, 2026
1af79f2
Merge pull request #522 from reown-com/fix-security-vulnerabilities
ignaciosantise Jan 22, 2026
4d4a5e8
docs: add AGENTS.md and CLAUDE.md for SDK documentation
ignaciosantise Jan 22, 2026
4fa9136
docs: address PR review comments in AGENTS.md
ignaciosantise Jan 22, 2026
37dd058
style: fix prettier formatting in AGENTS.md
ignaciosantise Jan 22, 2026
36db6f7
style: additional prettier formatting fixes
ignaciosantise Jan 22, 2026
404e053
Merge pull request #524 from reown-com/agents-md-setup
ignaciosantise Jan 22, 2026
d560fe5
chore: resolve dependabot alerts for storybook and lodash
ignaciosantise Jan 22, 2026
6b1867a
style: add formatting guidance to AGENTS.md
ignaciosantise Jan 22, 2026
f69b234
Merge pull request #525 from reown-com/fix-alerts
ignaciosantise Jan 22, 2026
43a068e
chore: code improvements
ignaciosantise Jan 22, 2026
1300478
Save work before archive
ignaciosantise Jan 22, 2026
f407f35
refactor: remove redundant useColorScheme from ThemeContext
ignaciosantise Jan 26, 2026
389a336
chore: solved prettier issue
ignaciosantise Jan 26, 2026
5714a28
refactor: replace derive-valtio with native getter for themeMode
ignaciosantise Jan 26, 2026
269638e
Merge pull request #504 from reown-com/fix/theme
ignaciosantise Jan 26, 2026
d6403a6
format using prettier
normanzb Jan 27, 2026
31a73c5
added changeset file
ignaciosantise Jan 28, 2026
4206cca
Merge pull request #519 from normanzb/avoid-drop-evt
ignaciosantise Jan 28, 2026
2101e80
feat: support custom wagmi connectors in WagmiAdapter constructor
ignaciosantise Feb 12, 2026
3bd49d8
chore: remove unnecessary security changeset
ignaciosantise Feb 12, 2026
77a2d2e
fix: use correct PR for prerelease comments and add Slack notifications
ignaciosantise Feb 12, 2026
92fdf6e
fix: gate notifications on publish success and add continue-on-error
ignaciosantise Feb 12, 2026
c032ff9
Merge pull request #530 from reown-com/custom-connectors
ignaciosantise Feb 12, 2026
3f39561
Merge pull request #531 from reown-com/fix-prerelease-pr-comment
ignaciosantise Feb 12, 2026
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
13 changes: 13 additions & 0 deletions .changeset/cool-parks-slide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@reown/appkit-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-bitcoin-react-native': patch
'@reown/appkit-coinbase-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-solana-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-wagmi-react-native': patch
---

fix: renew uri after failure
5 changes: 5 additions & 0 deletions .changeset/custom-wagmi-connectors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@reown/appkit-wagmi-react-native': patch
---

feat: support custom wagmi connectors in WagmiAdapter constructor
13 changes: 13 additions & 0 deletions .changeset/eager-walls-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@reown/appkit-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-bitcoin-react-native': patch
'@reown/appkit-coinbase-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-solana-react-native': patch
'@reown/appkit-wagmi-react-native': patch
---

chore: round logo from qr code + added borderWidth 0 to card component
13 changes: 13 additions & 0 deletions .changeset/hot-chefs-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@reown/appkit-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-bitcoin-react-native': patch
'@reown/appkit-coinbase-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-solana-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-wagmi-react-native': patch
---

fix: in EventsController, set `NotifyInSync` to true to avoid omitting events
13 changes: 13 additions & 0 deletions .changeset/late-queens-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@reown/appkit-react-native': patch
'@reown/appkit-bitcoin-react-native': patch
'@reown/appkit-coinbase-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-solana-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-wagmi-react-native': patch
---

fix: refactors the theme management logic to introduce a clearer separation between system theme and user-defined default theme
13 changes: 13 additions & 0 deletions .changeset/spotty-foxes-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@reown/appkit-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-bitcoin-react-native': patch
'@reown/appkit-coinbase-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-solana-react-native': patch
'@reown/appkit-wagmi-react-native': patch
---

chore: added useAppKitTheme hook
13 changes: 13 additions & 0 deletions .changeset/spotty-pigs-read.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@reown/appkit-react-native': patch
'@reown/appkit-bitcoin-react-native': patch
'@reown/appkit-coinbase-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-solana-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-wagmi-react-native': patch
---

chore: updated the switchNetwork to accept a CAIP network ID string
13 changes: 13 additions & 0 deletions .changeset/stupid-cloths-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@reown/appkit-react-native': patch
'@reown/appkit-bitcoin-react-native': patch
'@reown/appkit-coinbase-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-solana-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-wagmi-react-native': patch
---

chore: export account list on useAccount hook
13 changes: 13 additions & 0 deletions .changeset/yellow-streets-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@reown/appkit-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-bitcoin-react-native': patch
'@reown/appkit-coinbase-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-solana-react-native': patch
'@reown/appkit-wagmi-react-native': patch
---

fix: useAccount hook now returns empty array if appkit is not connected
11 changes: 10 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{
"root": true,
"extends": ["@react-native", "prettier", "plugin:valtio/recommended"],
"ignorePatterns": ["node_modules/", "build/", "lib/", "dist/", ".turbo", ".expo", "out/"],
"ignorePatterns": [
"node_modules/",
"build/",
"lib/",
"dist/",
".turbo",
".expo",
"out/",
"examples/"
],
"rules": {
"react/react-in-jsx-scope": 0,
"no-duplicate-imports": "error",
Expand Down
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##*:}"

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

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