-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add E2E testing infrastructure with Maestro #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Masked-Kunsiquat
wants to merge
5
commits into
main
Choose a base branch
from
expo-e2e
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ab483c3
feat: add E2E testing infrastructure with Maestro
Masked-Kunsiquat e82cfe2
feat: configure E2E tests to run on EAS cloud
Masked-Kunsiquat 229366b
fix: correct workflow_dispatch syntax in EAS workflow
Masked-Kunsiquat 077d6aa
fix: remove invalid wait commands from Maestro flow
Masked-Kunsiquat ccce9d9
stuff
Masked-Kunsiquat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: e2e-test-android | ||
|
|
||
| on: | ||
| # Only manual trigger - saves EAS build quota | ||
| workflow_dispatch: {} | ||
| # Uncomment below to auto-run on PRs (uses build quota): | ||
| # pull_request: | ||
| # branches: ['main', 'expo-e2e'] | ||
|
|
||
| jobs: | ||
| build_android_for_e2e: | ||
| name: Build Android APK for E2E | ||
| type: build | ||
| params: | ||
| platform: android | ||
| profile: e2e-test | ||
|
|
||
| maestro_test: | ||
| name: Run Maestro E2E Tests | ||
| needs: [build_android_for_e2e] | ||
| type: maestro | ||
| params: | ||
| build_id: ${{ needs.build_android_for_e2e.outputs.build_id }} | ||
| flow_path: ['.maestro/demo-flow.yaml'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Ignore Maestro recordings and temporary files | ||
| *.mp4 | ||
| *.mov | ||
| *.gif | ||
| *.avi | ||
|
|
||
| # But keep the demo flow and documentation | ||
| !README.md | ||
| !QUICKSTART.md | ||
| !*.yaml | ||
| !*.sh | ||
| !*.bat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,213 @@ | ||
| # E2E Testing - Quick Start | ||
|
|
||
| Run CrewSplit E2E tests on EAS cloud or generate demo GIFs locally! 🎬 | ||
|
|
||
| ## Option A: Run Tests on EAS Cloud (Recommended) | ||
|
|
||
| **No setup required!** Tests run automatically on pull requests. | ||
|
|
||
| ### Manual Trigger | ||
|
|
||
| ```bash | ||
| # Run E2E workflow on EAS cloud | ||
| npx eas-cli@latest workflow:run .eas/workflows/e2e-test-android.yml | ||
| ``` | ||
|
|
||
| **Benefits:** | ||
| - ✅ No Docker, no local builds | ||
| - ✅ Runs entirely in the cloud | ||
| - ✅ Automatic on PRs to `main` or `expo-e2e` | ||
|
|
||
| --- | ||
|
|
||
| ## Option B: Generate Demo GIF Locally | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| 1. **Install Maestro CLI** | ||
| ```bash | ||
| curl -Ls "https://get.maestro.mobile.dev" | bash | ||
| ``` | ||
|
|
||
| 2. **Install ffmpeg** (for GIF conversion) | ||
| ```bash | ||
| # macOS | ||
| brew install ffmpeg | ||
|
|
||
| # Ubuntu/Debian | ||
| sudo apt install ffmpeg | ||
|
|
||
| # Windows | ||
| choco install ffmpeg | ||
| ``` | ||
|
|
||
| 3. **Optional: Install gifsicle** (for optimization) | ||
| ```bash | ||
| brew install gifsicle # macOS | ||
| sudo apt install gifsicle # Ubuntu | ||
| ``` | ||
|
|
||
| ## Generate Demo (2 Steps) | ||
|
|
||
| ### Step 1: Run Against Dev Build | ||
|
|
||
| ```bash | ||
| # Start Expo | ||
| npm start | ||
| ``` | ||
|
|
||
| ### Step 2: Run Demo Flow with Recording | ||
|
|
||
| ```bash | ||
| # In another terminal, run Maestro flow | ||
| maestro test .maestro/demo-flow.yaml --format mp4 | ||
| ``` | ||
|
|
||
| This runs the demo flow and records a video. The recording is saved to `~/.maestro/tests/[timestamp]/recording.mp4`. | ||
|
|
||
| ### Step 3: Convert to GIF | ||
|
|
||
| #### Option A: Using the helper script (recommended) | ||
|
|
||
| ```bash | ||
| # macOS/Linux | ||
| ./.maestro/convert-to-gif.sh ~/.maestro/tests/latest/recording.mp4 | ||
|
|
||
| # Windows | ||
| .maestro\convert-to-gif.bat %USERPROFILE%\.maestro\tests\latest\recording.mp4 | ||
| ``` | ||
|
|
||
| #### Option B: Manual conversion with ffmpeg | ||
|
|
||
| ```bash | ||
| ffmpeg -i recording.mp4 \ | ||
| -vf "fps=15,scale=720:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \ | ||
| -loop 0 \ | ||
| demo.gif | ||
| ``` | ||
|
|
||
| **Done!** Your demo GIF is ready 🎉 | ||
|
|
||
| --- | ||
|
|
||
| ## Quick Commands | ||
|
|
||
| ```bash | ||
| # Run E2E tests on EAS cloud | ||
| npx eas-cli@latest workflow:run .eas/workflows/e2e-test-android.yml | ||
|
|
||
| # Generate demo GIF locally | ||
| npm start # Terminal 1 | ||
| maestro test .maestro/demo-flow.yaml --format mp4 && ./.maestro/convert-to-gif.sh # Terminal 2 | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Tips | ||
|
|
||
| ### Reduce GIF Size | ||
|
|
||
| If your GIF is >10MB (GitHub limit): | ||
|
|
||
| ```bash | ||
| # Lower resolution (600px width) | ||
| ./.maestro/convert-to-gif.sh recording.mp4 demo.gif 600 | ||
|
|
||
| # Lower resolution (480px width) | ||
| ./.maestro/convert-to-gif.sh recording.mp4 demo.gif 480 | ||
|
|
||
| # OR trim the video first | ||
| ffmpeg -i recording.mp4 -ss 5 -t 20 trimmed.mp4 | ||
| ./.maestro/convert-to-gif.sh trimmed.mp4 | ||
| ``` | ||
|
|
||
| ### Speed Up/Slow Down | ||
|
|
||
| ```bash | ||
| # Speed up 1.5x | ||
| ffmpeg -i recording.mp4 -filter:v "setpts=0.67*PTS" -an recording-fast.mp4 | ||
| ./.maestro/convert-to-gif.sh recording-fast.mp4 | ||
|
|
||
| # Slow down 0.75x | ||
| ffmpeg -i recording.mp4 -filter:v "setpts=1.33*PTS" recording-slow.mp4 | ||
| ./.maestro/convert-to-gif.sh recording-slow.mp4 | ||
| ``` | ||
|
|
||
| ### Different Quality Levels | ||
|
|
||
| ```bash | ||
| # High quality (larger file) | ||
| ffmpeg -i recording.mp4 -vf "fps=20,scale=1080:-1" demo-hq.gif | ||
|
|
||
| # Medium quality (recommended) | ||
| ffmpeg -i recording.mp4 -vf "fps=15,scale=720:-1" demo.gif | ||
|
|
||
| # Low quality (smaller file) | ||
| ffmpeg -i recording.mp4 -vf "fps=10,scale=480:-1" demo-small.gif | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### "maestro: command not found" | ||
|
|
||
| Add Maestro to your PATH: | ||
|
|
||
| ```bash | ||
| export PATH="$PATH:$HOME/.maestro/bin" | ||
|
|
||
| # Add to ~/.bashrc or ~/.zshrc to make permanent | ||
| echo 'export PATH="$PATH:$HOME/.maestro/bin"' >> ~/.zshrc | ||
| ``` | ||
|
|
||
| ### "App not installed" | ||
|
|
||
| Specify the APK path explicitly: | ||
|
|
||
| ```bash | ||
| maestro test .maestro/demo-flow.yaml --app ./path/to/app.apk | ||
| ``` | ||
|
|
||
| ### "Element not found" errors | ||
|
|
||
| The flow might need adjustment for your UI. Edit [.maestro/demo-flow.yaml](.maestro/demo-flow.yaml) and: | ||
| - Add `optional: true` to non-critical taps | ||
| - Increase `timeout` values | ||
| - Adjust element text/IDs to match your app | ||
|
|
||
| ### Recording file not found | ||
|
|
||
| Check Maestro recordings directory: | ||
|
|
||
| ```bash | ||
| # Find latest recording | ||
| ls -lt ~/.maestro/tests/ | head -5 | ||
|
|
||
| # On Windows | ||
| dir %USERPROFILE%\.maestro\tests /o-d | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Next Steps | ||
|
|
||
| - **Customize the flow**: Edit [.maestro/demo-flow.yaml](.maestro/demo-flow.yaml) | ||
| - **Create variations**: Copy and modify for different scenarios | ||
| - **Full documentation**: See [README.md](README.md) for advanced options | ||
|
|
||
| --- | ||
|
|
||
| ## Quick Reference | ||
|
|
||
| | Task | Command | | ||
| |------|---------| | ||
| | Build E2E app | `npm run e2e:build:android` | | ||
| | Run demo flow | `npm run e2e:demo` | | ||
| | Convert to GIF | `./.maestro/convert-to-gif.sh recording.mp4` | | ||
| | Optimize GIF | `gifsicle -O3 --lossy=80 -o out.gif in.gif` | | ||
| | Test locally | `maestro test .maestro/demo-flow.yaml` | | ||
|
|
||
| --- | ||
|
|
||
| **🎬 Happy Demo-ing!** | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update quick reference to use existing npm scripts.
Line 205 references
npm run e2e:build:android, but this script no longer exists inpackage.json. According to the PR objectives, local build scripts were replaced withe2e:cloudfor the cloud-first approach.🔎 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents