Scripts/test-ios-ui.sh (766B)
1
2set -euo pipefail
3
4MAJOR="${1:-26}"
5RUNTIME=$(xcrun simctl list runtimes available \
6 | grep "iOS ${MAJOR}\." \
7 | sed 's/.*iOS \([0-9.]*\).*/\1/' \
8 | sort -t. -k1,1n -k2,2n \
9 | tail -1)
10
11if [ -z "$RUNTIME" ]; then
12 echo "No available iOS ${MAJOR}.x simulator runtime found." >&2
13 exit 1
14fi
15
16DEVICE=$(xcrun simctl list devices available "iOS ${RUNTIME}" \
17 | grep "iPhone" \
18 | head -1 \
19 | sed 's/^ *\(.*\) ([A-F0-9-]*).*/\1/')
20
21if [ -z "$DEVICE" ]; then
22 echo "No available iPhone simulator found for iOS ${RUNTIME}." >&2
23 exit 1
24fi
25
26echo "Using ${DEVICE}, iOS ${RUNTIME}"
27
28xcodebuild test \
29 -scheme "Listless iOS" \
30 -destination "platform=iOS Simulator,name=${DEVICE},OS=${RUNTIME}" \
31 -only-testing:"Listless iOS UI Tests" \
32 2>&1