Skip to content

Commit 1ddcd9a

Browse files
authored
Merge pull request #86 from sentry-demos/kw/ci/add-test
ci(test): Add Android UI Test
2 parents 1ef4bdd + 6e842cd commit 1ddcd9a

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
env:
1010
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
1111
SENTRY_ALLOW_FAILURE: false
12+
MAESTRO_VERSION: 1.39.0
1213

1314
concurrency:
1415
group: ${{ github.workflow }}-${{ github.ref }}
@@ -96,3 +97,53 @@ jobs:
9697
with:
9798
name: build-ios-logs
9899
path: ios/xcodebuild.log
100+
101+
run-ui-test-android:
102+
name: UI Test Android
103+
needs: build-android
104+
runs-on: ubuntu-latest
105+
steps:
106+
- uses: actions/checkout@v4
107+
108+
- name: Setup KVM
109+
shell: bash
110+
run: |
111+
# check if virtualization is supported...
112+
sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
113+
# allow access to KVM to run the emulator
114+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
115+
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
116+
sudo udevadm control --reload-rules
117+
sudo udevadm trigger --name-match=kvm
118+
119+
- name: Download APK artifact
120+
uses: actions/download-artifact@v4
121+
with:
122+
name: empower-plant-react-native-android
123+
124+
- name: Install Maestro
125+
uses: dniHze/maestro-test-action@bda8a93211c86d0a05b7a4597c5ad134566fbde4 # [email protected]
126+
with:
127+
maestro-version: ${{env.MAESTRO_VERSION}}
128+
129+
- name: Run tests
130+
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # [email protected]
131+
with:
132+
api-level: 30
133+
force-avd-creation: false
134+
disable-animations: true
135+
disable-spellchecker: true
136+
target: 'aosp_atd'
137+
channel: canary # Necessary for ATDs
138+
emulator-options: >
139+
-no-window
140+
-no-snapshot-save
141+
-gpu swiftshader_indirect
142+
-noaudio
143+
-no-boot-anim
144+
-camera-back none
145+
-camera-front none
146+
-timezone US/Pacific
147+
script: |
148+
adb install -r -d app-release.apk
149+
maestro test maestro --debug-output maestro-logs --env=APP_ID=com.sentry_react_native

maestro/buyPlant.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
appId: ${APP_ID}
2+
---
3+
- launchApp
4+
- assertVisible: "Empower Plant"
5+
- waitForAnimationToEnd
6+
- assertVisible: "Botana Voice"
7+
- tapOn:
8+
text: "Add to cart"
9+
below:
10+
text: "Botana Voice"
11+
repeat: 3
12+
- tapOn:
13+
text: "Add to cart"
14+
below:
15+
text: "Plant Mood"
16+
- tapOn:
17+
id: "bottom-tab-cart"
18+
- assertVisible: "CartScreen"
19+
- scroll
20+
- tapOn:
21+
text: "Delete"
22+
below:
23+
text: "Botana Voice"
24+
- tapOn: "Checkout"
25+
- tapOn: "email"
26+
- scroll
27+
- tapOn:
28+
text: "Place your order"
29+
repeat: 3

src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ const BottomTabNavigator = () => {
156156
options={{
157157
tabBarIcon: ({focused}) => (
158158
<Icon
159+
testID="bottom-tab-cart"
159160
name="cart-shopping"
160161
size={30}
161162
color={focused ? '#f6cfb2' : '#dae3e4'}

0 commit comments

Comments
 (0)