@@ -309,13 +309,35 @@ jobs:
309309 echo "Ensuring simulator is ready..."
310310 xcrun simctl list devices | grep "$SIMULATOR_UDID"
311311
312- # Verify app is installed
312+ # Verify app is installed and get the correct bundle ID
313313 echo "Verifying app installation..."
314- xcrun simctl listapps "$SIMULATOR_UDID" | grep -i bitkit || echo "App not found"
314+ APP_BUNDLE_ID=$(xcrun simctl listapps "$SIMULATOR_UDID" | grep -i bitkit | grep -o '"[^"]*"' | head -1 | tr -d '"')
315+ echo "App bundle ID: $APP_BUNDLE_ID"
316+
317+ # Update the app bundle ID in wdio.conf.ts if needed
318+ if [ -n "$APP_BUNDLE_ID" ] && [ "$APP_BUNDLE_ID" != "to.bitkit-regtest" ]; then
319+ echo "Updating app bundle ID in capabilities..."
320+ sed -i '' "s/'appium:app': path.join(__dirname, 'aut', 'bitkit.app')/'appium:app': path.join(__dirname, 'aut', 'bitkit.app'),\n 'appium:bundleId': '$APP_BUNDLE_ID'/" wdio.conf.ts
321+ fi
315322
316323 # Make sure simulator is fully booted and ready
317324 echo "Waiting for simulator to be fully ready..."
318- sleep 10
325+ sleep 15
326+
327+ # Pre-build WebDriverAgent to avoid timeout during session creation
328+ echo "Pre-building WebDriverAgent..."
329+ xcrun simctl spawn "$SIMULATOR_UDID" xcrun simctl list devices || echo "Simulator check failed"
330+
331+ # Ensure simulator is fully responsive
332+ echo "Testing simulator responsiveness..."
333+ for i in {1..10}; do
334+ if xcrun simctl list devices | grep "$SIMULATOR_UDID" | grep -q "Booted"; then
335+ echo "Simulator is responsive (attempt $i/10)"
336+ break
337+ fi
338+ echo "Waiting for simulator responsiveness... ($i/10)"
339+ sleep 5
340+ done
319341
320342 # Check simulator status one more time
321343 echo "Final simulator status:"
@@ -330,6 +352,35 @@ jobs:
330352 SIMULATOR_UDID="$CURRENT_UDID"
331353 fi
332354
355+ # Test regtest connectivity
356+ echo "Testing regtest connectivity..."
357+ echo "E2E_ELECTRUM_SERVER: $E2E_ELECTRUM_SERVER"
358+ echo "E2E_LND_URL: $E2E_LND_URL"
359+
360+ # Test electrum server connectivity
361+ if [ -n "$E2E_ELECTRUM_SERVER" ]; then
362+ ELECTRUM_HOST=$(echo "$E2E_ELECTRUM_SERVER" | cut -d: -f1)
363+ ELECTRUM_PORT=$(echo "$E2E_ELECTRUM_SERVER" | cut -d: -f2)
364+ echo "Testing electrum server at $ELECTRUM_HOST:$ELECTRUM_PORT..."
365+ if nc -z "$ELECTRUM_HOST" "$ELECTRUM_PORT" 2>/dev/null; then
366+ echo "✅ Electrum server is reachable"
367+ else
368+ echo "❌ Electrum server is not reachable"
369+ fi
370+ fi
371+
372+ # Test LND connectivity
373+ if [ -n "$E2E_LND_URL" ]; then
374+ LND_HOST=$(echo "$E2E_LND_URL" | cut -d: -f1)
375+ LND_PORT=$(echo "$E2E_LND_URL" | cut -d: -f2)
376+ echo "Testing LND at $LND_HOST:$LND_PORT..."
377+ if nc -z "$LND_HOST" "$LND_PORT" 2>/dev/null; then
378+ echo "✅ LND is reachable"
379+ else
380+ echo "❌ LND is not reachable"
381+ fi
382+ fi
383+
333384 # Add more debugging before running tests
334385 echo "=== Pre-test Debugging ==="
335386 echo "Current directory: $(pwd)"
0 commit comments