iOS UI tests are failing on the pipeline

Issue Description

We have an azure pipeline that runs iOS UI tests. These tests can be triggered by a PR, CI, or manually.

The UI tests run without issues when triggered by a PR, but they encounter the following error when triggered by CI or manually. All configurations and macOS images are identical. Could someone help us understand the issue and suggest a solution?

2024-07-12 21:13:19.217 xcodebuild[7872:72894]  iOSSimulator: 📱<DVTiPhoneSimulator (0x7fa0bcfda2f0), Clone 1 of iPhone 14, unknown class, 17.2 (21C62), CDC2D287-AC4B-49AB-9824-61CEFBCEAEC5> unable to connect to "com.apple.instruments.deviceservice.lockdown" - timed out after 120 seconds

2024-07-12 21:13:19.547 xcodebuild[7872:73563]  iOSSimulator: 📱<DVTiPhoneSimulator (0x7fa0bcfe8590), Clone 2 of iPhone 14, unknown class, 17.2 (21C62), D1BE199B-C7B1-4A2D-8FCC-1D70DAC1F461> unable to connect to "com.apple.instruments.deviceservice.lockdown" - timed out after 120 seconds

2024-07-12 21:16:41.608 xcodebuild[7872:72894]  iOSSimulator: 📱<DVTiPhoneSimulator (0x7fa0bcfda2f0), Clone 1 of iPhone 14, unknown class, 17.2 (21C62), CDC2D287-AC4B-49AB-9824-61CEFBCEAEC5> unable to connect to "com.apple.instruments.deviceservice.lockdown" - timed out after 120 seconds

2024-07-12 21:16:41.654 xcodebuild[7872:73563]  iOSSimulator: 📱<DVTiPhoneSimulator (0x7fa0bcfe8590), Clone 2 of iPhone 14, unknown class, 17.2 (21C62), D1BE199B-C7B1-4A2D-8FCC-1D70DAC1F461> unable to connect to "com.apple.instruments.deviceservice.lockdown" - timed out after 120 seconds

2024-07-12 21:20:00.875 xcodebuild[7872:41113] [MT] IDETestOperationsObserverDebug: 766.921 elapsed -- Testing started completed.

2024-07-12 21:20:00.875 xcodebuild[7872:41113] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start

2024-07-12 21:20:00.875 xcodebuild[7872:41113] [MT] IDETestOperationsObserverDebug: 766.921 sec, +766.921 sec -- end

2024-07-12 21:20:06.478 xcodebuild[7872:77327]  iOSSimulator: 📱<DVTiPhoneSimulator (0x7fa0bcfe8590), Clone 2 of iPhone 14, unknown class, 17.2 (21C62), D1BE199B-C7B1-4A2D-8FCC-1D70DAC1F461> unable to connect to "com.apple.instruments.deviceservice.lockdown" - timed out after 120 seconds

2024-07-12 21:20:06.575 xcodebuild[7872:79397]  iOSSimulator: 📱<DVTiPhoneSimulator (0x7fa0bcfda2f0), Clone 1 of iPhone 14, unknown class, 17.2 (21C62), CDC2D287-AC4B-49AB-9824-61CEFBCEAEC5> unable to connect to "com.apple.instruments.deviceservice.lockdown" - timed out after 120 seconds

Is there a solution yet? We are having the exact issues.

iOS UI tests are failing on the pipeline
 
 
Q