@@ -269,43 +269,40 @@ jobs:
269269
270270 # Configure WebDriverIO to use our Appium server
271271 echo "Configuring WebDriverIO to use our Appium server..."
272- # Update the hostname to use our Appium server
273- sed -i '' 's/port: 4723/port: 4723,\n hostname: "localhost"/' wdio.conf.ts
274272
275- # Remove the appium service to prevent WebDriverIO from starting its own
276- sed -i '' 's/services: \[.appium.\]/services: []/' wdio.conf.ts
273+ # Add hostname if missing
274+ if ! grep -q "hostname:" wdio.conf.ts; then
275+ echo "Adding hostname configuration..."
276+ sed -i '' 's/port: 4723,/port: 4723,\n hostname: '\''localhost'\'',/' wdio.conf.ts
277+ fi
278+
279+ # Remove appium service to use our manually started server
280+ echo "Removing appium service from services array..."
281+ sed -i '' "s/services: \['appium'\]/services: []/" wdio.conf.ts
277282
278- # Increase timeout settings for better reliability
283+ # Update timeouts for better reliability
284+ echo "Updating timeout configurations..."
279285 sed -i '' 's/waitforTimeout: 30000/waitforTimeout: 60000/' wdio.conf.ts
286+ sed -i '' 's/connectionRetryTimeout: 120000/connectionRetryTimeout: 300000/' wdio.conf.ts
280287
281288 # Get the UDID of the booted simulator
282289 SIMULATOR_UDID=$(xcrun simctl list devices | grep "$SIMULATOR_NAME" | grep "Booted" | grep -o '[A-F0-9-]\{36\}')
283290 echo "Booted simulator UDID: $SIMULATOR_UDID"
284291
285- # Update device name to match the booted simulator
286- echo "Updating wdio.conf.ts to use simulator: $SIMULATOR_NAME (UDID: $SIMULATOR_UDID)"
287- sed -i '' "s/'appium:deviceName': 'iPhone 16'/'appium:deviceName': '$SIMULATOR_NAME'/" wdio.conf.ts
288-
289- # Verify the changes were made
290- echo "Updated wdio.conf.ts device name and UDID:"
291- grep -n -A1 -B1 "deviceName\|udid" wdio.conf.ts
292+ # Device name is already set to "iPhone 16" in wdio.conf.ts
293+ echo "Using simulator: $SIMULATOR_NAME (UDID: $SIMULATOR_UDID)"
292294
293295 # Check the full capabilities section
294296 echo "Full capabilities section:"
295297 grep -A 20 -B 5 "capabilities:" wdio.conf.ts
296298
297- # Add Appium capabilities to help with simulator boot issues
298- echo "Adding timeout capabilities to wdio.conf.ts..."
299-
300- # Add UDID and timeout capabilities to the iOS configuration
301- sed -i '' 's/"appium:autoAcceptAlerts": true/"appium:autoAcceptAlerts": true,\n "appium:udid": "'$SIMULATOR_UDID'",\n "appium:newCommandTimeout": 300,\n "appium:commandTimeouts": {"implicit": 30000},\n "appium:launchTimeout": 300000,\n "appium:deviceReadyTimeout": 300000,\n "appium:wdaLaunchTimeout": 300000,\n "appium:wdaConnectionTimeout": 300000,\n "appium:useNewWDA": true,\n "appium:autoLaunch": false,\n "appium:noReset": true,\n "appium:fullReset": false/' wdio.conf.ts
302-
303- # Also update the connection timeout
304- sed -i '' 's/connectionRetryTimeout: 120000/connectionRetryTimeout: 300000/' wdio.conf.ts
299+ # Update UDID to match the booted simulator
300+ echo "Updating UDID to match booted simulator: $SIMULATOR_UDID"
301+ sed -i '' "s/'appium:udid': '[^']*'/'appium:udid': '$SIMULATOR_UDID'/" wdio.conf.ts
305302
306- # Verify the capabilities were added
307- echo "Updated capabilities with timeouts :"
308- grep -A 15 "appium:autoAcceptAlerts " wdio.conf.ts
303+ # Verify the UDID was updated
304+ echo "Updated UDID in capabilities :"
305+ grep -A 5 -B 5 "appium:udid " wdio.conf.ts
309306
310307 # Try to launch the app manually to test simulator connectivity
311308 echo "Testing manual app launch..."
0 commit comments