Skip to content

Commit 82ea3bf

Browse files
abueideclaude
andcommitted
feat: integrate mobile-devtools for E2E testing
Add devbox configuration to E2E example apps using mobile-devtools plugins for reproducible developer environments and CI testing. - Add devbox.json with react-native plugin from mobile-devtools - Configure Android SDK (API 33 for compat, API 35 for latest) - Configure iOS Simulator management - Add scripts: install, build, test:e2e, device management - Update READMEs with devbox setup instructions - Add .github/workflows/e2e-mobile-tests.yml: - Runs weekly (Monday 9am UTC) - Manual dispatch with test matrix selection - FOR TESTING: Triggers on push to feat branch (remove before merge) - Reusable workflow for release gating - Matrix: [E2E-compat, E2E-latest] × [android, ios] - 30 minute timeout per job - Uploads test results as artifacts - Update .github/workflows/release.yml: - Add e2e-tests job that calls e2e-mobile-tests workflow - E2E tests required for beta and production releases - Skipped for dry-run releases - Reproducible environments (no "works on my machine") - Project-local SDK/emulator state (no global pollution) - E2E tests gate releases (catch bugs before publishing) - PRs stay fast (no E2E blocking iteration) - Weekly regression testing on main - Simple commands: devbox run test:e2e:android See: notes/MOBILE_DEVTOOLS_INTEGRATION_PLAN.md for full plan Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 123061e commit 82ea3bf

File tree

6 files changed

+390
-6
lines changed

6 files changed

+390
-6
lines changed
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: E2E Mobile Tests
2+
3+
on:
4+
# Weekly schedule - Monday 9am UTC
5+
schedule:
6+
- cron: '0 9 * * 1'
7+
8+
# Manual trigger
9+
workflow_dispatch:
10+
inputs:
11+
test_matrix:
12+
description: 'Test matrix to run'
13+
required: false
14+
type: choice
15+
options:
16+
- all
17+
- android
18+
- ios
19+
- compat
20+
- latest
21+
default: 'all'
22+
23+
# FOR TESTING: Remove before merge - trigger on push to feature branch
24+
push:
25+
branches:
26+
- feat/mobile-devtools-e2e-integration
27+
28+
# Callable by other workflows (e.g., release)
29+
workflow_call:
30+
31+
concurrency:
32+
group: e2e-mobile-${{ github.ref }}
33+
cancel-in-progress: true
34+
35+
jobs:
36+
e2e-android-compat:
37+
name: E2E Android (RN 0.72)
38+
runs-on: ubuntu-latest
39+
timeout-minutes: 30
40+
if: |
41+
inputs.test_matrix == 'all' ||
42+
inputs.test_matrix == 'android' ||
43+
inputs.test_matrix == 'compat' ||
44+
github.event_name != 'workflow_dispatch'
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Install devbox
49+
uses: jetify-com/devbox-install-action@v0.14.0
50+
with:
51+
project-path: examples/E2E-compat
52+
53+
- name: Run Android E2E Tests
54+
working-directory: examples/E2E-compat
55+
run: devbox run test:e2e:android
56+
env:
57+
DETOX_AVD: medium_phone_API33_x86_64
58+
59+
- name: Upload test results
60+
if: always()
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: e2e-android-compat-results
64+
path: examples/E2E-compat/reports/
65+
if-no-files-found: ignore
66+
67+
e2e-ios-compat:
68+
name: E2E iOS (RN 0.72)
69+
runs-on: macos-latest
70+
timeout-minutes: 30
71+
if: |
72+
inputs.test_matrix == 'all' ||
73+
inputs.test_matrix == 'ios' ||
74+
inputs.test_matrix == 'compat' ||
75+
github.event_name != 'workflow_dispatch'
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Install devbox
80+
uses: jetify-com/devbox-install-action@v0.14.0
81+
with:
82+
project-path: examples/E2E-compat
83+
84+
- name: Run iOS E2E Tests
85+
working-directory: examples/E2E-compat
86+
run: devbox run test:e2e:ios
87+
88+
- name: Upload test results
89+
if: always()
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: e2e-ios-compat-results
93+
path: examples/E2E-compat/reports/
94+
if-no-files-found: ignore
95+
96+
e2e-android-latest:
97+
name: E2E Android (RN 0.84)
98+
runs-on: ubuntu-latest
99+
timeout-minutes: 30
100+
if: |
101+
inputs.test_matrix == 'all' ||
102+
inputs.test_matrix == 'android' ||
103+
inputs.test_matrix == 'latest' ||
104+
github.event_name != 'workflow_dispatch'
105+
steps:
106+
- uses: actions/checkout@v4
107+
108+
- name: Install devbox
109+
uses: jetify-com/devbox-install-action@v0.14.0
110+
with:
111+
project-path: examples/E2E-latest
112+
113+
- name: Run Android E2E Tests
114+
working-directory: examples/E2E-latest
115+
run: devbox run test:e2e:android
116+
env:
117+
DETOX_AVD: medium_phone_API35_x86_64
118+
119+
- name: Upload test results
120+
if: always()
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: e2e-android-latest-results
124+
path: examples/E2E-latest/reports/
125+
if-no-files-found: ignore
126+
127+
e2e-ios-latest:
128+
name: E2E iOS (RN 0.84)
129+
runs-on: macos-latest
130+
timeout-minutes: 30
131+
if: |
132+
inputs.test_matrix == 'all' ||
133+
inputs.test_matrix == 'ios' ||
134+
inputs.test_matrix == 'latest' ||
135+
github.event_name != 'workflow_dispatch'
136+
steps:
137+
- uses: actions/checkout@v4
138+
139+
- name: Install devbox
140+
uses: jetify-com/devbox-install-action@v0.14.0
141+
with:
142+
project-path: examples/E2E-latest
143+
144+
- name: Run iOS E2E Tests
145+
working-directory: examples/E2E-latest
146+
run: devbox run test:e2e:ios
147+
148+
- name: Upload test results
149+
if: always()
150+
uses: actions/upload-artifact@v4
151+
with:
152+
name: e2e-ios-latest-results
153+
path: examples/E2E-latest/reports/
154+
if-no-files-found: ignore

.github/workflows/release.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ jobs:
3737
- name: Test
3838
run: devbox run test
3939

40+
e2e-tests:
41+
name: E2E Mobile Tests
42+
needs: [ci]
43+
if: inputs.type == 'beta' || inputs.type == 'production'
44+
uses: ./.github/workflows/e2e-mobile-tests.yml
45+
4046
release-dryrun:
4147
name: Release (dry-run)
4248
if: inputs.type == 'dry-run'
@@ -64,7 +70,7 @@ jobs:
6470
release-beta:
6571
name: Release (beta)
6672
if: inputs.type == 'beta'
67-
needs: [ci]
73+
needs: [ci, e2e-tests]
6874
runs-on: ubuntu-latest
6975
environment: Publish-Beta
7076
permissions:
@@ -91,7 +97,7 @@ jobs:
9197
release-production:
9298
name: Release (production)
9399
if: inputs.type == 'production'
94-
needs: [ci]
100+
needs: [ci, e2e-tests]
95101
runs-on: ubuntu-latest
96102
environment: Publish
97103
permissions:

examples/E2E-compat/README.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,56 @@
11
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
22

3-
# Getting Started
3+
# E2E Test App - React Native 0.72 (Compat)
44

5-
> **Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
5+
This example app tests SDK compatibility with React Native 0.72.9 + React 18.3.1.
6+
7+
## Developer Setup (Devbox)
8+
9+
### Prerequisites
10+
11+
```bash
12+
# Install devbox
13+
curl -fsSL https://get.jetify.com/devbox | bash
14+
```
15+
16+
### Quick Start
17+
18+
```bash
19+
cd examples/E2E-compat
20+
21+
# Enter devbox shell (downloads SDKs on first run)
22+
devbox shell
23+
24+
# Install dependencies
25+
devbox run install
26+
27+
# Start Android emulator
28+
devbox run start:emu
29+
30+
# Run E2E tests
31+
devbox run test:e2e:android
32+
```
33+
34+
### Available Commands
35+
36+
- `devbox run install` - Install Node dependencies
37+
- `devbox run install:pods` - Install iOS CocoaPods
38+
- `devbox run build:android` - Build Android app
39+
- `devbox run build:ios` - Build iOS app
40+
- `devbox run test:e2e:android` - Run Android E2E tests
41+
- `devbox run test:e2e:ios` - Run iOS E2E tests
42+
- `devbox run start:emu` - Start Android emulator
43+
- `devbox run start:sim` - Start iOS simulator
44+
- `devbox run stop:emu` - Stop Android emulator
45+
- `devbox run stop:sim` - Stop iOS simulator
46+
47+
See [mobile-devtools](https://github.com/segment-integrations/mobile-devtools) for more details.
48+
49+
---
50+
51+
# Getting Started (Manual Setup)
52+
53+
> **Note**: The devbox setup above is recommended. For manual setup, follow the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
654
755
## Step 1: Start the Metro Server
856

examples/E2E-compat/devbox.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"include": [
3+
"github:segment-integrations/mobile-devtools?dir=plugins/react-native"
4+
],
5+
"packages": [
6+
"nodejs@20",
7+
"watchman@latest",
8+
"jdk17@latest",
9+
"gradle@latest"
10+
],
11+
"env": {
12+
"IOS_APP_SCHEME": "AnalyticsReactNativeE2E",
13+
"IOS_APP_BUNDLE_ID": "com.analyticsreactnativeexample",
14+
"ANDROID_APP_ID": "com.analyticsreactnativeexample",
15+
"ANDROID_APP_APK": "android/app/build/outputs/apk/release/app-release.apk",
16+
"ANDROID_MAX_API": "33",
17+
"ANDROID_SDK_REQUIRED": "0"
18+
},
19+
"shell": {
20+
"scripts": {
21+
"install": [
22+
"yarn install"
23+
],
24+
"install:pods": [
25+
"cd ios && pod install --repo-update && cd .."
26+
],
27+
"build:android": [
28+
"devbox run install",
29+
"cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd .."
30+
],
31+
"build:ios": [
32+
"devbox run install",
33+
"devbox run install:pods",
34+
"ios.sh xcodebuild -workspace ios/AnalyticsReactNativeE2E.xcworkspace -scheme AnalyticsReactNativeE2E -configuration Release -sdk iphonesimulator -derivedDataPath ios/build"
35+
],
36+
"test:e2e:android": [
37+
"devbox run build:android",
38+
"yarn detox test --configuration android.emu.release"
39+
],
40+
"test:e2e:ios": [
41+
"devbox run build:ios",
42+
"yarn detox test --configuration ios.sim.release"
43+
],
44+
"start:metro": [
45+
"metro.sh start ${1:-default}"
46+
],
47+
"stop:metro": [
48+
"metro.sh stop ${1:-default}"
49+
],
50+
"start:sim": [
51+
"ios.sh simulator start ${1:-${IOS_DEFAULT_DEVICE:-max}}"
52+
],
53+
"stop:sim": [
54+
"ios.sh simulator stop"
55+
],
56+
"start:emu": [
57+
"android.sh emulator start ${1:-${ANDROID_DEFAULT_DEVICE:-max}}"
58+
],
59+
"stop:emu": [
60+
"android.sh emulator stop"
61+
]
62+
}
63+
}
64+
}

examples/E2E-latest/README.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,56 @@
11
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
22

3-
# Getting Started
3+
# E2E Test App - React Native 0.84 (Latest)
44

5-
> **Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
5+
This example app tests SDK compatibility with React Native 0.84.1 + React 19.2.3.
6+
7+
## Developer Setup (Devbox)
8+
9+
### Prerequisites
10+
11+
```bash
12+
# Install devbox
13+
curl -fsSL https://get.jetify.com/devbox | bash
14+
```
15+
16+
### Quick Start
17+
18+
```bash
19+
cd examples/E2E-latest
20+
21+
# Enter devbox shell (downloads SDKs on first run)
22+
devbox shell
23+
24+
# Install dependencies
25+
devbox run install
26+
27+
# Start Android emulator
28+
devbox run start:emu
29+
30+
# Run E2E tests
31+
devbox run test:e2e:android
32+
```
33+
34+
### Available Commands
35+
36+
- `devbox run install` - Install Node dependencies
37+
- `devbox run install:pods` - Install iOS CocoaPods
38+
- `devbox run build:android` - Build Android app
39+
- `devbox run build:ios` - Build iOS app
40+
- `devbox run test:e2e:android` - Run Android E2E tests
41+
- `devbox run test:e2e:ios` - Run iOS E2E tests
42+
- `devbox run start:emu` - Start Android emulator
43+
- `devbox run start:sim` - Start iOS simulator
44+
- `devbox run stop:emu` - Stop Android emulator
45+
- `devbox run stop:sim` - Stop iOS simulator
46+
47+
See [mobile-devtools](https://github.com/segment-integrations/mobile-devtools) for more details.
48+
49+
---
50+
51+
# Getting Started (Manual Setup)
52+
53+
> **Note**: The devbox setup above is recommended. For manual setup, follow the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
654
755
## Step 1: Start the Metro Server
856

0 commit comments

Comments
 (0)