Stabilize UI test suite — 39% → 98%+ pass rate

Fix root causes uncovered across repeated parallel runs:

- Admin seed password "test1234" failed backend complexity (needs
  uppercase). Bumped to "Test1234" across every hard-coded reference
  (AuthenticatedUITestCase default, TestAccountManager seeded-login
  default, Tests/*Integration suites, Tests/DataLayer, OnboardingTests).

- dismissKeyboard() tapped the Return key first, which races SwiftUI's
  TextField binding on numeric keyboards (postal, year built) and
  complex forms. KeyboardDismisser now prefers the keyboard-toolbar
  Done button, falls back to tap-above-keyboard, then keyboard Return.
  BaseUITestCase.clearAndEnterText uses the same helper.

- Form page-object save() helpers (task / residence / contractor /
  document) now dismiss the keyboard and scroll the submit button
  into view before tapping, eliminating Suite4/6/7/8 "save button
  stayed visible" timeouts.

- Suite6 createTask was producing a disabled-save race: under
  parallel contention the SwiftUI title binding lagged behind
  XCUITest typing. Rewritten to inline Suite5's proven pattern with
  a retry that nudges the title binding via a no-op edit when Add is
  disabled, and an explicit refreshTasks after creation.

- Suite8 selectProperty now picks the residence by name (works with
  menu, list, or wheel picker variants) — avoids bad form-cell taps
  when the picker hasn't fully rendered.

- run_ui_tests.sh uses 2 workers instead of 4 (4-worker contention
  caused XCUITest typing races across Suite5/7/8) and isolates Suite6
  in its own 2-worker phase after the main parallel phase.

- Add AAA_SeedTests / SuiteZZ_CleanupTests: the runner's Phase 1
  (seed) and Phase 3 (cleanup) depend on these and they were missing
  from version control.
This commit is contained in:
Trey T
2026-04-15 08:38:31 -05:00
parent 9ececfa48a
commit a4d66c6ed1
17 changed files with 388 additions and 59 deletions

View File

@@ -14,7 +14,10 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT="$SCRIPT_DIR/honeyDue.xcodeproj"
SCHEME="HoneyDueUITests"
DESTINATION="platform=iOS Simulator,name=iPhone 17 Pro"
WORKERS=4
# 2 workers avoids simulator contention that caused intermittent XCUITest
# typing / UI-update races (Suite5/7/8 flakes under 4-worker load). Phase 2b
# isolates Suite6 further.
WORKERS=2
SKIP_SEED=false
SKIP_CLEANUP=false
@@ -73,13 +76,20 @@ PARALLEL_TESTS=(
"-only-testing:HoneyDueUITests/Suite3_ResidenceRebuildTests"
"-only-testing:HoneyDueUITests/Suite4_ComprehensiveResidenceTests"
"-only-testing:HoneyDueUITests/Suite5_TaskTests"
"-only-testing:HoneyDueUITests/Suite6_ComprehensiveTaskTests"
"-only-testing:HoneyDueUITests/Suite7_ContractorTests"
"-only-testing:HoneyDueUITests/Suite8_DocumentWarrantyTests"
"-only-testing:HoneyDueUITests/Suite9_IntegrationE2ETests"
"-only-testing:HoneyDueUITests/Suite10_ComprehensiveE2ETests"
)
# Suite6 runs in a smaller-parallel phase of its own. Under 4-worker contention
# with 14 other classes, SwiftUI's TextField binding intermittently lags behind
# XCUITest typing, leaving the Add-Task form un-submittable. Isolating Suite6
# to 2 workers gives the binding enough time to flush reliably.
SUITE6_TESTS=(
"-only-testing:HoneyDueUITests/Suite6_ComprehensiveTaskTests"
)
# Cleanup tests — must run last, sequentially
CLEANUP_TESTS=(
"-only-testing:HoneyDueUITests/SuiteZZ_CleanupTests"
@@ -140,6 +150,23 @@ else
PARALLEL_PASSED=false
fi
# ── Phase 2b: Suite6 (isolated parallel) ──────────────────────
phase_header "Phase 2b: Suite6 task tests (2 workers, isolated)"
SUITE6_START=$(date +%s)
if run_phase "Suite6Tests" \
-parallel-testing-enabled YES \
-parallel-testing-worker-count 2 \
"${SUITE6_TESTS[@]}"; then
SUITE6_END=$(date +%s)
echo -e "\n${GREEN}✓ Suite6 phase passed ($(( SUITE6_END - SUITE6_START ))s)${RESET}"
SUITE6_PASSED=true
else
SUITE6_END=$(date +%s)
echo -e "\n${RED}✗ Suite6 phase FAILED ($(( SUITE6_END - SUITE6_START ))s)${RESET}"
SUITE6_PASSED=false
fi
# ── Phase 3: Cleanup ──────────────────────────────────────────
if [ "$SKIP_CLEANUP" = false ]; then
phase_header "Phase 3/3: Cleaning up test data (sequential)"
@@ -164,11 +191,11 @@ echo " Workers: $WORKERS"
echo " Results: $RESULTS_DIR/"
echo ""
if [ "$PARALLEL_PASSED" = true ]; then
if [ "$PARALLEL_PASSED" = true ] && [ "${SUITE6_PASSED:-true}" = true ]; then
echo -e " ${GREEN}${BOLD}ALL TESTS PASSED${RESET}"
exit 0
else
echo -e " ${RED}${BOLD}TESTS FAILED${RESET}"
echo -e " Check results: open $RESULTS_DIR/ParallelTests.xcresult"
echo -e " Check results: open $RESULTS_DIR/"
exit 1
fi