Skip to content

Commit fdc6eaa

Browse files
authored
Merge pull request #563 from synonymdev/feat/e2e-beyond-local
feat: e2e beyond local
2 parents a043222 + e96adf4 commit fdc6eaa

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

AGENTS.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ This file provides guidance to AI agents like Cursor/Claude Code/Codex/WARP when
2020
# Run instrumented tests
2121
./gradlew connectedDevDebugAndroidTest
2222

23-
# Build for E2E tests
23+
# Build for E2E tests (UI hooks enabled, local Electrum by default)
2424
E2E=true ./gradlew assembleDevRelease
2525

2626
# Build for E2E tests with geoblocking disabled
2727
GEO=false E2E=true ./gradlew assembleDevRelease
2828

29+
# Build for E2E tests using network Electrum (not local; staging/mainnet based on flavor)
30+
E2E=true E2E_BACKEND=network ./gradlew assembleTnetRelease
31+
2932
# Lint using detekt
3033
./gradlew detekt
3134

@@ -88,7 +91,7 @@ GEO=false E2E=true ./gradlew assembleDevRelease
8891

8992
- **dev**: Regtest network for development
9093
- **tnet**: Testnet network
91-
- **mainnet**: Production (currently commented out)
94+
- **mainnet**: Production
9295

9396
## Common Pitfalls
9497

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,25 @@ To build the mainnet flavor:
119119
120120
### Build for E2E Testing
121121

122-
Simply pass `E2E=true` as environment variable and build any flavor.
122+
Pass `E2E=true` and build any flavor. By default, E2E uses a local Electrum override.
123123

124124
```sh
125125
E2E=true ./gradlew assembleDevRelease
126126
```
127127

128+
#### Use Network Electrum (Staging/Mainnet)
129+
130+
Set `E2E_BACKEND=network` to use the network Electrum based on the build flavor:
131+
132+
```sh
133+
# regtest (dev flavor)
134+
E2E=true E2E_BACKEND=network ./gradlew assembleDevRelease
135+
# testnet (tnet flavor)
136+
E2E=true E2E_BACKEND=network ./gradlew assembleTnetRelease
137+
# mainnet
138+
E2E=true E2E_BACKEND=network ./gradlew assembleMainnetRelease
139+
```
140+
128141
#### Disable Geoblocking Checks
129142

130143
By default, geoblocking checks via API are enabled. To disable at build time, use the `GEO` environment variable:

app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ val keystoreProperties by lazy {
3737
}
3838

3939
val locales = listOf("en", "ar", "ca", "cs", "de", "el", "es", "fr", "it", "nl", "pl", "pt", "ru")
40+
val e2eBackendEnv = System.getenv("E2E_BACKEND") ?: "local"
4041

4142
android {
4243
namespace = "to.bitkit"
@@ -52,6 +53,7 @@ android {
5253
useSupportLibrary = true
5354
}
5455
buildConfigField("boolean", "E2E", System.getenv("E2E")?.toBoolean()?.toString() ?: "false")
56+
buildConfigField("String", "E2E_BACKEND", "\"$e2eBackendEnv\"")
5557
buildConfigField("boolean", "GEO", System.getenv("GEO")?.toBoolean()?.toString() ?: "true")
5658
buildConfigField("String", "LOCALES", "\"${locales.joinToString(",")}\"")
5759
}

app/src/main/java/to/bitkit/env/Env.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ internal object Env {
1717
val isDebug = BuildConfig.DEBUG
1818
const val isE2eTest = BuildConfig.E2E
1919
const val isGeoblockingEnabled = BuildConfig.GEO
20+
private val e2eBackend = BuildConfig.E2E_BACKEND.lowercase()
2021
val network = Network.valueOf(BuildConfig.NETWORK)
2122
val locales = BuildConfig.LOCALES.split(",")
2223
val walletSyncIntervalSecs = 10_uL // TODO review
@@ -98,7 +99,7 @@ internal object Env {
9899

99100
val electrumServerUrl: String
100101
get() {
101-
if (isE2eTest) return ElectrumServers.E2E
102+
if (isE2eTest && e2eBackend == "local") return ElectrumServers.E2E
102103
return when (network) {
103104
Network.REGTEST -> ElectrumServers.REGTEST
104105
Network.TESTNET -> ElectrumServers.TESTNET

0 commit comments

Comments
 (0)