Stabilize iOS UI test foundation and fix flaky suites
This commit is contained in:
@@ -20,9 +20,7 @@ final class MoodReplacementTests: BaseUITestCase {
|
||||
dayScreen.logMood(.good)
|
||||
} else {
|
||||
// Today already has an entry. Open detail and change mood.
|
||||
let firstEntry = app.descendants(matching: .any)
|
||||
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
|
||||
.firstMatch
|
||||
let firstEntry = app.firstEntryRow
|
||||
guard firstEntry.waitForExistence(timeout: 5) else {
|
||||
XCTFail("No entry rows found")
|
||||
return
|
||||
@@ -36,8 +34,7 @@ final class MoodReplacementTests: BaseUITestCase {
|
||||
}
|
||||
|
||||
// Verify exactly one entry row exists (no duplicates)
|
||||
let entryRows = app.descendants(matching: .any)
|
||||
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
|
||||
let entryRows = app.entryRows
|
||||
// Wait for at least one entry
|
||||
XCTAssertTrue(
|
||||
entryRows.firstMatch.waitForExistence(timeout: 5),
|
||||
@@ -57,9 +54,7 @@ final class MoodReplacementTests: BaseUITestCase {
|
||||
}
|
||||
|
||||
// Now open the entry and change to Bad via detail
|
||||
let firstEntry = app.descendants(matching: .any)
|
||||
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
|
||||
.firstMatch
|
||||
let firstEntry = app.firstEntryRow
|
||||
guard firstEntry.waitForExistence(timeout: 8) else {
|
||||
XCTFail("No entry found after logging")
|
||||
return
|
||||
@@ -73,8 +68,7 @@ final class MoodReplacementTests: BaseUITestCase {
|
||||
detailScreen.assertDismissed()
|
||||
|
||||
// Verify still only one entry (no duplicate)
|
||||
let entryRows = app.descendants(matching: .any)
|
||||
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
|
||||
let entryRows = app.entryRows
|
||||
XCTAssertTrue(
|
||||
entryRows.firstMatch.waitForExistence(timeout: 5),
|
||||
"Entry should still exist after mood change"
|
||||
|
||||
Reference in New Issue
Block a user