Stabilize iOS UI test foundation and fix flaky suites

This commit is contained in:
Trey t
2026-02-17 22:24:08 -06:00
parent c28d7a59eb
commit 56ac783219
38 changed files with 543 additions and 585 deletions

View File

@@ -19,28 +19,14 @@ final class DataPersistenceTests: BaseUITestCase {
dayScreen.logMood(.great)
// Verify entry was created
let greatEntry = app.descendants(matching: .any)
.matching(NSPredicate(format: "label CONTAINS[cd] %@", "Great"))
.firstMatch
XCTAssertTrue(
greatEntry.waitForExistence(timeout: 8),
"Entry should appear after logging"
)
dayScreen.assertAnyEntryExists()
captureScreenshot(name: "before_relaunch")
// Terminate the app
app.terminate()
// Relaunch WITHOUT --reset-state to preserve data
let freshApp = XCUIApplication()
freshApp.launchArguments = ["--ui-testing", "--disable-animations", "--bypass-subscription", "--skip-onboarding"]
freshApp.launch()
let freshApp = relaunchPreservingState()
// The entry should still exist after relaunch
let entryRow = freshApp.descendants(matching: .any)
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
.firstMatch
let entryRow = freshApp.firstEntryRow
XCTAssertTrue(
entryRow.waitForExistence(timeout: 8),
"Entry should persist after force quit and relaunch"