- Added month_grid accessibility ID to MonthView ScrollView - Added year_heatmap accessibility ID to YearView ScrollView - Fixed DayScreen.assertVisible() to accept entry rows OR mood header - Fixed DataPersistenceTests for in-memory storage (fixture re-seeds) - Fixed AppLaunchTests to use week_of_moods fixture (empty has no grid) - Fixed SettingsScreen segmented control tap with multi-strategy fallback - Improved settings scroll with coordinate-based swipe for deep elements - OnboardingScreen swipeToNext uses slow velocity for paged TabView Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
59 lines
2.0 KiB
Swift
59 lines
2.0 KiB
Swift
//
|
|
// SettingsActionTests.swift
|
|
// Tests iOS
|
|
//
|
|
// Settings actions: clear data, analytics toggle.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
final class SettingsActionTests: BaseUITestCase {
|
|
override var seedFixture: String? { "week_of_moods" }
|
|
override var bypassSubscription: Bool { true }
|
|
|
|
/// TC-063 / TC-160: Navigate to Settings, clear all data, verify app remains usable.
|
|
func testClearData_RemovesAllEntries() {
|
|
// Verify we have data before clearing
|
|
let dayScreen = DayScreen(app: app)
|
|
dayScreen.assertAnyEntryExists()
|
|
|
|
// Navigate to Settings > Settings sub-tab
|
|
let tabBar = TabBarScreen(app: app)
|
|
let settingsScreen = tabBar.tapSettings()
|
|
settingsScreen.assertVisible()
|
|
settingsScreen.tapSettingsTab()
|
|
|
|
// Scroll to and tap Clear All Data (tapClearData handles scrolling)
|
|
settingsScreen.tapClearData()
|
|
|
|
// Navigate back to Day tab
|
|
tabBar.tapDay()
|
|
|
|
// App should remain usable: mood header, entries, or empty state visible
|
|
let moodHeader = app.element(UITestID.Day.moodHeader)
|
|
let emptyState = app.element(UITestID.Day.emptyStateNoData)
|
|
let entryRow = app.firstEntryRow
|
|
|
|
let anyVisible = moodHeader.waitForExistence(timeout: navigationTimeout)
|
|
|| emptyState.waitForExistence(timeout: defaultTimeout)
|
|
|| entryRow.waitForExistence(timeout: defaultTimeout)
|
|
|
|
XCTAssertTrue(anyVisible, "Day view should show mood header, entries, or empty state after clearing data")
|
|
|
|
captureScreenshot(name: "data_cleared")
|
|
}
|
|
|
|
/// TC-067: Toggle analytics opt-out.
|
|
func testAnalyticsToggle_Tappable() {
|
|
let tabBar = TabBarScreen(app: app)
|
|
let settingsScreen = tabBar.tapSettings()
|
|
settingsScreen.assertVisible()
|
|
settingsScreen.tapSettingsTab()
|
|
|
|
// Scroll to analytics toggle and tap it (tapAnalyticsToggle handles scrolling)
|
|
settingsScreen.tapAnalyticsToggle()
|
|
|
|
captureScreenshot(name: "analytics_toggled")
|
|
}
|
|
}
|