24
24
uses : actions/setup-node@v3
25
25
with :
26
26
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-
27
38
28
39
- name : Install dependencies
29
40
run : |
@@ -32,19 +43,19 @@ jobs:
32
43
33
44
- name : Install Maestro CLI
34
45
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
36
47
brew tap facebook/fb
37
48
brew install facebook/fb/idb-companion
38
49
39
50
- name : Add Maestro to path
40
51
run : echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
41
52
42
- - name : Bundle iOS
43
- run : npm run build:ios
53
+ - name : Start packager
54
+ run : npm start &
44
55
45
56
- name : Build iOS
46
57
run : |
47
- npm run ios:release
58
+ npm run ios
48
59
49
60
- name : Setup iOS simulator
50
61
run : |
@@ -53,11 +64,40 @@ jobs:
53
64
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})")
54
65
xcrun simctl boot "${UDID}"
55
66
fi
56
- open -a Simulator --args -CurrentDeviceUDID "${UDID}"
67
+ open -a Simulator
57
68
xcrun simctl launch "${UDID}" com.jscexample
58
69
59
70
- 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
61
101
62
102
android-build :
63
103
name : Android Build
@@ -86,12 +126,12 @@ jobs:
86
126
- name : Install dependencies
87
127
run : npm install --frozen-lockfile
88
128
89
- - name : Bundle Android
90
- run : npm run build:android
129
+ - name : Start packager
130
+ run : npm start &
91
131
92
132
- name : Install Maestro CLI
93
133
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
95
135
96
136
- name : Add Maestro to path
97
137
run : echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
@@ -112,5 +152,5 @@ jobs:
112
152
disable-animations : false
113
153
working-directory : example
114
154
script : |
115
- npm run android:release
155
+ npm run android
116
156
npm run test:e2e
0 commit comments