2424 uses : actions/setup-node@v3
2525 with :
2626 node-version : ' 22'
27+ cache : ' npm'
28+ cache-dependency-path : example/package-lock.json
29+
30+ - name : Cache CocoaPods
31+ uses : actions/cache@v3
32+ with :
33+ path : |
34+ example/ios/Pods
35+ key : ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }}
36+ restore-keys : |
37+ ${{ runner.os }}-pods-
2738
2839 - name : Install dependencies
2940 run : |
@@ -32,19 +43,19 @@ jobs:
3243
3344 - name : Install Maestro CLI
3445 run : |
35- export MAESTRO_VERSION=1.39.13; curl -Ls "https://get.maestro.mobile.dev" | bash
46+ curl -Ls "https://get.maestro.mobile.dev" | bash
3647 brew tap facebook/fb
3748 brew install facebook/fb/idb-companion
3849
3950 - name : Add Maestro to path
4051 run : echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
4152
42- - name : Bundle iOS
43- run : npm run build:ios
53+ - name : Start packager
54+ run : npm start &
4455
4556 - name : Build iOS
4657 run : |
47- npm run ios:release
58+ npm run ios
4859
4960 - name : Setup iOS simulator
5061 run : |
@@ -53,11 +64,40 @@ jobs:
5364 UDID=$(xcrun simctl list devices available | grep "iPhone" | head -1 | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})")
5465 xcrun simctl boot "${UDID}"
5566 fi
56- open -a Simulator --args -CurrentDeviceUDID "${UDID}"
67+ open -a Simulator
5768 xcrun simctl launch "${UDID}" com.jscexample
5869
5970 - name : Run iOS tests
60- run : export MAESTRO_DRIVER_STARTUP_TIMEOUT=190000; npm run test:e2e
71+ run : |
72+ # Set timeouts
73+ export MAESTRO_DRIVER_STARTUP_TIMEOUT=1500000
74+ export MAESTRO_WAIT_TIMEOUT=10000
75+
76+ # Get the UDID of the booted simulator
77+ UDID=$(xcrun simctl list devices | grep "iPhone" | grep "Booted" | head -1 | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})")
78+ if [ -z "$UDID" ]; then
79+ echo "No booted iPhone simulator found"
80+ exit 1
81+ fi
82+
83+ echo "Using simulator with UDID: ${UDID}"
84+
85+ # Find test files
86+ MAESTRO_DIR="./maestro-tests"
87+
88+ # Run each test with a timeout
89+ for TEST_FILE in ${MAESTRO_DIR}/*.yaml; do
90+ echo "Running test: ${TEST_FILE}"
91+ COMMAND="$HOME/.maestro/bin/maestro --udid=\"${UDID}\" test \"${TEST_FILE}\" --format junit"
92+ echo "Executing: ${COMMAND}"
93+
94+ bash -c "${COMMAND}"
95+
96+ EXIT_CODE=$?
97+ if [ $EXIT_CODE -ne 0 ]; then
98+ echo "Test failed: ${TEST_FILE} with exit code ${EXIT_CODE}"
99+ fi
100+ done
61101
62102 android-build :
63103 name : Android Build
@@ -86,12 +126,12 @@ jobs:
86126 - name : Install dependencies
87127 run : npm install --frozen-lockfile
88128
89- - name : Bundle Android
90- run : npm run build:android
129+ - name : Start packager
130+ run : npm start &
91131
92132 - name : Install Maestro CLI
93133 run : |
94- export MAESTRO_VERSION=1.39.13; curl -Ls "https://get.maestro.mobile.dev" | bash
134+ curl -Ls "https://get.maestro.mobile.dev" | bash
95135
96136 - name : Add Maestro to path
97137 run : echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
@@ -112,5 +152,5 @@ jobs:
112152 disable-animations : false
113153 working-directory : example
114154 script : |
115- npm run android:release
155+ npm run android
116156 npm run test:e2e
0 commit comments