Remove maestro tests and update iOS xcode test docs (#1404)

This commit is contained in:
Leendert de Borst committed 2026-01-14 16:52:38 +01:00
1 parent 5b91bf3f62
commit 1887fa2bc0
9 files changed
+74 -431

No files matched your search

+74 -105
View File
@@ -1,135 +1,104 @@
# iOS E2E Testing with Maestro
# iOS Testing Guide
This guide explains how to set up and run end-to-end tests for the AliasVault iOS mobile app using [Maestro](https://maestro.mobile.dev/).
This guide explains how to run the iOS test suites for the AliasVault mobile app.
## Overview
The iOS app has two test targets:
1. **AliasVaultUITests** - End-to-end UI tests that test full user flows
2. **VaultStoreKitTests** - Unit tests for the native VaultStoreKit framework
## Prerequisites
- macOS (required for iOS simulator)
- Xcode installed with iOS Simulator
- macOS with Xcode installed (15.0+)
- iOS Simulator configured
- Node.js 20+
- The AliasVault mobile app built and ready to run
- CocoaPods dependencies installed (`cd apps/mobile-app && npx pod-install`)
- For UI tests: Local API server running at `http://localhost:5092`
## Installing Maestro
## Running Tests
Install Maestro CLI:
### Via Xcode
1. Open the project in Xcode:
```bash
cd apps/mobile-app/ios
open AliasVault.xcworkspace
```
2. Select a simulator (e.g., iPhone 16 Pro)
3. Run tests:
- **All tests**: `Cmd + U` or Product > Test
- **Specific test class**: Click the diamond icon next to the test class in the Test Navigator
- **Single test**: Click the diamond icon next to a specific test method
### Via Command Line (xcodebuild)
#### Run All Tests
```bash
curl -Ls "https://get.maestro.mobile.dev" | bash
cd apps/mobile-app/ios
# Run all tests on iPhone 17 Pro simulator
xcodebuild test \
-workspace AliasVault.xcworkspace \
-scheme AliasVault \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' \
-resultBundlePath ./test-results
```
After installation, restart your terminal or run:
#### Run UI Tests Only
```bash
export PATH="$PATH":"$HOME/.maestro/bin"
xcodebuild test \
-workspace AliasVault.xcworkspace \
-scheme AliasVault \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' \
-only-testing:AliasVaultUITests
```
Verify the installation:
#### Run VaultStoreKit Unit Tests Only
```bash
maestro --version
xcodebuild test \
-workspace AliasVault.xcworkspace \
-scheme AliasVault \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' \
-only-testing:VaultStoreKitTests
```
## Building the App for Testing
Before running E2E tests, you need to build the app:
#### Run a Specific Test
```bash
cd apps/mobile-app
# Run a specific test class
xcodebuild test \
-workspace AliasVault.xcworkspace \
-scheme AliasVault \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' \
-only-testing:AliasVaultUITests/AliasVaultUITests
# Install dependencies
npm install
# Build and run on iOS simulator
npm run ios
# Run a specific test method
xcodebuild test \
-workspace AliasVault.xcworkspace \
-scheme AliasVault \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' \
-only-testing:AliasVaultUITests/AliasVaultUITests/test01AppLaunch
```
Wait for the app to fully launch in the simulator before running tests.
## Running E2E Tests
### Run All Tests
#### With Custom API URL (for UI tests)
```bash
cd apps/mobile-app
# Run all E2E tests on iOS
npm run test:e2e:ios
API_URL="http://your-server:5092" xcodebuild test \
-workspace AliasVault.xcworkspace \
-scheme AliasVault \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' \
-only-testing:AliasVaultUITests
```
### Run a Specific Test
### List Available Simulators
```bash
# Run a single test file
$HOME/.maestro/bin/maestro test .maestro/flows/01-app-launch.yaml --platform ios
```
### Run Tests with Environment Variables
Some tests require credentials to log in:
```bash
TEST_USERNAME="your-test-user" TEST_PASSWORD="your-test-password" npm run test:e2e:ios
```
Or pass them directly to Maestro:
```bash
$HOME/.maestro/bin/maestro test .maestro/flows/03-successful-login.yaml \
--platform ios \
--env TEST_USERNAME="your-test-user" \
--env TEST_PASSWORD="your-test-password"
```
## Test Structure
Tests are located in `apps/mobile-app/.maestro/`:
```
.maestro/
├── config.yaml # Maestro configuration
├── flows/ # Test flows (run in order)
│ ├── 01-app-launch.yaml
│ ├── 02-login-validation.yaml
│ ├── 03-successful-login.yaml
│ ├── 04-create-item.yaml
│ └── ...
└── utils/ # Reusable flows
└── go-back.yaml
```
## Debugging Failed Tests
### View Screenshots
Maestro saves screenshots and debug output to `~/.maestro/tests/`. After a test run, check this directory for:
- Screenshots at failure points
- JSON files with element hierarchy
- HTML reports
### Run in Debug Mode
```bash
maestro test .maestro/flows/01-app-launch.yaml --debug-output ./debug
```
### Interactive Studio
Launch Maestro Studio to interactively build and debug tests:
```bash
maestro studio
```
This opens a web UI where you can:
- See the current screen elements
- Record actions
- Test selectors
## CI/CD Integration
E2E tests are configured to run in GitHub Actions:
- **Android tests**: Run on every PR (Linux runner)
- **iOS tests**: Run on schedule/manual dispatch (macOS runner - higher cost)
See `.github/workflows/mobile-e2e-tests.yml` for the CI configuration.
xcrun simctl list devices available
```