Skip to content

Commit 143d14b

Browse files
committed
feat: add Maestro E2E tests
Replace build.yml with e2e.yml that builds and runs Maestro tests. Add main-sheet and child-sheets test flows.
1 parent aa57077 commit 143d14b

3 files changed

Lines changed: 182 additions & 3 deletions

File tree

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
name: Build
1+
name: E2E
22
on:
3+
workflow_dispatch:
4+
pull_request:
5+
branches:
6+
- main
37
push:
48
branches:
59
- main
610

711
concurrency:
812
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
914

1015
jobs:
11-
build-android:
16+
android:
1217
runs-on: ubuntu-latest
1318

1419
env:
@@ -66,7 +71,37 @@ jobs:
6671
run: |
6772
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
6873
69-
build-ios:
74+
- name: Install Maestro
75+
if: env.turbo_cache_hit != 1
76+
run: |
77+
curl -Ls "https://get.maestro.mobile.dev" | bash
78+
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
79+
80+
- name: Enable KVM
81+
if: env.turbo_cache_hit != 1
82+
run: |
83+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
84+
sudo udevadm control --reload-rules
85+
sudo udevadm trigger --name-match=kvm
86+
87+
- name: Run Maestro tests
88+
if: env.turbo_cache_hit != 1
89+
uses: reactivecircus/android-emulator-runner@v2
90+
with:
91+
api-level: 31
92+
arch: x86_64
93+
script: |
94+
adb install example/bare/android/app/build/intermediates/apk/debug/app-debug.apk
95+
maestro test .maestro/ --format junit --output report.xml
96+
97+
- name: Upload test report
98+
if: always() && env.turbo_cache_hit != 1
99+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
100+
with:
101+
name: e2e-android-report
102+
path: report.xml
103+
104+
ios:
70105
runs-on: macos-latest
71106

72107
env:
@@ -132,3 +167,32 @@ jobs:
132167
- name: Build example for iOS
133168
run: |
134169
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
170+
171+
- name: Install Maestro
172+
if: env.turbo_cache_hit != 1
173+
uses: dniHze/maestro-test-action@v1
174+
175+
- name: Boot iOS Simulator
176+
if: env.turbo_cache_hit != 1
177+
run: |
178+
DEVICE=$(xcrun simctl list devices available -j | jq -r '[.devices[] | .[] | select(.name | contains("iPhone"))][0].udid')
179+
xcrun simctl boot "$DEVICE"
180+
181+
- name: Install app on Simulator
182+
if: env.turbo_cache_hit != 1
183+
run: |
184+
APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "TrueSheetExample.app" -path "*/Debug-iphonesimulator/*" | head -1)
185+
xcrun simctl install booted "$APP_PATH"
186+
187+
- name: Run Maestro tests
188+
if: env.turbo_cache_hit != 1
189+
run: |
190+
export PATH="$PATH":"$HOME/.maestro/bin"
191+
maestro test .maestro/ --format junit --output report.xml
192+
193+
- name: Upload test report
194+
if: always() && env.turbo_cache_hit != 1
195+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
196+
with:
197+
name: e2e-ios-report
198+
path: report.xml

.maestro/child-sheets.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
appId: truesheet.example
2+
---
3+
4+
- launchApp:
5+
clearState: true
6+
7+
- waitForAnimationToEnd:
8+
timeout: 3000
9+
10+
# Expand main sheet
11+
- swipe:
12+
start: "50%, 90%"
13+
end: "50%, 30%"
14+
duration: 500
15+
- waitForAnimationToEnd
16+
17+
# --- BasicSheet: header, footer, detent resize, dismiss ---
18+
19+
- tapOn: "TrueSheet View"
20+
- waitForAnimationToEnd
21+
22+
- assertVisible: "Enter some text..."
23+
- assertVisible: "FOOTER"
24+
- assertVisible: "Add Content"
25+
26+
# Resize detents
27+
- tapOn: "Large"
28+
- waitForAnimationToEnd
29+
- tapOn: "Auto"
30+
- waitForAnimationToEnd
31+
32+
- tapOn: "Dismiss"
33+
- waitForAnimationToEnd
34+
- assertVisible: "True Sheet"
35+
36+
# --- PromptSheet: scrollable, form inputs ---
37+
38+
- scrollUntilVisible:
39+
element: "Prompt"
40+
direction: DOWN
41+
- tapOn: "Prompt"
42+
- waitForAnimationToEnd
43+
44+
- assertVisible: "First name"
45+
- assertVisible: "Last name"
46+
- tapOn: "First name"
47+
- inputText: "John"
48+
- tapOn: "Last name"
49+
- inputText: "Doe"
50+
51+
- scrollUntilVisible:
52+
element: "Dismiss"
53+
direction: DOWN
54+
- tapOn: "Dismiss"
55+
- waitForAnimationToEnd
56+
- assertVisible: "True Sheet"
57+
58+
# --- FlatListSheet: scrollable content ---
59+
60+
- tapOn: "FlatList"
61+
- waitForAnimationToEnd
62+
63+
- assertVisible: "Enter some text..."
64+
- assertVisible: "Item #0"
65+
66+
- scrollUntilVisible:
67+
element: "Item #9"
68+
direction: DOWN
69+
- assertVisible: "Item #9"
70+
71+

.maestro/main-sheet.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
appId: truesheet.example
2+
---
3+
4+
- launchApp:
5+
clearState: true
6+
7+
- waitForAnimationToEnd:
8+
timeout: 3000
9+
10+
# --- initialDetentIndex + dismissible=false ---
11+
12+
# Main sheet auto-presents collapsed (header only)
13+
- assertVisible: "True Sheet"
14+
- assertVisible: "Enter some text..."
15+
16+
# Try to swipe down — main sheet is not dismissible
17+
- swipe:
18+
start: "50%, 90%"
19+
end: "50%, 99%"
20+
duration: 300
21+
- waitForAnimationToEnd
22+
- assertVisible: "True Sheet"
23+
24+
# --- Expand and verify content ---
25+
26+
- swipe:
27+
start: "50%, 90%"
28+
end: "50%, 30%"
29+
duration: 500
30+
- waitForAnimationToEnd
31+
32+
- assertVisible: "TrueSheet View"
33+
- assertVisible: "Prompt"
34+
- assertVisible: "ScrollView"
35+
- assertVisible: "FlatList"
36+
37+
# --- Expand to full, then dismiss ---
38+
39+
- tapOn: "Expand"
40+
- waitForAnimationToEnd
41+
- tapOn: "Dismiss"
42+
- waitForAnimationToEnd
43+
44+
- assertNotVisible: "True Sheet"

0 commit comments

Comments
 (0)