Rewrite all UI tests following fail-fast TEST_RULES patterns
Rewrote 60+ test files to follow honeydue-style test guidelines:
- defaultTimeout=2s, navigationTimeout=5s — fail fast, no long waits
- No coordinate taps (except onboarding paged TabView swipes)
- No sleep(), no retry loops
- No guard...else { return } silent passes — XCTFail everywhere
- All elements by accessibility ID via UITestID constants
- Screen objects for all navigation/actions/assertions
- One logical assertion per test method
Added missing accessibility identifiers to app views:
- MonthView.swift: added AccessibilityID.MonthView.grid to ScrollView
- YearView.swift: added AccessibilityID.YearView.heatmap to ScrollView
Framework rewrites:
- BaseUITestCase: added session ID, localeArguments, extraLaunchArguments
- WaitHelpers: waitForExistenceOrFail, waitUntilHittableOrFail,
waitForNonExistence, scrollIntoView, forceTap
- All 7 screen objects rewritten with fail-fast semantics
- TEST_RULES.md added with non-negotiable rules
Known remaining issues:
- OnboardingTests: paged TabView swipes unreliable on iOS 26 simulator
- SettingsLegalLinksTests: EULA/Privacy buttons too deep in DEBUG scroll
- Customization horizontal picker scrolling needs further tuning
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,74 +12,64 @@ final class YearShareTemplateTests: BaseUITestCase {
|
||||
override var seedFixture: String? { "week_of_moods" }
|
||||
override var bypassSubscription: Bool { true }
|
||||
|
||||
/// TC-111: Tap Year share button → verify Gradient design renders in SharingStylePickerView.
|
||||
/// TC-111: Tap Year share button and verify Gradient design renders.
|
||||
func testYearShare_GradientTemplate_Renders() {
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
tabBar.tapYear()
|
||||
|
||||
// Wait for year view to load and find the share button
|
||||
let shareButton = app.element(UITestID.Year.shareButton)
|
||||
XCTAssertTrue(
|
||||
shareButton.waitForExistence(timeout: 8),
|
||||
"Year share button should exist"
|
||||
shareButton.waitUntilHittableOrFail(
|
||||
timeout: navigationTimeout,
|
||||
message: "Year share button should be hittable"
|
||||
)
|
||||
shareButton.forceTap()
|
||||
|
||||
shareButton.tapWhenReady()
|
||||
|
||||
// Verify the SharingStylePickerView sheet appears
|
||||
// Verify the sharing picker appears
|
||||
let exitButton = app.buttons["Exit"].firstMatch
|
||||
XCTAssertTrue(
|
||||
exitButton.waitForExistence(timeout: 5),
|
||||
"Sharing picker Exit button should appear"
|
||||
exitButton.waitForExistenceOrFail(
|
||||
timeout: navigationTimeout,
|
||||
message: "Sharing picker Exit button should appear"
|
||||
)
|
||||
|
||||
// Verify the title "All Time Moods" appears (YearView sends "All Time Moods")
|
||||
// Note: YearView creates SharePickerData with title based on year number,
|
||||
// but the first design is "Gradient"
|
||||
let gradientLabel = app.staticTexts["Gradient"].firstMatch
|
||||
XCTAssertTrue(
|
||||
gradientLabel.waitForExistence(timeout: 5),
|
||||
"Gradient design label should be visible"
|
||||
gradientLabel.waitForExistenceOrFail(
|
||||
timeout: navigationTimeout,
|
||||
message: "Gradient design label should be visible"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "year_share_gradient")
|
||||
|
||||
// Close the picker
|
||||
exitButton.tap()
|
||||
exitButton.forceTap()
|
||||
}
|
||||
|
||||
/// TC-112: Swipe to second design → verify Color Block design renders.
|
||||
/// TC-112: Swipe to second design and verify Color Block design renders.
|
||||
func testYearShare_ColorBlockTemplate_Renders() {
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
tabBar.tapYear()
|
||||
|
||||
let shareButton = app.element(UITestID.Year.shareButton)
|
||||
XCTAssertTrue(
|
||||
shareButton.waitForExistence(timeout: 8),
|
||||
"Year share button should exist"
|
||||
shareButton.waitUntilHittableOrFail(
|
||||
timeout: navigationTimeout,
|
||||
message: "Year share button should be hittable"
|
||||
)
|
||||
|
||||
shareButton.tapWhenReady()
|
||||
shareButton.forceTap()
|
||||
|
||||
let exitButton = app.buttons["Exit"].firstMatch
|
||||
XCTAssertTrue(
|
||||
exitButton.waitForExistence(timeout: 5),
|
||||
"Sharing picker Exit button should appear"
|
||||
exitButton.waitForExistenceOrFail(
|
||||
timeout: navigationTimeout,
|
||||
message: "Sharing picker Exit button should appear"
|
||||
)
|
||||
|
||||
// Swipe left to get to the "Color Block" design (second page in TabView pager)
|
||||
app.swipeLeft()
|
||||
_ = app.waitForExistence(timeout: 1)
|
||||
|
||||
let colorBlockLabel = app.staticTexts["Color Block"].firstMatch
|
||||
XCTAssertTrue(
|
||||
colorBlockLabel.waitForExistence(timeout: 5),
|
||||
"Color Block design label should be visible after swiping"
|
||||
colorBlockLabel.waitForExistenceOrFail(
|
||||
timeout: navigationTimeout,
|
||||
message: "Color Block design label should be visible after swiping"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "year_share_color_block")
|
||||
|
||||
// Close the picker
|
||||
exitButton.tap()
|
||||
exitButton.forceTap()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user