Skip to content

Commit 1ac6b5e

Browse files
fix: e2e tests
1 parent 6a8677c commit 1ac6b5e

20 files changed

Lines changed: 369 additions & 22 deletions

File tree

.github/workflows/NativePipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ env:
105105
# Pin the test project (mendix/Native-Mobile-Resources) to a SHA for reproducibility instead
106106
# of tracking a moving `main`. Single source of truth — bump deliberately. The repo publishes
107107
# no tags, so a commit SHA is the only stable ref. Override per run via the dispatch input.
108-
NATIVE_MOBILE_RESOURCES_REF: ${{ github.event.inputs.test_project_ref || 'a915484ef2cfed403cfbdfa531638df3c46c9d00' }}
108+
NATIVE_MOBILE_RESOURCES_REF: ${{ github.event.inputs.test_project_ref || '05255f5ad19de7b109f6a68088e4fb198447ed00' }}
109109
permissions:
110110
packages: write
111111
jobs:

maestro/helpers/helpers.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,24 @@ stop_recording() {
7878
REC_FILE=""
7979
}
8080

81+
# Function to clean up stale XCTest processes (iOS only)
82+
cleanup_xctest_processes() {
83+
if [ "$PLATFORM" != "ios" ]; then
84+
return 0
85+
fi
86+
echo "🧹 Cleaning up stale XCTest processes..."
87+
# Kill any leftover XCTest runner processes that might be blocking driver initialization
88+
pkill -9 -f "XCTRunner" 2>/dev/null || true
89+
pkill -9 -f "xctest" 2>/dev/null || true
90+
pkill -9 -f "maestro.*driver" 2>/dev/null || true
91+
sleep 2
92+
}
93+
8194
# Function to restart the iOS simulator
8295
restart_simulator() {
8396
echo "🔄 Restarting iOS Simulator..."
97+
# Clean up XCTest processes first
98+
cleanup_xctest_processes
8499
# Shut down whatever is booted; the device is auto-selected in prepare_ios.sh,
85100
# so we don't depend on a hardcoded device name here.
86101
xcrun simctl shutdown all || true

maestro/helpers/prepare_ios.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,34 @@ elif best:
6464
xcrun simctl bootstatus "$DEVICE_ID" -b || echo "Simulator booted"
6565
}
6666

67+
# Cut UIKit animation time, mirroring `disable-animations: true` on the Android emulator
68+
# (NativePipeline.yml) — iOS previously had no equivalent, so every navigation push/modal
69+
# played at full length on a 3-vCPU runner while Android's ran instantly.
70+
#
71+
# Scope: this shortens SYSTEM transitions (nav pushes, modal presents, alerts). React
72+
# Native's `Animated` does NOT read this flag automatically, so widget-internal animations
73+
# (carousel, animation-native) are unaffected — this is not a substitute for the per-flow
74+
# waits those need.
75+
#
76+
# Requires a BOOTED device (`simctl spawn`), so call after start_simulator. The value is
77+
# written to the device's persistent domain and survives shutdown/boot, so a
78+
# restart_simulator in helpers.sh keeps it.
79+
reduce_motion() {
80+
echo "Reducing motion on iOS Simulator..."
81+
if [ -z "$SIMULATOR_DEVICE_ID" ]; then
82+
echo "Error: SIMULATOR_DEVICE_ID not set"
83+
return 1
84+
fi
85+
# Best-effort: a future runtime that drops/renames these keys should not fail the shard,
86+
# since tests still pass with animations on (just slower).
87+
xcrun simctl spawn "$SIMULATOR_DEVICE_ID" defaults write com.apple.Accessibility ReduceMotionEnabled -bool true \
88+
|| echo "::warning::Could not set ReduceMotionEnabled; animations stay at full length"
89+
# Replaces the sliding push/pop transition with a cross-fade — the slide is what Maestro
90+
# most often races against when asserting right after a navigation tap.
91+
xcrun simctl spawn "$SIMULATOR_DEVICE_ID" defaults write com.apple.Accessibility ReduceMotionReduceSlideTransitionsEnabled -bool true \
92+
|| echo "::warning::Could not set ReduceMotionReduceSlideTransitionsEnabled"
93+
}
94+
6795
set_status_bar() {
6896
echo "Setting status bar on iOS Simulator..."
6997
if [ -z "$SIMULATOR_DEVICE_ID" ]; then
@@ -92,6 +120,7 @@ verify_installed_app() {
92120
}
93121

94122
start_simulator
123+
reduce_motion
95124
set_status_bar
96125
install_ios_app
97126
verify_installed_app
22.6 KB
Loading
223 KB
Loading
-273 KB
Binary file not shown.
-118 KB
Binary file not shown.
-154 KB
Binary file not shown.
-337 KB
Binary file not shown.
-154 KB
Binary file not shown.

0 commit comments

Comments
 (0)