-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathrun_tests.sh
More file actions
executable file
·61 lines (50 loc) · 1.66 KB
/
run_tests.sh
File metadata and controls
executable file
·61 lines (50 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Exit on error
set -e
# Function to display usage
usage() {
echo "Usage: $0 [ios|android]"
echo " ios - Run tests for iOS platform"
echo " android - Run tests for Android platform"
exit 1
}
# Check if platform argument is provided
if [ $# -ne 1 ]; then
usage
fi
PLATFORM=$(echo "$1" | tr '[:upper:]' '[:lower:]')
# Validate platform argument
if [ "$PLATFORM" != "ios" ] && [ "$PLATFORM" != "android" ]; then
echo "Error: Invalid platform. Must be 'ios' or 'android'"
usage
fi
# Set platform-specific variables
if [ "$PLATFORM" = "ios" ]; then
APP_ID="com.superwall.Advanced"
else
APP_ID="com.superwall.superapp"
fi
echo "Building Flutter app for $PLATFORM..."
cd test_app
if [ "$PLATFORM" = "ios" ]; then
flutter build ipa --no-codesign
# Install the IPA on the iOS simulator
echo "Installing IPA on iOS simulator..."
xcrun simctl install booted build/ios/ipa/Advanced.ipa
else
flutter build apk
# Install the APK on the connected device
echo "Installing APK on connected device..."
adb install -r build/app/outputs/flutter-apk/app-release.apk
fi
cd ..
echo "Running Maestro tests for $PLATFORM..."
# Run the tests
maestro test -e "PLATFORM_ID=$APP_ID" test_app/maestro/handler/flow.yaml
maestro test -e "PLATFORM_ID=$APP_ID" test_app/maestro/flow.yaml
maestro test -e "PLATFORM_ID=$APP_ID" test_app/maestro/delegate/flow.yaml
if [ "$PLATFORM" = "ios" ]; then
maestro test -e "PLATFORM_ID=$APP_ID" test_app/maestro/purchasecontroller/test_pc_purchases.yaml
fi
maestro test -e "PLATFORM_ID=$APP_ID" test_app/maestro/purchasecontroller/no_pc_purchases.yaml
echo "All tests completed successfully!"