@@ -304,30 +304,31 @@ jobs:
304304 echo "Updated UDID in capabilities:"
305305 grep -A 5 -B 5 "appium:udid" wdio.conf.ts
306306
307- # Try to launch the app manually to test simulator connectivity
308- echo "Testing manual app launch..."
309- xcrun simctl launch "$SIMULATOR_UDID" to.bitkit-regtest || echo "Manual launch failed"
310- sleep 5
311-
312- # Check if app is running
313- echo "Checking if app is running..."
314- xcrun simctl spawn "$SIMULATOR_UDID" launchctl list | grep bitkit || echo "App not running"
315-
316- # Test XCUITest driver directly
317- echo "Testing XCUITest driver..."
307+ # Don't manually launch the app - let Appium handle it
308+ # Just ensure simulator is ready and app is installed
309+ echo "Ensuring simulator is ready..."
318310 xcrun simctl list devices | grep "$SIMULATOR_UDID"
319311
320- # Kill the manually launched app to let Appium handle it
321- echo "Killing manually launched app..."
322- xcrun simctl terminate "$SIMULATOR_UDID" to.bitkit-regtest || echo "App not running "
312+ # Verify app is installed
313+ echo "Verifying app installation ..."
314+ xcrun simctl listapps "$SIMULATOR_UDID" | grep -i bitkit || echo "App not found "
323315
324- # Reset simulator to ensure clean state for WebDriverAgent
325- echo "Resetting simulator for WebDriverAgent..."
326- xcrun simctl shutdown "$SIMULATOR_UDID" || true
327- sleep 5
328- xcrun simctl boot "$SIMULATOR_UDID" || true
316+ # Make sure simulator is fully booted and ready
317+ echo "Waiting for simulator to be fully ready..."
329318 sleep 10
330- echo "Simulator reset complete"
319+
320+ # Check simulator status one more time
321+ echo "Final simulator status:"
322+ xcrun simctl list devices | grep "$SIMULATOR_UDID"
323+
324+ # Re-check UDID in case simulator was reset
325+ echo "Re-checking simulator UDID..."
326+ CURRENT_UDID=$(xcrun simctl list devices | grep "$SIMULATOR_NAME" | grep "Booted" | grep -o '[A-F0-9-]\{36\}')
327+ if [ "$CURRENT_UDID" != "$SIMULATOR_UDID" ]; then
328+ echo "UDID changed from $SIMULATOR_UDID to $CURRENT_UDID, updating..."
329+ sed -i '' "s/'appium:udid': '[^']*'/'appium:udid': '$CURRENT_UDID'/" wdio.conf.ts
330+ SIMULATOR_UDID="$CURRENT_UDID"
331+ fi
331332
332333 # Add more debugging before running tests
333334 echo "=== Pre-test Debugging ==="
@@ -337,7 +338,7 @@ jobs:
337338 echo "Appium status:"
338339 curl -s http://localhost:4723/status | head -5
339340 echo "App status on simulator:"
340- xcrun simctl listapps "$SIMULATOR_NAME " | grep -i bitkit || echo "App not found"
341+ xcrun simctl listapps "$SIMULATOR_UDID " | grep -i bitkit || echo "App not found"
341342 echo "WebDriverIO config:"
342343 head -20 wdio.conf.ts
343344 echo "Test files:"
0 commit comments