Files
honeyDueKMP/iosApp/HoneyDueUITests/Tests/StabilityTests.swift
Trey T 4df8707b92 UI test infrastructure overhaul — 58% to 96% pass rate (231/241)
Major infrastructure changes:
- BaseUITestCase: per-suite app termination via class setUp() prevents
  stale state when parallel clones share simulators
- relaunchBetweenTests override for suites that modify login/onboarding state
- focusAndType: dedicated SecureTextField path handles iOS strong password
  autofill suggestions (Choose My Own Password / Not Now dialogs)
- LoginScreenObject: tapSignUp/tapForgotPassword use scrollIntoView for
  offscreen buttons instead of simple swipeUp
- Removed all coordinate taps from ForgotPasswordScreen, VerifyResetCodeScreen,
  ResetPasswordScreen (Rule 3 compliance)
- Removed all usleep calls from screen objects (Rule 14 compliance)

App fixes exposed by tests:
- ContractorsListView: added onDismiss to sheet for list refresh after save
- AllTasksView: added Task.RefreshButton accessibility identifier
- AccessibilityIdentifiers: added Task.refreshButton
- DocumentsWarrantiesView: onDismiss handler for document list refresh
- Various form views: textContentType, submitLabel, onSubmit for keyboard flow

Test fixes:
- PasswordResetTests: handle auto-login after reset (app skips success screen)
- AuthenticatedUITestCase: refreshTasks() helper for kanban toolbar button
- All pre-login suites use relaunchBetweenTests for test independence
- Deleted dead code: AuthenticatedTestCase, SeededTestData, SeedTests,
  CleanupTests, old Suite0/2/3, Suite1_RegistrationRebuildTests

10 remaining failures: 5 iOS strong password autofill (simulator env),
3 pull-to-refresh gesture on empty lists, 2 feature coverage edge cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 15:05:37 -05:00

100 lines
3.6 KiB
Swift

import XCTest
final class StabilityTests: BaseUITestCase {
func testP001_RapidOnboardingNavigationDoesNotCrash() {
for _ in 0..<3 {
let welcome = OnboardingWelcomeScreen(app: app)
welcome.waitForLoad(timeout: defaultTimeout)
welcome.tapStartFresh()
let valueProps = OnboardingValuePropsScreen(app: app)
valueProps.waitForLoad(timeout: defaultTimeout)
valueProps.tapBack()
welcome.waitForLoad(timeout: defaultTimeout)
}
}
func testP002_RepeatedForwardNavigationRemainsResponsive() {
for index in 0..<3 {
let welcome = OnboardingWelcomeScreen(app: app)
welcome.waitForLoad(timeout: defaultTimeout)
welcome.tapStartFresh()
let valueProps = OnboardingValuePropsScreen(app: app)
valueProps.waitForLoad(timeout: defaultTimeout)
valueProps.tapContinue()
let nameResidence = OnboardingNameResidenceScreen(app: app)
nameResidence.waitForLoad(timeout: defaultTimeout)
nameResidence.enterResidenceName("Stress Home \(index)")
nameResidence.tapBack()
valueProps.waitForLoad(timeout: defaultTimeout)
valueProps.tapBack()
welcome.waitForLoad(timeout: defaultTimeout)
}
}
func testP003_RapidDoubleTapOnValuePropsContinueLandsOnNameResidence() {
let welcome = OnboardingWelcomeScreen(app: app)
welcome.waitForLoad(timeout: defaultTimeout)
welcome.tapStartFresh()
let valueProps = OnboardingValuePropsScreen(app: app)
valueProps.waitForLoad(timeout: defaultTimeout)
let continueButton = app.buttons[UITestID.Onboarding.valuePropsNextButton]
continueButton.waitUntilHittable(timeout: defaultTimeout).tap()
if continueButton.exists && continueButton.isHittable {
continueButton.tap()
}
let nameResidence = OnboardingNameResidenceScreen(app: app)
nameResidence.waitForLoad(timeout: defaultTimeout)
}
// MARK: - Additional Stability Coverage
func testP004_StartFreshThenBackToWelcomeThenJoinExistingDoesNotCorruptState() {
let welcome = OnboardingWelcomeScreen(app: app)
welcome.waitForLoad(timeout: defaultTimeout)
// Start fresh path
welcome.tapStartFresh()
let valueProps = OnboardingValuePropsScreen(app: app)
valueProps.waitForLoad(timeout: defaultTimeout)
// Go back to welcome
valueProps.tapBack()
welcome.waitForLoad(timeout: defaultTimeout)
// Switch to join existing path
welcome.tapJoinExisting()
let createAccount = OnboardingCreateAccountScreen(app: app)
createAccount.waitForLoad(timeout: defaultTimeout)
}
func testP005_RepeatedLoginNavigationRemainsStable() {
for _ in 0..<3 {
let login = TestFlows.navigateToLoginFromOnboarding(app: app)
login.waitForLoad(timeout: defaultTimeout)
// Dismiss login (swipe down or navigate back)
let backButton = app.descendants(matching: .any).matching(identifier: UITestID.Onboarding.backButton).firstMatch
if backButton.waitForExistence(timeout: defaultTimeout) && backButton.isHittable {
backButton.forceTap()
} else {
// Try swipe down to dismiss sheet
app.swipeDown()
}
// Should return to onboarding
let welcome = OnboardingWelcomeScreen(app: app)
welcome.waitForLoad(timeout: defaultTimeout)
}
}
}