Rewrite all UI tests following fail-fast TEST_RULES patterns
Rewrote 60+ test files to follow honeydue-style test guidelines:
- defaultTimeout=2s, navigationTimeout=5s — fail fast, no long waits
- No coordinate taps (except onboarding paged TabView swipes)
- No sleep(), no retry loops
- No guard...else { return } silent passes — XCTFail everywhere
- All elements by accessibility ID via UITestID constants
- Screen objects for all navigation/actions/assertions
- One logical assertion per test method
Added missing accessibility identifiers to app views:
- MonthView.swift: added AccessibilityID.MonthView.grid to ScrollView
- YearView.swift: added AccessibilityID.YearView.heatmap to ScrollView
Framework rewrites:
- BaseUITestCase: added session ID, localeArguments, extraLaunchArguments
- WaitHelpers: waitForExistenceOrFail, waitUntilHittableOrFail,
waitForNonExistence, scrollIntoView, forceTap
- All 7 screen objects rewritten with fail-fast semantics
- TEST_RULES.md added with non-negotiable rules
Known remaining issues:
- OnboardingTests: paged TabView swipes unreliable on iOS 26 simulator
- SettingsLegalLinksTests: EULA/Privacy buttons too deep in DEBUG scroll
- Customization horizontal picker scrolling needs further tuning
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,42 +10,27 @@ import XCTest
|
||||
final class EntryDeleteTests: BaseUITestCase {
|
||||
override var seedFixture: String? { "single_mood" }
|
||||
|
||||
/// TC-025: Delete a mood entry from the detail sheet.
|
||||
/// TC-025: Delete the only mood entry -- mood header or empty state reappears.
|
||||
func testDeleteEntry_FromDetail() {
|
||||
// Wait for entry to appear
|
||||
let firstEntry = app.firstEntryRow
|
||||
|
||||
guard firstEntry.waitForExistence(timeout: 8) else {
|
||||
XCTFail("No entry row found from seeded data")
|
||||
return
|
||||
}
|
||||
|
||||
firstEntry.waitForExistenceOrFail(timeout: navigationTimeout, message: "No entry row found from seeded data")
|
||||
firstEntry.tap()
|
||||
|
||||
let detailScreen = EntryDetailScreen(app: app)
|
||||
detailScreen.assertVisible()
|
||||
|
||||
captureScreenshot(name: "entry_detail_before_delete")
|
||||
|
||||
// Delete the entry
|
||||
detailScreen.deleteEntry()
|
||||
|
||||
// Detail should dismiss after delete
|
||||
detailScreen.assertDismissed()
|
||||
|
||||
// The entry should no longer be visible (or empty state should show)
|
||||
// Give UI time to update
|
||||
// After deleting the only entry, mood header or empty state should appear
|
||||
let moodHeader = app.element(UITestID.Day.moodHeader)
|
||||
let noDataText = app.element(UITestID.Day.emptyStateNoData)
|
||||
|
||||
let headerReappeared = moodHeader.waitForExistence(timeout: 5)
|
||||
let noDataAppeared = noDataText.waitForExistence(timeout: 2)
|
||||
|
||||
XCTAssertTrue(
|
||||
headerReappeared || noDataAppeared,
|
||||
"After deleting the only entry, mood header or empty state should appear"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "entry_deleted")
|
||||
let headerReappeared = moodHeader.waitForExistence(timeout: navigationTimeout)
|
||||
if !headerReappeared {
|
||||
noDataText.waitForExistenceOrFail(
|
||||
timeout: defaultTimeout,
|
||||
message: "After deleting the only entry, mood header or empty state should appear"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user