Skip to content

Commit af16c22

Browse files
test: try to create simulator for UI tests
1 parent b0baad8 commit af16c22

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

.github/workflows/swiftui-auth.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
swiftui-auth:
2626
runs-on: macOS-latest
2727
timeout-minutes: 30
28+
env:
29+
SIMULATOR_NAME: CI-iPhone-16-Test
2830
steps:
2931
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
3032
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
@@ -46,19 +48,24 @@ jobs:
4648
- name: Select Xcode version
4749
run: |
4850
sudo xcode-select -switch /Applications/Xcode_16.1.app/Contents/Developer
49-
- name: Boot Simulator (once) to create plist
51+
- name: Create Simulator
52+
run: xcrun simctl create "$SIMULATOR_NAME" "iPhone 16 Plus" latest
53+
- name: Boot Simulator Once and Generate Preferences
5054
run: |
51-
xcrun simctl boot "iPhone 16 Plus" || true
55+
xcrun simctl boot "$SIMULATOR_NAME"
5256
sleep 5
53-
# needed for SecureFields otherwise the UI flow tests will fail
54-
- name: Disable iOS Simulator hardware keyboard & kill to force reload
57+
open -a Simulator
58+
sleep 10
59+
osascript -e 'tell application "Simulator" to quit'
60+
61+
- name: Disable iOS Simulator Hardware Keyboard
5562
run: |
56-
/usr/libexec/PlistBuddy -c "Add :ConnectHardwareKeyboard bool false" ~/Library/Preferences/com.apple.iphonesimulator.plist || \
57-
/usr/libexec/PlistBuddy -c "Set :ConnectHardwareKeyboard false" ~/Library/Preferences/com.apple.iphonesimulator.plist
58-
killall Simulator || true
59-
- name: Confirm Simulator keyboard setting
63+
defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool false
64+
65+
- name: Boot Simulator for Testing
6066
run: |
61-
/usr/libexec/PlistBuddy -c "Print :ConnectHardwareKeyboard" ~/Library/Preferences/com.apple.iphonesimulator.plist || echo "Key not found"
67+
xcrun simctl boot "$SIMULATOR_NAME"
68+
sleep 5
6269
- name: Run Integration Tests
6370
run: |
6471
cd ./samples/swiftui/FirebaseSwiftUIExample
@@ -68,7 +75,7 @@ jobs:
6875
run: |
6976
cd ./samples/swiftui/FirebaseSwiftUIExample
7077
set -o pipefail
71-
xcodebuild test -scheme FirebaseSwiftUIExampleUITests -destination 'platform=iOS Simulator,name=iPhone 16 Plus' -enableCodeCoverage YES | tee FirebaseSwiftUIExampleUITests.log | xcpretty --test --color --simple
78+
xcodebuild test -scheme FirebaseSwiftUIExampleUITests -destination "name=$SIMULATOR_NAME" -enableCodeCoverage YES | tee FirebaseSwiftUIExampleUITests.log | xcpretty --test --color --simple
7279
- name: Upload test logs
7380
if: always()
7481
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)