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:
@@ -16,11 +16,9 @@ final class PremiumCustomizationTests: BaseUITestCase {
|
||||
|
||||
/// TC-075: Upgrade banner visible on Customize tab when trial expired.
|
||||
func testCustomizeTab_UpgradeBannerVisible_WhenTrialExpired() {
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
let settingsScreen = tabBar.tapSettings()
|
||||
let settingsScreen = TabBarScreen(app: app).tapSettings()
|
||||
settingsScreen.assertVisible()
|
||||
|
||||
// Verify the upgrade banner is visible
|
||||
settingsScreen.assertUpgradeBannerVisible()
|
||||
|
||||
captureScreenshot(name: "customize_upgrade_banner")
|
||||
@@ -28,47 +26,33 @@ final class PremiumCustomizationTests: BaseUITestCase {
|
||||
|
||||
/// TC-075: Subscribe button visible on Customize tab when trial expired.
|
||||
func testCustomizeTab_SubscribeButtonVisible_WhenTrialExpired() {
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
let settingsScreen = tabBar.tapSettings()
|
||||
let settingsScreen = TabBarScreen(app: app).tapSettings()
|
||||
settingsScreen.assertVisible()
|
||||
|
||||
// Verify the subscribe button exists
|
||||
let subscribeButton = settingsScreen.subscribeButton
|
||||
XCTAssertTrue(
|
||||
subscribeButton.waitForExistence(timeout: 5),
|
||||
"Subscribe button should be visible when trial is expired"
|
||||
)
|
||||
settingsScreen.subscribeButton
|
||||
.waitForExistenceOrFail(
|
||||
timeout: navigationTimeout,
|
||||
message: "Subscribe button should be visible when trial is expired"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "customize_subscribe_button")
|
||||
}
|
||||
|
||||
/// TC-075: Tapping subscribe button opens subscription sheet.
|
||||
/// TC-075: Tapping subscribe button opens subscription sheet without crash.
|
||||
func testCustomizeTab_SubscribeButtonOpensSheet() {
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
let settingsScreen = tabBar.tapSettings()
|
||||
let settingsScreen = TabBarScreen(app: app).tapSettings()
|
||||
settingsScreen.assertVisible()
|
||||
|
||||
// Tap the subscribe button
|
||||
let subscribeButton = settingsScreen.subscribeButton
|
||||
XCTAssertTrue(
|
||||
subscribeButton.waitForExistence(timeout: 5),
|
||||
"Subscribe button should exist"
|
||||
)
|
||||
subscribeButton.tapWhenReady()
|
||||
settingsScreen.subscribeButton
|
||||
.waitUntilHittableOrFail(timeout: navigationTimeout, message: "Subscribe button should be hittable")
|
||||
.forceTap()
|
||||
|
||||
// Verify the subscription sheet appears — look for common subscription
|
||||
// sheet elements (subscription store view or paywall content).
|
||||
// The ReflectSubscriptionStoreView should appear as a sheet.
|
||||
// Give extra time for StoreKit to load products.
|
||||
let subscriptionSheet = app.otherElements.firstMatch
|
||||
_ = subscriptionSheet.waitForExistence(timeout: 5)
|
||||
|
||||
// The subscription sheet is confirmed if it appeared without crashing.
|
||||
// Verify the subscription sheet appears without crashing.
|
||||
// StoreKit may not load products in test environments, so just verify
|
||||
// we didn't crash and can still interact with the app.
|
||||
// we didn't crash and can still interact with the app after dismissing.
|
||||
captureScreenshot(name: "subscription_sheet_opened")
|
||||
|
||||
// Dismiss the sheet by swiping down
|
||||
// Dismiss the sheet
|
||||
app.swipeDown()
|
||||
|
||||
// Verify we can still see the settings screen (no crash)
|
||||
@@ -77,22 +61,15 @@ final class PremiumCustomizationTests: BaseUITestCase {
|
||||
captureScreenshot(name: "settings_after_subscription_sheet_dismissed")
|
||||
}
|
||||
|
||||
/// TC-075: Settings sub-tab also shows paywall gate when trial expired.
|
||||
/// TC-075: Settings sub-tab shows upgrade CTA when trial expired.
|
||||
func testSettingsSubTab_ShowsPaywallGate_WhenTrialExpired() {
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
let settingsScreen = tabBar.tapSettings()
|
||||
let settingsScreen = TabBarScreen(app: app).tapSettings()
|
||||
settingsScreen.assertVisible()
|
||||
|
||||
// Switch to Settings sub-tab
|
||||
settingsScreen.tapSettingsTab()
|
||||
|
||||
// Verify the upgrade banner or subscribe CTA is visible on Settings sub-tab too
|
||||
let upgradeBanner = settingsScreen.upgradeBanner
|
||||
let subscribeButton = settingsScreen.subscribeButton
|
||||
|
||||
// Either the upgrade banner or subscribe button should be present
|
||||
let bannerExists = upgradeBanner.waitForExistence(timeout: 3)
|
||||
let buttonExists = subscribeButton.waitForExistence(timeout: 3)
|
||||
let bannerExists = settingsScreen.upgradeBanner.waitForExistence(timeout: navigationTimeout)
|
||||
let buttonExists = settingsScreen.subscribeButton.waitForExistence(timeout: defaultTimeout)
|
||||
|
||||
XCTAssertTrue(
|
||||
bannerExists || buttonExists,
|
||||
|
||||
Reference in New Issue
Block a user