//
//  SettingsTests.swift
//  Tests iOS
//
//  Settings tab structure and segmented control tests.
//

import XCTest

final class SettingsTests: BaseUITestCase {
    override var seedFixture: String? { "empty" }
    override var bypassSubscription: Bool { false }

    /// Navigate to Settings and verify the header and upgrade banner appear.
    func testSettingsTab_ShowsHeaderAndUpgradeBanner() {
        let tabBar = TabBarScreen(app: app)
        let settingsScreen = tabBar.tapSettings()

        settingsScreen.assertVisible()

        // With subscription NOT bypassed, upgrade banner should be visible
        settingsScreen.assertUpgradeBannerVisible()

        captureScreenshot(name: "settings_with_upgrade_banner")
    }

    /// Toggle between Customize and Settings segments.
    func testSettingsTab_SegmentedControlToggle() {
        let tabBar = TabBarScreen(app: app)
        let settingsScreen = tabBar.tapSettings()

        settingsScreen.assertVisible()

        // Switch to Settings sub-tab
        settingsScreen.tapSettingsTab()
        // Verify we're on the Settings sub-tab (check for a settings-specific element)
        // The "Settings" segment should be selected now
        captureScreenshot(name: "settings_subtab")

        // Switch back to Customize
        settingsScreen.tapCustomizeTab()
        captureScreenshot(name: "customize_subtab")
    }
}
