//
//  EmptyStateTests.swift
//  Tests iOS
//
//  Empty state display tests.
//

import XCTest

final class EmptyStateTests: BaseUITestCase {
    override var seedFixture: String? { "empty" }

    /// TC-020: With no entries, the empty state should display without crashing.
    func testEmptyState_ShowsNoDataMessage() {
        // The app should show either the mood header (voting prompt) or
        // the empty state text. Either way, it should not crash.
        let moodHeader = app.element(UITestID.Day.moodHeader)
        let noDataText = app.element(UITestID.Day.emptyStateNoData)

        // At least one of these should be visible
        let headerExists = moodHeader.waitForExistence(timeout: 5)
        let noDataExists = noDataText.waitForExistence(timeout: 2)

        XCTAssertTrue(
            headerExists || noDataExists,
            "Either mood header or 'no data' text should be visible in empty state"
        )

        // No entry rows should exist
        let entryRows = app.firstEntryRow
        XCTAssertFalse(
            entryRows.waitForExistence(timeout: 2),
            "No entry rows should exist in empty state"
        )

        captureScreenshot(name: "empty_state")
    }
}
