Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .eas/workflows/e2e-test-android.yml
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']
12 changes: 12 additions & 0 deletions .maestro/.gitignore
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
213 changes: 213 additions & 0 deletions .maestro/QUICKSTART.md
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` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Update quick reference to use existing npm scripts.

Line 205 references npm run e2e:build:android, but this script no longer exists in package.json. According to the PR objectives, local build scripts were replaced with e2e:cloud for the cloud-first approach.

🔎 Proposed fix
 | Task | Command |
 |------|---------|
-| Build E2E app | `npm run e2e:build:android` |
+| Run E2E on cloud | `npm run e2e:cloud` |
 | Run demo flow | `npm run e2e:demo` |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Build E2E app | `npm run e2e:build:android` |
| Run E2E on cloud | `npm run e2e:cloud` |
🤖 Prompt for AI Agents
In .maestro/QUICKSTART.md around line 205 the quick reference lists a
non-existent npm script `npm run e2e:build:android`; update that table entry to
reference the current script `npm run e2e:cloud` (or the exact existing e2e
cloud script name used in package.json) so the docs match the repo, and ensure
any surrounding explanatory text reflects the cloud-first approach.

| 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!**
Loading