Files
Sportstime/SportsTimeUITests/Tests/AppLaunchTests.swift
2026-04-03 15:30:54 -05:00

62 lines
1.9 KiB
Swift

//
// AppLaunchTests.swift
// SportsTimeUITests
//
// Verifies app boot, bootstrap, and initial screen rendering.
// QA Sheet: F-001 through F-003
//
import XCTest
final class AppLaunchTests: BaseUITestCase {
/// F-001: Cold launch on first install hero card + all tabs visible.
@MainActor
func testF001_ColdLaunchShowsHomeWithAllTabs() {
let home = HomeScreen(app: app)
home.waitForLoad()
// Assert: Hero card text visible
XCTAssertTrue(home.adventureAwaitsText.exists,
"Hero card should display 'Adventure Awaits'")
// Assert: All tabs present
home.assertTabBarVisible()
captureScreenshot(named: "F001-HomeScreen-Launch")
}
/// F-002: Bootstrap loads bundled data Start Planning is interactable.
@MainActor
func testF002_BootstrapCompletesWithContent() {
let home = HomeScreen(app: app)
home.waitForLoad()
// Assert: Start Planning button is interactable (proves bootstrap loaded data)
XCTAssertTrue(home.startPlanningButton.isHittable,
"Start Planning should be hittable after bootstrap")
}
/// F-006: Background to foreground resume data intact.
@MainActor
func testF006_BackgroundForegroundResume() {
let home = HomeScreen(app: app)
home.waitForLoad()
// Background the app
XCUIDevice.shared.press(.home)
// Foreground
app.activate()
waitUntil(timeout: BaseUITestCase.longTimeout, "App should return to the foreground") {
self.app.state == .runningForeground
}
// Assert: Home still loaded, no re-bootstrap
XCTAssertTrue(
home.startPlanningButton.waitForExistence(timeout: BaseUITestCase.defaultTimeout),
"App should resume without re-bootstrapping"
)
}
}