Files
Reflect/Tests iOS/MoodLoggingWithDataTests.swift
Trey t 277e277750 Add XCUITest suite with 27 test files covering unmapped P1 test cases
- Add 8 new test files: HeaderMoodLogging (TC-002), DayViewGrouping (TC-019),
  AllDayViewStyles (TC-021), MonthViewInteraction (TC-030), PaywallGate
  (TC-032/039/048), AppTheme (TC-070), IconPack (TC-072),
  PremiumCustomization (TC-075)
- Add accessibility IDs for paywall overlays, icon packs, app theme cards,
  and day view section headers
- Add --expire-trial launch argument to UITestMode for paywall gate testing
- Update QA test plan spreadsheet with XCUITest names for 14 test cases
- Include existing test infrastructure: screen objects, helpers, base class,
  and 19 previously written test files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:37:54 -06:00

39 lines
1.4 KiB
Swift

//
// MoodLoggingWithDataTests.swift
// Tests iOS
//
// Mood logging with existing seeded data tests.
//
import XCTest
final class MoodLoggingWithDataTests: BaseUITestCase {
override var seedFixture: String? { "week_of_moods" }
/// With a week of data seeded, the mood header should appear if today is missing a vote.
/// Log a new mood and verify header disappears.
func testLogMood_Average_WhenDataExists() {
let dayScreen = DayScreen(app: app)
// The seeded data includes today (offset 0 = great).
// After reset + seed, today already has an entry, so header may be hidden.
// If the header IS visible (i.e. vote logic says "needs vote"), tap it.
if dayScreen.moodHeader.waitForExistence(timeout: 3) {
dayScreen.logMood(.average)
// After logging, header should disappear (today is now voted)
dayScreen.assertMoodHeaderHidden()
}
// Regardless, verify at least one entry row is visible (seeded data)
let anyEntry = app.descendants(matching: .any)
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
.firstMatch
XCTAssertTrue(
anyEntry.waitForExistence(timeout: 5),
"At least one entry row should exist from seeded data"
)
captureScreenshot(name: "mood_logged_with_data")
}
}