Can I grab a device ID to boot and run flutter driver integration tests?

I was hoping to do something along these lines:

bin/integration:

#!/bin/bash

#Find and boot device
if [ "$1" == "-b" ]
then
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/.
UDID=$(xcrun xctrace list devices \
 | awk '/iPhone 11 Pro/ && !/Max/  {print $NF}' \
 | tr -d '()')
xcrun simctl boot "${UDID:?No Simulator with this name found}"
fi

# Run Integration Tests
flutter drive --flavor dev --dart-define=TEST_MODE=true  --target=test_driver/app.dart

then in my bitrise,yml

- script@1:
        title: Find and boot device, run integration tests
        inputs:
        - content: bin/integration -b

Unfortunately, xctrace does not seem to be available. I get:

xcrun: error: sh -c '/Applications/Xcode.app/Contents/Developer/./usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/./Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find xctrace 2> /dev/null' failed with exit code 17664: (null) (errno=No such file or directory)

xcrun: error: unable to find utility "xctrace", not a developer tool or in PATH

bin/integration: line 10: UDID: No Simulator with this name found

Is there another way to achieve what I want - booting an ios device, then running flutter driver integration tests against it? Or is there a way to get my current approach to work by getting access to xctrace somehow?

Update:

I believe that bitrise is running and older version of xcrun, so I swapped out xctrace list devices for
xcrun instruments -s:

bin/integration:

#!/bin/bash

#Find and boot device
if [ "$1" == "-b" ]
then
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/.
UDID=$(xcrun instruments -s \
 | awk '/iPhone 11 Pro/ && !/Max/  {print $(NF-1)}' \
 | tr -d '[]')
xcrun simctl boot "${UDID:?No Simulator with this name found}"
echo $UDID
fi

# Run Integration Tests
flutter drive --flavor dev --dart-define=TEST_MODE=true  --target=test_driver/app.dart

It does seem to be finding some UDIDs, but it is still not working like I’d expect:

Invalid device: 440C0771-4696-4F14-A5C8-31275B64DCD1
DFBF5692-DFE2-4CCA-9508-4E0AD804B5AD
C5CD32AD-2F13-4DA1-9D80-DE4E831D5A31
1B54C616-A8D5-4E93-99B3-9801701704D6
27D76453-33E6-47EE-B4FD-A40F7CE91F29
A5930A1D-6FB3-4FF7-8E9A-AF3AC7EF50AA
7E0C0B0F-4756-4E19-A543-1F130C02D124
5EF12EC9-ECFD-4667-8F6A-F348F7784877
B564B746-BDDD-4DEB-BEB7-14E185195409
440C0771-4696-4F14-A5C8-31275B64DCD1 DFBF5692-DFE2-4CCA-9508-4E0AD804B5AD C5CD32AD-2F13-4DA1-9D80-DE4E831D5A31 1B54C616-A8D5-4E93-99B3-9801701704D6 27D76453-33E6-47EE-B4FD-A40F7CE91F29 A5930A1D-6FB3-4FF7-8E9A-AF3AC7EF50AA 7E0C0B0F-4756-4E19-A543-1F130C02D124 5EF12EC9-ECFD-4667-8F6A-F348F7784877 B564B746-BDDD-4DEB-BEB7-14E185195409
Downloading Material fonts...                                       0.7s
Downloading Gradle Wrapper...                                       0.0s
Downloading package sky_engine...                                   0.2s
Downloading flutter_patched_sdk tools...                            1.3s
Downloading flutter_patched_sdk_product tools...                    1.0s
Downloading darwin-x64 tools...                                     2.3s
Downloading libimobiledevice...                                     0.0s
Downloading usbmuxd...                                              0.0s
Downloading libplist...                                             0.0s
Downloading openssl...                                              0.1s
Downloading ios-deploy...                                           0.0s
Downloading darwin-x64/font-subset tools...                         0.2s
Running "flutter pub get" in git...                             
Warning: You are using these overridden dependencies:
! analyzer 0.40.6
Running "flutter pub get" in git...                                 4.4s
No devices found.

Hi @lisamartin :smiley:

Can you please submit a ticket regarding this issue to Bitrise Support? Thank you!

Kind regards,
Allene

Will do @allenenorton thanks for getting back to me :+1:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.