Stabilize iOS UI test foundation and fix flaky suites
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user