Add 3 passing UI tests (batch 3): deep links and trial expiration
TC-125: feels://subscribe deep link opens subscription view TC-126: Malformed deep link (feels://invalidpath) does not crash TC-078: Trial expired state shows "Trial expired" banner in Settings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
73
Tests iOS/DeepLinkTests.swift
Normal file
73
Tests iOS/DeepLinkTests.swift
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// DeepLinkTests.swift
|
||||
// Tests iOS
|
||||
//
|
||||
// TC-125, TC-126: Deep link handling.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
final class DeepLinkTests: BaseUITestCase {
|
||||
override var seedFixture: String? { "empty" }
|
||||
override var bypassSubscription: Bool { false }
|
||||
override var expireTrial: Bool { true }
|
||||
|
||||
/// TC-126: Opening a malformed deep link does not crash the app.
|
||||
func testDeepLink_MalformedURL_NoCrash() {
|
||||
// Verify app launched and is on Day tab
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
XCTAssertTrue(
|
||||
tabBar.dayTab.waitForExistence(timeout: 5),
|
||||
"App should launch to Day tab"
|
||||
)
|
||||
|
||||
// Send a malformed deep link
|
||||
let malformedURL = URL(string: "feels://invalidpath")!
|
||||
app.open(malformedURL)
|
||||
|
||||
// App should still be running and responsive — verify Day tab still exists
|
||||
XCTAssertTrue(
|
||||
tabBar.dayTab.waitForExistence(timeout: 5),
|
||||
"App should remain functional after malformed deep link"
|
||||
)
|
||||
|
||||
// Navigate to another tab to verify full responsiveness
|
||||
tabBar.tapYear()
|
||||
XCTAssertTrue(
|
||||
tabBar.yearTab.waitForExistence(timeout: 3),
|
||||
"App should be fully navigable after malformed deep link"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "deeplink_malformed_no_crash")
|
||||
}
|
||||
|
||||
/// TC-125: feels://subscribe opens subscription view.
|
||||
func testDeepLink_Subscribe_OpensPaywall() {
|
||||
// Verify app launched
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
XCTAssertTrue(
|
||||
tabBar.dayTab.waitForExistence(timeout: 5),
|
||||
"App should launch to Day tab"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "deeplink_before_subscribe")
|
||||
|
||||
// Send subscribe deep link
|
||||
let subscribeURL = URL(string: "feels://subscribe")!
|
||||
app.open(subscribeURL)
|
||||
|
||||
// Subscription view should appear as a sheet.
|
||||
// Look for common subscription UI elements.
|
||||
let subscribeText = app.staticTexts.matching(
|
||||
NSPredicate(format: "label CONTAINS[c] 'subscribe' OR label CONTAINS[c] 'premium' OR label CONTAINS[c] 'upgrade' OR label CONTAINS[c] 'Feels+'")
|
||||
).firstMatch
|
||||
|
||||
let found = subscribeText.waitForExistence(timeout: 8)
|
||||
|
||||
captureScreenshot(name: "deeplink_subscribe_result")
|
||||
|
||||
XCTAssertTrue(found,
|
||||
"Subscription view should appear after feels://subscribe deep link"
|
||||
)
|
||||
}
|
||||
}
|
||||
34
Tests iOS/TrialExpirationTests.swift
Normal file
34
Tests iOS/TrialExpirationTests.swift
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// TrialExpirationTests.swift
|
||||
// Tests iOS
|
||||
//
|
||||
// TC-078: Trial expiration state is reflected in the UI.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
final class TrialExpirationTests: BaseUITestCase {
|
||||
override var seedFixture: String? { "empty" }
|
||||
override var bypassSubscription: Bool { false }
|
||||
override var expireTrial: Bool { true }
|
||||
|
||||
/// TC-078: When trial is expired, Settings shows "Trial expired" text
|
||||
/// and the upgrade banner is visible.
|
||||
func testTrialExpired_ShowsExpiredBanner() {
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
let settingsScreen = tabBar.tapSettings()
|
||||
settingsScreen.assertVisible()
|
||||
|
||||
// Verify upgrade banner is visible (trial expired, not subscribed)
|
||||
settingsScreen.assertUpgradeBannerVisible()
|
||||
|
||||
// Check for "Trial expired" text in the banner
|
||||
let expiredText = app.staticTexts["Trial expired"]
|
||||
XCTAssertTrue(
|
||||
expiredText.waitForExistence(timeout: 5),
|
||||
"Settings should show 'Trial expired' text when trial has expired"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "trial_expired_banner")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user