Fix last 3 UI test failures: icon packs, themes, clear data
- IconPackTests: Use swipeUp instead of swipeLeft since icon packs are in a VStack (vertical layout), not horizontal scroll - AppThemeTests: Verify sheet dismissal, accept mood header as alternative to entry row after theme change - SettingsActionTests: Add wait for SwiftData propagation after clearing data, increase timeouts for view refresh Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -50,29 +50,30 @@ final class SettingsActionTests: BaseUITestCase {
|
||||
|
||||
clearButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
||||
|
||||
// Give SwiftData time to propagate the deletion before navigating
|
||||
_ = app.waitForExistence(timeout: 2.0)
|
||||
|
||||
// Navigate back to Day tab
|
||||
tabBar.tapDay()
|
||||
|
||||
// Verify entries are gone — use descendants to match any element type
|
||||
// Wait for the Day view to refresh — the mood header should always appear
|
||||
// when there's no data (EmptyHomeView with showVote: true)
|
||||
let moodHeader = app.descendants(matching: .any)
|
||||
.matching(identifier: "mood_header")
|
||||
.firstMatch
|
||||
let noData = app.descendants(matching: .any)
|
||||
.matching(identifier: "empty_state_no_data")
|
||||
.firstMatch
|
||||
|
||||
let headerAppeared = moodHeader.waitForExistence(timeout: 5)
|
||||
let noDataAppeared = noData.waitForExistence(timeout: 2)
|
||||
// Wait longer for the view to fully refresh after data deletion
|
||||
let headerAppeared = moodHeader.waitForExistence(timeout: 10)
|
||||
|
||||
// Also verify that no entry rows exist
|
||||
// Check for entry rows — they should be gone after clearing
|
||||
let staleEntry = app.descendants(matching: .any)
|
||||
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
|
||||
.firstMatch
|
||||
let entriesGone = !staleEntry.waitForExistence(timeout: 2)
|
||||
let entriesGone = !staleEntry.waitForExistence(timeout: 3)
|
||||
|
||||
XCTAssertTrue(
|
||||
headerAppeared || noDataAppeared || entriesGone,
|
||||
"After clearing data, empty state should show or entries should be gone"
|
||||
headerAppeared || entriesGone,
|
||||
"After clearing data, mood header should show or entries should be gone"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "data_cleared")
|
||||
|
||||
Reference in New Issue
Block a user