//
//  SettingsLegalLinksTests.swift
//  Tests iOS
//
//  TC-065, TC-066: Privacy Policy and EULA link buttons exist and are tappable.
//

import XCTest

final class SettingsLegalLinksTests: BaseUITestCase {
    override var seedFixture: String? { "empty" }
    override var bypassSubscription: Bool { true }

    /// TC-065: Privacy Policy button exists and is tappable.
    func testSettings_PrivacyPolicyButton_Exists() {
        let tabBar = TabBarScreen(app: app)
        let settingsScreen = tabBar.tapSettings()
        settingsScreen.assertVisible()

        settingsScreen.tapSettingsTab()

        let privacyBtn = app.element(UITestID.Settings.privacyPolicyButton)
        if !privacyBtn.waitForExistence(timeout: 3) {
            _ = app.swipeUntilExists(privacyBtn, direction: .up, maxSwipes: 8)
        }

        XCTAssertTrue(
            privacyBtn.exists,
            "Privacy Policy button should be visible in Settings"
        )

        captureScreenshot(name: "settings_privacy_policy_visible")
    }

    /// TC-066: EULA button exists and is tappable.
    func testSettings_EULAButton_Exists() {
        let tabBar = TabBarScreen(app: app)
        let settingsScreen = tabBar.tapSettings()
        settingsScreen.assertVisible()

        settingsScreen.tapSettingsTab()

        let eulaBtn = app.element(UITestID.Settings.eulaButton)
        if !eulaBtn.waitForExistence(timeout: 3) {
            _ = app.swipeUntilExists(eulaBtn, direction: .up, maxSwipes: 8)
        }

        XCTAssertTrue(
            eulaBtn.exists,
            "EULA button should be visible in Settings"
        )

        captureScreenshot(name: "settings_eula_visible")
    }
}
