Skip to content

Commit 1ba7b12

Browse files
authored
Merge pull request #89 from synonymdev/feat/e2e-beyond-local
Adjust ios build script to support regtest
2 parents 4ec4ba6 + 854c5c0 commit 1ba7b12

File tree

3 files changed

+106
-10
lines changed

3 files changed

+106
-10
lines changed

AGENTS.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to AI agents (Codex/Claude/Cursor/WARP) working in this repository.
4+
5+
## Purpose
6+
7+
Bitkit E2E tests for:
8+
- **bitkit-android** (native Android app)
9+
- **bitkit-ios** (native iOS app)
10+
11+
For local work, keep `bitkit-e2e-tests`, `bitkit-android`, and `bitkit-ios` checked out in the same parent directory.
12+
13+
## Key Paths
14+
15+
- `aut/` — built app artifacts used by tests (`bitkit_e2e.apk`, `Bitkit.app`)
16+
- `artifacts/` — screenshots/videos/logs from test runs
17+
- `test/specs/` — E2E specs
18+
- `test/helpers/` — helper utilities (selectors, actions)
19+
- `wdio.conf.ts` — WebdriverIO/Appium config
20+
21+
## Local Build Helpers
22+
23+
Android (builds from `../bitkit-android`, copies APK to `./aut/bitkit_e2e.apk`):
24+
25+
```bash
26+
./scripts/build-android-apk.sh
27+
28+
# backend selection (local is default)
29+
BACKEND=regtest ./scripts/build-android-apk.sh
30+
```
31+
32+
iOS (builds from `../bitkit-ios`, copies app to `./aut/Bitkit.app`):
33+
34+
```bash
35+
./scripts/build-ios-sim.sh
36+
37+
# backend selection (local is default)
38+
BACKEND=regtest ./scripts/build-ios-sim.sh
39+
```
40+
41+
Notes:
42+
- `BACKEND=local` uses local Electrum (default).
43+
- `BACKEND=regtest` sets network Electrum against regtest.
44+
45+
## Running Tests
46+
47+
```bash
48+
# Android
49+
npm run e2e:android
50+
51+
# iOS
52+
npm run e2e:ios
53+
```
54+
55+
Run a single spec:
56+
57+
```bash
58+
npm run e2e:android -- --spec ./test/specs/onboarding.e2e.ts
59+
```
60+
61+
Run by tag:
62+
63+
```bash
64+
npm run e2e:android -- --mochaOpts.grep "@backup"
65+
```
66+
67+
## CI Helper Scripts
68+
69+
These wrap the `npm run e2e:*` commands and capture logs/artifacts:
70+
71+
```bash
72+
./ci_run_android.sh
73+
./ci_run_ios.sh
74+
```
75+
76+
## Practical Tips
77+
78+
- The tests expect built artifacts in `./aut`.
79+
- Use `ciIt()` in specs (not `it()`) to enable CI retry-skipping behavior.
80+
- Keep Android/iOS platform differences behind helpers in `test/helpers/`.

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test/
5050

5151
### 🧱 Build apps locally (Android/iOS)
5252

53-
If you have `bitkit-e2e-tests`, `bitkit-android`, and `bitkit-ios` checked out in the same parent directory, you can use the helper scripts to build local artifacts. The outputs land in `./aut` and are ready to be tested.
53+
If you have `bitkit-e2e-tests`, `bitkit-android`, and `bitkit-ios` checked out in the same parent directory, you can use the helper scripts to build local artifacts (local Electrum by default). The outputs land in `./aut` and are ready to be tested.
5454

5555
```bash
5656
# Android (builds ../bitkit-android and copies APK to ./aut/bitkit_e2e.apk)
@@ -60,14 +60,16 @@ If you have `bitkit-e2e-tests`, `bitkit-android`, and `bitkit-ios` checked out i
6060
./scripts/build-ios-sim.sh
6161
```
6262

63-
Optional Android backend selection:
63+
Optional backend selection (`BACKEND=local` is default and can be omitted):
6464

6565
```bash
66-
# local Electrum (default)
67-
./scripts/build-android-apk.sh
68-
69-
# regtest Electrum (network)
66+
# Android
67+
BACKEND=local ./scripts/build-android-apk.sh
7068
BACKEND=regtest ./scripts/build-android-apk.sh
69+
70+
# iOS
71+
BACKEND=local ./scripts/build-ios-sim.sh
72+
BACKEND=regtest ./scripts/build-ios-sim.sh
7173
```
7274

7375
---

scripts/build-ios-sim.sh

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,31 @@
1313
#
1414
# Usage:
1515
# ./scripts/build-ios-sim.sh
16+
# BACKEND=regtest ./scripts/build-ios-sim.sh
1617
set -euo pipefail
1718
E2E_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
1819
IOS_ROOT="$(cd "$E2E_ROOT/../bitkit-ios" && pwd)"
1920

20-
# Default to E2E build unless explicitly disabled.
21-
E2E_FLAG="${E2E:-true}"
21+
BACKEND="${BACKEND:-local}"
22+
E2E_BACKEND="local"
23+
E2E_NETWORK="regtest"
2224
XCODE_EXTRA_ARGS=()
23-
if [[ "$E2E_FLAG" == "true" ]]; then
24-
XCODE_EXTRA_ARGS+=(SWIFT_ACTIVE_COMPILATION_CONDITIONS='$(inherited) E2E_BUILD')
25+
26+
if [[ "$BACKEND" == "regtest" ]]; then
27+
E2E_BACKEND="network"
28+
elif [[ "$BACKEND" == "local" ]]; then
29+
E2E_BACKEND="local"
30+
else
31+
echo "ERROR: Unsupported BACKEND value: $BACKEND" >&2
32+
exit 1
2533
fi
2634

35+
XCODE_EXTRA_ARGS+=(
36+
"E2E_BACKEND=$E2E_BACKEND"
37+
"E2E_NETWORK=$E2E_NETWORK"
38+
"SWIFT_ACTIVE_COMPILATION_CONDITIONS=\$(inherited) E2E_BUILD"
39+
)
40+
2741
xcodebuild \
2842
-project "$IOS_ROOT/Bitkit.xcodeproj" \
2943
-scheme Bitkit \

0 commit comments

Comments
 (0)