Complete re-validation remediation: KMP architecture, iOS platform, XCUITest rewrite

Phases 1-6 of fixes.md — closes all 13 issues from codex_issues_2.md re-validation:

KMP Architecture:
- Fix subscription purchase/restore response contract (VerificationResponse aligned)
- Add feature benefits auth token + APILayer init flow
- Remove ResidenceFormScreen direct API bypass (use APILayer)
- Wire paywall purchase/restore to real SubscriptionApi calls

iOS Platform:
- Add iOS Keychain token storage via Swift KeychainHelper
- Implement Google Sign-In via ASWebAuthenticationSession (GoogleSignInManager)
- DocumentViewModelWrapper observes DataManager for auto-updates
- Add missing accessibility identifiers (document, task columns, Google Sign-In)

XCUITest Rewrite:
- Rewrite test infrastructure: zero sleep() calls, accessibility ID lookups
- Create AuthCriticalPathTests and NavigationCriticalPathTests
- Delete 14 legacy brittle test files (Suite0-10, templates)
- Fix CaseraTests module import (@testable import Casera)

All platforms build clean. TEST BUILD SUCCEEDED.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-18 18:50:13 -06:00
parent 7444f73b46
commit 5e3596db77
47 changed files with 982 additions and 6075 deletions

View File

@@ -45,6 +45,30 @@ class BaseScreen {
return element
}
/// Waits until a condition evaluates to true, polling every 0.5s.
/// More flexible than element-based waits for complex state checks.
func waitForCondition(
_ description: String,
timeout: TimeInterval? = nil,
condition: () -> Bool
) -> Bool {
let t = timeout ?? self.timeout
let deadline = Date().addingTimeInterval(t)
while Date() < deadline {
if condition() { return true }
RunLoop.current.run(until: Date().addingTimeInterval(0.5))
}
return false
}
/// Waits for an element to exist, then taps it. Convenience for the common wait+tap pattern.
@discardableResult
func tapElement(_ element: XCUIElement, timeout: TimeInterval? = nil) -> XCUIElement {
waitForElement(element, timeout: timeout)
element.tap()
return element
}
// MARK: - State Assertions
/// Asserts that an element with the given accessibility identifier exists.