Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9a904da
formatting and small updates
piotr-iohk Jan 7, 2026
41209d7
basic migration scenarios for android
piotr-iohk Jan 7, 2026
d5fb90a
bitkit RN build script
piotr-iohk Jan 8, 2026
f402f9d
adjustments for iOS
piotr-iohk Jan 8, 2026
35fbe5c
formatting
piotr-iohk Jan 8, 2026
cd425e4
adjust verify tx details
piotr-iohk Jan 8, 2026
f78caad
attempt to use regtest and local backend
piotr-iohk Jan 8, 2026
37cd7af
ensureLocalFunds and rpc initialization
piotr-iohk Jan 8, 2026
fe63858
electrum noop for regtest
piotr-iohk Jan 8, 2026
891b768
formatting and small updates
piotr-iohk Jan 7, 2026
8d6c680
basic migration scenarios for android
piotr-iohk Jan 7, 2026
2efc644
bitkit RN build script
piotr-iohk Jan 8, 2026
226036e
adjustments for iOS
piotr-iohk Jan 8, 2026
491bbe8
formatting
piotr-iohk Jan 8, 2026
743a34f
adjust verify tx details
piotr-iohk Jan 8, 2026
fe881b7
Merge branch 'test/migration-android' into feat/regtest-e2e-testing
piotr-iohk Jan 8, 2026
7f4518c
stability
piotr-iohk Jan 9, 2026
b18ac47
Merge pull request #96 from synonymdev/feat/regtest-e2e-testing
piotr-iohk Jan 9, 2026
e9d5fc2
basic migration android
piotr-iohk Jan 9, 2026
5cdbe5c
additional scenarios with passphrase
piotr-iohk Jan 12, 2026
17c5d6b
remove Migration Complete toast check
piotr-iohk Jan 12, 2026
29260f3
update titles
piotr-iohk Jan 12, 2026
01a73de
update readme and agents
piotr-iohk Jan 13, 2026
f0a6c83
agents + readme
piotr-iohk Jan 13, 2026
e62474f
formatting
piotr-iohk Jan 13, 2026
5bb4a39
change waitForIdleTimeout
piotr-iohk Jan 13, 2026
4ff907c
adjust swipeFullScreen for RN
piotr-iohk Jan 13, 2026
78000e2
update migration scenarios to have sent tx and tags
piotr-iohk Jan 13, 2026
abda239
adjust swipe for RN with params
piotr-iohk Jan 13, 2026
f90fd7f
adjustments
piotr-iohk Jan 13, 2026
56da316
getRnMnemonic stability
piotr-iohk Jan 13, 2026
00256a5
sleep a bit to ensure RN backup
piotr-iohk Jan 13, 2026
c4429dd
tag tx after
piotr-iohk Jan 13, 2026
4b43f20
simplify rn tagging
piotr-iohk Jan 13, 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
23 changes: 22 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,54 @@ Notes:

## Running Tests

**Important:** The `BACKEND` env var controls which infrastructure the tests use for deposits/mining:

- `BACKEND=local` (default) — Uses local docker stack (Bitcoin RPC on localhost:18443, Electrum on localhost:60001). Requires `bitkit-docker` running locally.
- `BACKEND=regtest` — Uses Blocktank API over the internet (remote regtest infrastructure).

**The `BACKEND` must match how the app was built:**

- Apps built with `BACKEND=local` connect to localhost electrum → run tests with `BACKEND=local`
- Apps built with `BACKEND=regtest` connect to remote electrum → run tests with `BACKEND=regtest`

```bash
# Android
# Android (local backend - default)
npm run e2e:android

# Android (regtest backend - for apps built with BACKEND=regtest)
BACKEND=regtest npm run e2e:android

# iOS
npm run e2e:ios
BACKEND=regtest npm run e2e:ios
```

Run a single spec:

```bash
npm run e2e:android -- --spec ./test/specs/onboarding.e2e.ts
BACKEND=regtest npm run e2e:android -- --spec ./test/specs/migration.e2e.ts
```

Run by tag:

```bash
npm run e2e:android -- --mochaOpts.grep "@backup"
BACKEND=regtest npm run e2e:android -- --mochaOpts.grep "@migration"
```

## CI Helper Scripts

These wrap the `npm run e2e:*` commands and capture logs/artifacts:

```bash
# Local backend (default)
./ci_run_android.sh
./ci_run_ios.sh

# Regtest backend
BACKEND=regtest ./ci_run_android.sh
BACKEND=regtest ./ci_run_ios.sh
```

## Practical Tips
Expand Down
39 changes: 35 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ If you have `bitkit-e2e-tests`, `bitkit-android`, and `bitkit-ios` checked out i
# Legacy RN Android (builds ../bitkit and copies APK to ./aut/bitkit_rn_regtest.apk)
./scripts/build-rn-android-apk.sh

# Legacy RN iOS simulator (builds ../bitkit and copies app to ./aut/bitkit_rn_regtest_ios.app)
./scripts/build-rn-ios-sim.sh

# iOS (builds ../bitkit-ios and copies IPA to ./aut/bitkit_e2e.ipa)
./scripts/build-ios-sim.sh
```
Expand All @@ -73,6 +76,9 @@ BACKEND=regtest ./scripts/build-android-apk.sh
# Legacy RN Android
BACKEND=regtest ./scripts/build-rn-android-apk.sh

# Legacy RN iOS simulator
BACKEND=regtest ./scripts/build-rn-ios-sim.sh

# iOS
BACKEND=local ./scripts/build-ios-sim.sh
BACKEND=regtest ./scripts/build-ios-sim.sh
Expand All @@ -82,18 +88,34 @@ BACKEND=regtest ./scripts/build-ios-sim.sh

### 🧪 Running tests

**Important:** The `BACKEND` environment variable controls which infrastructure the tests use for blockchain operations (deposits, mining blocks):

| Backend | Infrastructure | When to use |
| ------------------------- | -------------------------------------------------------------------------------- | --------------------------------- |
| `BACKEND=local` (default) | Local docker stack (Bitcoin RPC on localhost:18443, Electrum on localhost:60001) | Apps built with `BACKEND=local` |
| `BACKEND=regtest` | Blocktank API over the internet (remote regtest) | Apps built with `BACKEND=regtest` |

> ⚠️ **The `BACKEND` must match how the app was built.** If the app connects to remote electrum, use `BACKEND=regtest`. If it connects to localhost, use `BACKEND=local`.

```bash
# Run all tests on Android
# Run all tests on Android (local backend - default)
npm run e2e:android

# Run all tests on Android (regtest backend)
BACKEND=regtest npm run e2e:android

# Run all tests on iOS
npm run e2e:ios
BACKEND=regtest npm run e2e:ios
```

To run a **specific test file**:

```bash
npm run e2e:android -- --spec ./test/specs/onboarding.e2e.ts

# With regtest backend
BACKEND=regtest npm run e2e:android -- --spec ./test/specs/migration.e2e.ts
```

To run a **specific test case**:
Expand Down Expand Up @@ -142,19 +164,25 @@ These helper scripts wrap the regular `npm run e2e:*` commands and add CI-friend
The Android script will:

- Clear and capture `adb logcat` output into `./artifacts/logcat.txt`.
- Reverse the regtest port (`60001`).
- Reverse the regtest port (`60001`) for local backend.
- Run the Android E2E tests.
- Forward any arguments directly to Mocha/WebdriverIO.

**Usage examples:**

```bash
# Run all Android tests (with logcat capture)
# Run all Android tests with local backend (default)
./ci_run_android.sh

# Run all Android tests with regtest backend (for apps built with BACKEND=regtest)
BACKEND=regtest ./ci_run_android.sh

# Run only @backup tests
./ci_run_android.sh --mochaOpts.grep "@backup"

# Run migration tests (typically need regtest backend for RN app)
BACKEND=regtest ./ci_run_android.sh --mochaOpts.grep "@migration"

# Run backup OR onboarding OR onchain tests
./ci_run_android.sh --mochaOpts.grep "@backup|@onboarding|@onchain"

Expand All @@ -177,9 +205,12 @@ The iOS helper mirrors the Android workflow but tailors it for the Apple Simulat
**Usage examples:**

```bash
# Run all iOS tests (with simulator log capture)
# Run all iOS tests with local backend (default)
./ci_run_ios.sh

# Run all iOS tests with regtest backend
BACKEND=regtest ./ci_run_ios.sh

# Run only @onboarding-tagged tests
./ci_run_ios.sh --mochaOpts.grep "@onboarding"

Expand Down
2 changes: 1 addition & 1 deletion scripts/build-rn-android-apk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fi

if [[ -z "${ENV_FILE:-}" ]]; then
if [[ "$BACKEND" == "regtest" ]]; then
ENV_FILE=".env.test.template"
ENV_FILE=".env.development.template"
else
ENV_FILE=".env.development"
fi
Expand Down
73 changes: 73 additions & 0 deletions scripts/build-rn-ios-sim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env bash
# Build the legacy Bitkit RN iOS simulator app from ../bitkit and copy into aut/
#
# Inputs/roots:
# - E2E root: this repo (bitkit-e2e-tests)
# - RN root: ../bitkit (resolved relative to this script)
#
# Output:
# - Copies .app -> aut/bitkit_rn_regtest_ios.app
#
# Usage:
# ./scripts/build-rn-ios-sim.sh [debug|release]
# BACKEND=regtest ./scripts/build-rn-ios-sim.sh
# ENV_FILE=.env.test.template ./scripts/build-rn-ios-sim.sh
set -euo pipefail

E2E_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
RN_ROOT="$(cd "$E2E_ROOT/../bitkit" && pwd)"

BUILD_TYPE="${1:-debug}"
BACKEND="${BACKEND:-regtest}"

if [[ "$BUILD_TYPE" != "debug" && "$BUILD_TYPE" != "release" ]]; then
echo "ERROR: Unsupported build type: $BUILD_TYPE (expected debug|release)" >&2
exit 1
fi

if [[ -z "${ENV_FILE:-}" ]]; then
if [[ "$BACKEND" == "regtest" ]]; then
ENV_FILE=".env.development.template"
else
ENV_FILE=".env.development"
fi
fi

if [[ ! -f "$RN_ROOT/$ENV_FILE" ]]; then
echo "ERROR: Env file not found: $RN_ROOT/$ENV_FILE" >&2
exit 1
fi

echo "Building RN iOS simulator app (BACKEND=$BACKEND, ENV_FILE=$ENV_FILE, BUILD_TYPE=$BUILD_TYPE)..."

pushd "$RN_ROOT" >/dev/null
if [[ -f .env ]]; then
cp .env .env.bak
fi
cp "$ENV_FILE" .env
E2E_TESTS=true yarn "e2e:build:ios-$BUILD_TYPE"
if [[ -f .env.bak ]]; then
mv .env.bak .env
else
rm -f .env
fi
popd >/dev/null

if [[ "$BUILD_TYPE" == "debug" ]]; then
IOS_CONFIG="Debug"
else
IOS_CONFIG="Release"
fi

APP_PATH="$RN_ROOT/ios/build/Build/Products/${IOS_CONFIG}-iphonesimulator/bitkit.app"
if [[ ! -d "$APP_PATH" ]]; then
echo "ERROR: iOS .app not found at: $APP_PATH" >&2
exit 1
fi

OUT="$E2E_ROOT/aut"
mkdir -p "$OUT"
OUT_APP="$OUT/bitkit_rn_${BACKEND}_ios.app"
rm -rf "$OUT_APP"
cp -R "$APP_PATH" "$OUT_APP"
echo "RN iOS simulator app copied to: $OUT_APP"
Loading