// // YearViewCollapseTests.swift // Tests iOS // // TC-037: Collapse/expand year stats section. // import XCTest final class YearViewCollapseTests: BaseUITestCase { override var seedFixture: String? { "week_of_moods" } override var bypassSubscription: Bool { true } /// TC-037: Tapping the year card header collapses and re-expands stats. func testYearView_CollapseExpand_StatsSection() { let tabBar = TabBarScreen(app: app) tabBar.tapYear() // Stats section is visible by default let statsSection = app.element(UITestID.Year.statsSection) statsSection.waitForExistenceOrFail( timeout: navigationTimeout, message: "Year stats section should be visible initially" ) // Find the current year's card header button let currentYear = Calendar.current.component(.year, from: Date()) let headerButton = app.element(UITestID.Year.cardHeader(year: currentYear)) headerButton.waitUntilHittableOrFail( timeout: navigationTimeout, message: "Year card header for \(currentYear) should be hittable" ) captureScreenshot(name: "year_stats_expanded") // Tap header to collapse stats headerButton.forceTap() // Stats section should disappear statsSection.waitForNonExistence( timeout: defaultTimeout, message: "Stats section should collapse after tapping header" ) captureScreenshot(name: "year_stats_collapsed") // Tap header again to expand stats headerButton.forceTap() // Stats section should reappear statsSection.waitForExistenceOrFail( timeout: defaultTimeout, message: "Stats section should expand after tapping header again" ) captureScreenshot(name: "year_stats_re_expanded") } }