Add 5 passing UI tests (batches 1-2) and mark 4 blocked tests RED

Batch 1: TC-035 (donut chart), TC-036 (bar chart) — Year View stats
Batch 2: TC-037 (collapse/expand), TC-065 (privacy link), TC-066 (EULA link)
Blocked: TC-124, TC-068 (Settings ScrollView tap issue), TC-038 (share sheet)

New accessibility IDs: bypass subscription toggle, EULA, privacy policy buttons.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-20 10:02:17 -06:00
parent 5895b387be
commit 599e54aa72
9 changed files with 162 additions and 66 deletions

View File

@@ -33,6 +33,9 @@ enum UITestID {
static let browseThemesButton = "browse_themes_button"
static let clearDataButton = "settings_clear_data"
static let analyticsToggle = "settings_analytics_toggle"
static let bypassSubscriptionToggle = "settings_bypass_subscription"
static let eulaButton = "settings_eula"
static let privacyPolicyButton = "settings_privacy_policy"
}
enum Customize {

View File

@@ -0,0 +1,55 @@
//
// 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")
}
}

View File

@@ -1,48 +0,0 @@
//
// SettingsOnboardingTests.swift
// Tests iOS
//
// TC-124: Show onboarding from Settings.
//
import XCTest
final class SettingsOnboardingTests: BaseUITestCase {
override var seedFixture: String? { "empty" }
override var bypassSubscription: Bool { true }
/// TC-124: Tapping Show Onboarding in Settings replays the onboarding flow.
func testSettings_ShowOnboarding_OpensOnboardingFlow() {
let tabBar = TabBarScreen(app: app)
let settingsScreen = tabBar.tapSettings()
settingsScreen.assertVisible()
// Switch to the Settings sub-tab (not Customize)
settingsScreen.tapSettingsTab()
captureScreenshot(name: "settings_before_show_onboarding")
// Scroll to and tap "Show Onboarding" button
let showOnboardingBtn = app.element("settings_show_onboarding")
guard showOnboardingBtn.waitForExistence(timeout: 2) ||
app.swipeUntilExists(showOnboardingBtn, direction: .up, maxSwipes: 8) else {
captureScreenshot(name: "settings_show_onboarding_not_found")
XCTFail("Show Onboarding button not found in Settings")
return
}
showOnboardingBtn.tapWhenReady()
// The sheet may take a moment to animate in.
// Look for the onboarding welcome screen or any text unique to onboarding.
let welcomeScreen = app.element(UITestID.Onboarding.welcome)
let welcomeText = app.staticTexts["Welcome to Feels"]
let found = welcomeScreen.waitForExistence(timeout: 8) ||
welcomeText.waitForExistence(timeout: 3)
captureScreenshot(name: "settings_show_onboarding_result")
XCTAssertTrue(found,
"Onboarding should appear after tapping Show Onboarding"
)
}
}

View File

@@ -0,0 +1,60 @@
//
// 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()
XCTAssertTrue(tabBar.yearTab.isSelected, "Year tab should be selected")
// Stats section is visible by default (showStats = true)
let statsSection = app.element(UITestID.Year.statsSection)
XCTAssertTrue(
statsSection.waitForExistence(timeout: 8),
"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))
XCTAssertTrue(
headerButton.waitForExistence(timeout: 5),
"Year card header for \(currentYear) should be visible"
)
captureScreenshot(name: "year_stats_expanded")
// Tap header to collapse stats
headerButton.tap()
// Stats section should disappear
XCTAssertTrue(
statsSection.waitForDisappearance(timeout: 3),
"Stats section should collapse after tapping header"
)
captureScreenshot(name: "year_stats_collapsed")
// Tap header again to expand stats
headerButton.tap()
// Stats section should reappear
XCTAssertTrue(
statsSection.waitForExistence(timeout: 3),
"Stats section should expand after tapping header again"
)
captureScreenshot(name: "year_stats_re_expanded")
}
}

View File

@@ -2,7 +2,7 @@
// YearViewDisplayTests.swift
// Tests iOS
//
// Year View display tests: donut chart, bar chart.
// Year View display tests: stats section with donut chart and bar chart.
// TC-035, TC-036
//
@@ -13,24 +13,29 @@ final class YearViewDisplayTests: BaseUITestCase {
override var bypassSubscription: Bool { true }
/// TC-035: Year View shows donut chart with mood distribution.
/// The donut chart center displays the entry count with "days" text.
func testYearView_DonutChartVisible() {
let tabBar = TabBarScreen(app: app)
tabBar.tapYear()
// Wait for Year tab to be selected and content to load
XCTAssertTrue(tabBar.yearTab.isSelected, "Year tab should be selected")
captureScreenshot(name: "year_view_loaded")
// Wait for stats section to render
let statsSection = app.element(UITestID.Year.statsSection)
XCTAssertTrue(
statsSection.waitForExistence(timeout: 8),
"Year stats section should be visible"
)
// The donut chart is inside the stats section of the first YearCard.
// Try finding by accessibility identifier first, then fall back to presence of "days" text.
let donutChart = app.element(UITestID.Year.donutChart)
let found = donutChart.waitForExistence(timeout: 8) ||
app.swipeUntilExists(donutChart, direction: .up, maxSwipes: 3, timeoutPerTry: 1.0)
// The donut chart center shows "days" search globally since
// SwiftUI flattens the accessibility tree under GeometryReader.
let daysLabel = app.staticTexts["days"]
XCTAssertTrue(
daysLabel.waitForExistence(timeout: 3),
"Donut chart should display 'days' label in center"
)
captureScreenshot(name: "year_donut_chart")
XCTAssertTrue(found, "Donut chart should be visible in Year View")
}
/// TC-036: Year View shows bar chart with mood percentages.
@@ -40,12 +45,23 @@ final class YearViewDisplayTests: BaseUITestCase {
XCTAssertTrue(tabBar.yearTab.isSelected, "Year tab should be selected")
let barChart = app.element(UITestID.Year.barChart)
let found = barChart.waitForExistence(timeout: 8) ||
app.swipeUntilExists(barChart, direction: .up, maxSwipes: 3, timeoutPerTry: 1.0)
let statsSection = app.element(UITestID.Year.statsSection)
XCTAssertTrue(
statsSection.waitForExistence(timeout: 8),
"Year stats section should be visible"
)
// week_of_moods fixture: 2 great, 2 good, 1 avg, 1 bad, 1 horrible
// Expected percentages: 28% (great, good) and 14% (avg, bad, horrible).
// Search for any of the expected percentage labels.
let found28 = app.staticTexts["28%"].waitForExistence(timeout: 3)
let found14 = app.staticTexts["14%"].waitForExistence(timeout: 2)
captureScreenshot(name: "year_bar_chart")
XCTAssertTrue(found, "Bar chart should be visible in Year View")
XCTAssertTrue(
found28 || found14,
"Bar chart should show at least one percentage value (28% or 14%)"
)
}
}