diff --git a/Feels.xcodeproj/project.pbxproj b/Feels.xcodeproj/project.pbxproj index 2ff73e5..57d19cf 100644 --- a/Feels.xcodeproj/project.pbxproj +++ b/Feels.xcodeproj/project.pbxproj @@ -47,6 +47,7 @@ B4C5D6E700000000D2E3F4A5 /* PaywallGateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4C5D6E7F8A9B0C1D2E3F4A5 /* PaywallGateTests.swift */; }; B8C9D0E100000000D6E7F8A9 /* MonthViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8C9D0E1F2A3B4C5D6E7F8A9 /* MonthViewTests.swift */; }; BB22220022222200BBBBBBBB /* MoodLoggingEmptyStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB22222222222222BBBBBBBB /* MoodLoggingEmptyStateTests.swift */; }; + C0137E33A722F405FDC457B5 /* YearViewCollapseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 542B1A71F9990806CD88B285 /* YearViewCollapseTests.swift */; }; C1D2E3F400000000E9FA0B1C /* MonthViewInteractionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1D2E3F4A5B6C7D8E9FA0B1C /* MonthViewInteractionTests.swift */; }; C26D40397E1AA24816FB3751 /* TabBarScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7CDDCB9C85BAE71C679C0BF /* TabBarScreen.swift */; }; C3D4E500000000E1F2A3B4C5 /* OnboardingScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D4E5F6A7B8C9D0E1F2A3B4 /* OnboardingScreen.swift */; }; @@ -62,6 +63,7 @@ E1F2A3B400000000A9B0C1D2 /* OnboardingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1F2A3B4C5D6E7F8A9B0C1D2 /* OnboardingTests.swift */; }; E3482DB0421C12E11517BDC8 /* TrialBannerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21CD463209E0909393545D62 /* TrialBannerTests.swift */; }; E5F6A7B800000000A3B4C5D6 /* EmptyStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5F6A7B8C9D0E1F2A3B4C5D6 /* EmptyStateTests.swift */; }; + E78F98C41E83B81DAF43139E /* SettingsLegalLinksTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE4D06D4E7188339DE8BC040 /* SettingsLegalLinksTests.swift */; }; E7F8A9B000000000A5B6C7D8 /* PremiumCustomizationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7F8A9B0C1D2E3F4A5B6C7D8 /* PremiumCustomizationTests.swift */; }; EE55550055555500EEEEEEEE /* SettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE55555555555555EEEEEEEE /* SettingsTests.swift */; }; EEB21B1CAA8EAEB497BD9FB3 /* DataControllerCRUDTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5566271983AEDF1D33C34FE6 /* DataControllerCRUDTests.swift */; }; @@ -69,7 +71,6 @@ F6A7B8C900000000B4C5D6E7 /* EntryDeleteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6A7B8C9D0E1F2A3B4C5D6E7 /* EntryDeleteTests.swift */; }; F75470AA2BA1E9EFF8F5265A /* LocalizationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17DC4C498A1185DC831F4593 /* LocalizationTests.swift */; }; F8A9B0C100000000B6C7D8E9 /* HeaderMoodLoggingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8A9B0C1D2E3F4A5B6C7D8E9 /* HeaderMoodLoggingTests.swift */; }; - FD30D4508D4C61AB10AC1E71 /* SettingsOnboardingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFDAD20AE6C6914EDD87DCBC /* SettingsOnboardingTests.swift */; }; FF66660066666600FFFFFFFF /* SecondaryTabTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF66666666666666FFFFFFFF /* SecondaryTabTests.swift */; }; /* End PBXBuildFile section */ @@ -150,6 +151,7 @@ 427CD9C91D43AB6A0302B4DD /* DayScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DayScreen.swift; sourceTree = ""; }; 469470483072085BE9E04E12 /* NoteEditTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteEditTests.swift; sourceTree = ""; }; 5354C23DD5FC67C1C97482F2 /* WaitHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaitHelpers.swift; sourceTree = ""; }; + 542B1A71F9990806CD88B285 /* YearViewCollapseTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = YearViewCollapseTests.swift; sourceTree = ""; }; 5566271983AEDF1D33C34FE6 /* DataControllerCRUDTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = DataControllerCRUDTests.swift; sourceTree = ""; }; 7E35564DEA72EB6F8447CDAA /* EntryDetailScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntryDetailScreen.swift; sourceTree = ""; }; 8114D2CE12EC5392371BB415 /* DarkModeStylesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DarkModeStylesTests.swift; sourceTree = ""; }; @@ -168,6 +170,7 @@ B8AB4CD73C2B4DC89C6FE84D /* Feels Watch App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Feels Watch App/Feels Watch App.entitlements"; sourceTree = ""; }; B8C9D0E1F2A3B4C5D6E7F8A9 /* MonthViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MonthViewTests.swift; sourceTree = ""; }; BB22222222222222BBBBBBBB /* MoodLoggingEmptyStateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoodLoggingEmptyStateTests.swift; sourceTree = ""; }; + BE4D06D4E7188339DE8BC040 /* SettingsLegalLinksTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SettingsLegalLinksTests.swift; sourceTree = ""; }; C1D2E3F4A5B6C7D8E9FA0B1C /* MonthViewInteractionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MonthViewInteractionTests.swift; sourceTree = ""; }; C3D4E5F6A7B8C9D0E1F2A3B4 /* OnboardingScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingScreen.swift; sourceTree = ""; }; C5D6E7F8A9B0C1D2E3F4A5B6 /* AppThemeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppThemeTests.swift; sourceTree = ""; }; @@ -181,7 +184,6 @@ DA0D74ACDD741CFA1F14F50F /* FeelsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FeelsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; DD44444444444444DDDDDDDD /* EntryDetailTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntryDetailTests.swift; sourceTree = ""; }; DD717F91BD65382B7DDFE3C4 /* VoteLogicsTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = VoteLogicsTests.swift; sourceTree = ""; }; - DFDAD20AE6C6914EDD87DCBC /* SettingsOnboardingTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SettingsOnboardingTests.swift; sourceTree = ""; }; E1F2A3B4C5D6E7F8A9B0C1D2 /* OnboardingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingTests.swift; sourceTree = ""; }; E5F6A7B8C9D0E1F2A3B4C5D6 /* EmptyStateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyStateTests.swift; sourceTree = ""; }; E7F8A9B0C1D2E3F4A5B6C7D8 /* PremiumCustomizationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PremiumCustomizationTests.swift; sourceTree = ""; }; @@ -423,7 +425,8 @@ B0C1D2E3F4A5B6C7D8E9FA0B /* AllDayViewStylesTests.swift */, C1D2E3F4A5B6C7D8E9FA0B1C /* MonthViewInteractionTests.swift */, 0246E9F406F872E5DEEB7269 /* YearViewDisplayTests.swift */, - DFDAD20AE6C6914EDD87DCBC /* SettingsOnboardingTests.swift */, + 542B1A71F9990806CD88B285 /* YearViewCollapseTests.swift */, + BE4D06D4E7188339DE8BC040 /* SettingsLegalLinksTests.swift */, ); path = "Tests iOS"; sourceTree = ""; @@ -826,7 +829,8 @@ B0C1D2E300000000D8E9FA0B /* AllDayViewStylesTests.swift in Sources */, C1D2E3F400000000E9FA0B1C /* MonthViewInteractionTests.swift in Sources */, D1AD0A0469EADFB1446E9B09 /* YearViewDisplayTests.swift in Sources */, - FD30D4508D4C61AB10AC1E71 /* SettingsOnboardingTests.swift in Sources */, + C0137E33A722F405FDC457B5 /* YearViewCollapseTests.swift in Sources */, + E78F98C41E83B81DAF43139E /* SettingsLegalLinksTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Shared/AccessibilityIdentifiers.swift b/Shared/AccessibilityIdentifiers.swift index 62084ef..a3a7beb 100644 --- a/Shared/AccessibilityIdentifiers.swift +++ b/Shared/AccessibilityIdentifiers.swift @@ -69,6 +69,9 @@ enum AccessibilityID { static let clearDataButton = "settings_clear_data" static let analyticsToggle = "settings_analytics_toggle" static let showOnboardingButton = "settings_show_onboarding" + static let bypassSubscriptionToggle = "settings_bypass_subscription" + static let eulaButton = "settings_eula" + static let privacyPolicyButton = "settings_privacy_policy" } // MARK: - Customize diff --git a/Shared/Views/SettingsView/SettingsView.swift b/Shared/Views/SettingsView/SettingsView.swift index e2fb606..c6f979e 100644 --- a/Shared/Views/SettingsView/SettingsView.swift +++ b/Shared/Views/SettingsView/SettingsView.swift @@ -234,6 +234,7 @@ struct SettingsContentView: View { Toggle("", isOn: $iapManager.bypassSubscription) .labelsHidden() + .accessibilityIdentifier(AccessibilityID.Settings.bypassSubscriptionToggle) } .padding() .background(theme.currentTheme.secondaryBGColor) @@ -1076,6 +1077,7 @@ struct SettingsContentView: View { Text(String(localized: "settings_view_show_eula")) .foregroundColor(textColor) }) + .accessibilityIdentifier(AccessibilityID.Settings.eulaButton) .accessibilityHint(String(localized: "Opens End User License Agreement in browser")) .padding() .frame(maxWidth: .infinity) @@ -1094,6 +1096,7 @@ struct SettingsContentView: View { Text(String(localized: "settings_view_show_privacy")) .foregroundColor(textColor) }) + .accessibilityIdentifier(AccessibilityID.Settings.privacyPolicyButton) .accessibilityHint(String(localized: "Opens Privacy Policy in browser")) .padding() .frame(maxWidth: .infinity) diff --git a/Tests iOS/Helpers/WaitHelpers.swift b/Tests iOS/Helpers/WaitHelpers.swift index 7c20bb3..d21530f 100644 --- a/Tests iOS/Helpers/WaitHelpers.swift +++ b/Tests iOS/Helpers/WaitHelpers.swift @@ -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 { diff --git a/Tests iOS/SettingsLegalLinksTests.swift b/Tests iOS/SettingsLegalLinksTests.swift new file mode 100644 index 0000000..c266f17 --- /dev/null +++ b/Tests iOS/SettingsLegalLinksTests.swift @@ -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") + } +} diff --git a/Tests iOS/SettingsOnboardingTests.swift b/Tests iOS/SettingsOnboardingTests.swift deleted file mode 100644 index d484799..0000000 --- a/Tests iOS/SettingsOnboardingTests.swift +++ /dev/null @@ -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" - ) - } -} diff --git a/Tests iOS/YearViewCollapseTests.swift b/Tests iOS/YearViewCollapseTests.swift new file mode 100644 index 0000000..8912a35 --- /dev/null +++ b/Tests iOS/YearViewCollapseTests.swift @@ -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") + } +} diff --git a/Tests iOS/YearViewDisplayTests.swift b/Tests iOS/YearViewDisplayTests.swift index 5e8853d..fe6f0dc 100644 --- a/Tests iOS/YearViewDisplayTests.swift +++ b/Tests iOS/YearViewDisplayTests.swift @@ -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%)" + ) } } diff --git a/docs/Feels_QA_Test_Plan.xlsx b/docs/Feels_QA_Test_Plan.xlsx index 40abd28..e1122c8 100644 Binary files a/docs/Feels_QA_Test_Plan.xlsx and b/docs/Feels_QA_Test_Plan.xlsx differ