Refactor ZStack layouts to .background(), add Year View accessibility IDs, triage QA test plan
Replace ZStack-with-gradient patterns with idiomatic .background() modifier across onboarding, customize, and settings views. Add accessibility identifiers to Year View charts for UI test automation. Mark 67 impossible-to-automate tests RED in QA plan and scaffold initial Year View and Settings onboarding tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -82,6 +82,14 @@ enum UITestID {
|
||||
static let header = "insights_header"
|
||||
}
|
||||
|
||||
enum Year {
|
||||
static let donutChart = "year_donut_chart"
|
||||
static let barChart = "year_bar_chart"
|
||||
static let statsSection = "year_stats_section"
|
||||
static func cardHeader(year: Int) -> String { "year_card_header_\(year)" }
|
||||
static let shareButton = "year_share_button"
|
||||
}
|
||||
|
||||
enum Month {
|
||||
static let grid = "month_grid"
|
||||
}
|
||||
|
||||
48
Tests iOS/SettingsOnboardingTests.swift
Normal file
48
Tests iOS/SettingsOnboardingTests.swift
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// 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"
|
||||
)
|
||||
}
|
||||
}
|
||||
51
Tests iOS/YearViewDisplayTests.swift
Normal file
51
Tests iOS/YearViewDisplayTests.swift
Normal file
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// YearViewDisplayTests.swift
|
||||
// Tests iOS
|
||||
//
|
||||
// Year View display tests: donut chart, bar chart.
|
||||
// TC-035, TC-036
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
final class YearViewDisplayTests: BaseUITestCase {
|
||||
override var seedFixture: String? { "week_of_moods" }
|
||||
override var bypassSubscription: Bool { true }
|
||||
|
||||
/// TC-035: Year View shows donut chart with mood distribution.
|
||||
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")
|
||||
|
||||
// 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)
|
||||
|
||||
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.
|
||||
func testYearView_BarChartVisible() {
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
tabBar.tapYear()
|
||||
|
||||
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)
|
||||
|
||||
captureScreenshot(name: "year_bar_chart")
|
||||
|
||||
XCTAssertTrue(found, "Bar chart should be visible in Year View")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user