From 05aa465b385c51ee14d9f750895feeaec304215f Mon Sep 17 00:00:00 2001 From: Maxim Dozhdev Date: Mon, 24 Aug 2026 10:25:55 +0200 Subject: [PATCH] test: let the suite address a regtest stack that is not on localhost The suite assumes the stack runs on the machine the tests run on: LND is reached at localhost, its cert and macaroon are read from the working copy, and connectToLND types 0.0.0.0 into the app. That holds only while Docker and the iOS Simulator share a host, which GitHub-hosted macOS runners cannot do. Make the address configurable, keeping every current default so existing runs are unaffected: docker-compose.yml LND advertises LND_EXTERNAL_IP, else 127.0.0.1 constants.ts lndConfig host, ports and credential paths from env lnd.ts connectToLND uses the configured host wdio.conf.ts forwards E2E_LOCAL_HOST into the app's launch environment, which is how a build made before the stack existed learns its address The credential paths are separate from the host because they are files, so they have to be fetched from wherever the stack runs before the suite can use them. Required by either way of running the stack off the Mac, so it is independent of that choice. Co-Authored-By: Claude Opus 5 --- docker/docker-compose.yml | 4 ++-- test/helpers/constants.ts | 14 +++++++++----- test/helpers/lnd.ts | 6 +++--- wdio.conf.ts | 7 +++++++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index e02b235..dc57326 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -105,7 +105,7 @@ services: command: - '--noseedbackup' - '--alias=lnd' - - '--externalip=127.0.0.1' + - '--externalip=${LND_EXTERNAL_IP:-127.0.0.1}' - '--bitcoin.active' - '--bitcoin.regtest' - '--bitcoin.node=bitcoind' @@ -147,7 +147,7 @@ services: environment: - NODE_ENV=production - PORT=3000 - - DOMAIN=http://localhost:${LNURL_SERVER_PORT:-30001} + - DOMAIN=${LNURL_DOMAIN:-http://localhost:${LNURL_SERVER_PORT:-30001}} - DATABASE_URL=sqlite:///data/lnurl.db - BITCOIN_RPC_HOST=bitcoind - BITCOIN_RPC_PORT=43782 diff --git a/test/helpers/constants.ts b/test/helpers/constants.ts index 728bec8..4e6d006 100644 --- a/test/helpers/constants.ts +++ b/test/helpers/constants.ts @@ -55,10 +55,14 @@ export type LndConfig = { macaroonPath: string; }; +export const lndHost = process.env.LND_HOST ?? 'localhost'; + export const lndConfig: LndConfig = { - server: 'localhost:10009', - restHost: 'localhost', - restPort: 8080, - tls: `${__dirname}/../../docker/lnd/tls.cert`, - macaroonPath: `${__dirname}/../../docker/lnd/data/chain/bitcoin/regtest/admin.macaroon`, + server: `${lndHost}:${process.env.LND_GRPC_PORT ?? '10009'}`, + restHost: lndHost, + restPort: Number.parseInt(process.env.LND_REST_PORT ?? '8080', 10), + tls: process.env.LND_TLS_PATH ?? `${__dirname}/../../docker/lnd/tls.cert`, + macaroonPath: + process.env.LND_MACAROON_PATH ?? + `${__dirname}/../../docker/lnd/data/chain/bitcoin/regtest/admin.macaroon`, }; diff --git a/test/helpers/lnd.ts b/test/helpers/lnd.ts index 17c858f..e43555d 100644 --- a/test/helpers/lnd.ts +++ b/test/helpers/lnd.ts @@ -9,7 +9,7 @@ import { tap, typeText, } from './actions'; -import { LndConfig } from './constants'; +import { LndConfig, lndHost } from './constants'; import { openSettings } from './navigation'; import createLndRpc, { LnRpc, WalletUnlockerRpc } from '@radar/lnrpc'; @@ -112,8 +112,8 @@ export async function connectToLND(lndNodeID: string, { navigationClose = true } await tap('NavigationAction'); await tap('FundManual'); await typeText('NodeIdInput', lndNodeID); - await typeText('PortInput', '9735'); - await typeText('HostInput', '0.0.0.0'); + await typeText('PortInput', process.env.LND_P2P_PORT ?? '9735'); + await typeText('HostInput', lndHost === 'localhost' ? '0.0.0.0' : lndHost); await confirmInputOnKeyboard(); await tap('ExternalContinue'); await sleep(1000); diff --git a/wdio.conf.ts b/wdio.conf.ts index 048d459..dc12f66 100644 --- a/wdio.conf.ts +++ b/wdio.conf.ts @@ -96,6 +96,13 @@ export const config: WebdriverIO.Config = { 'appium:app': iosApp, 'appium:autoGrantPermissions': true, 'appium:autoAcceptAlerts': false, + ...(process.env.E2E_LOCAL_HOST + ? { + 'appium:processArguments': { + env: { E2E_LOCAL_HOST: process.env.E2E_LOCAL_HOST }, + }, + } + : {}), // 'appium:fullReset': true, 'appium:noReset': false,