68 lines
2.2 KiB
Swift
68 lines
2.2 KiB
Swift
//
|
|
// PaywallGateTests.swift
|
|
// Tests iOS
|
|
//
|
|
// Paywall gate tests: verify paywall overlays appear on premium views
|
|
// when trial is expired and subscription is not bypassed.
|
|
// TC-032, TC-039, TC-048
|
|
//
|
|
|
|
import XCTest
|
|
|
|
final class PaywallGateTests: BaseUITestCase {
|
|
override var seedFixture: String? { "empty" }
|
|
override var bypassSubscription: Bool { false }
|
|
override var expireTrial: Bool { true }
|
|
|
|
/// TC-032: Paywall overlay appears on Month view when trial expired.
|
|
func testMonthView_PaywallOverlay_WhenTrialExpired() {
|
|
let tabBar = TabBarScreen(app: app)
|
|
tabBar.tapMonth()
|
|
|
|
// Verify the paywall overlay is present
|
|
let overlay = app.descendants(matching: .any)
|
|
.matching(identifier: UITestID.Paywall.monthOverlay)
|
|
.firstMatch
|
|
XCTAssertTrue(
|
|
overlay.waitForExistence(timeout: 5),
|
|
"Month paywall overlay should appear when trial is expired"
|
|
)
|
|
|
|
captureScreenshot(name: "month_paywall_overlay")
|
|
}
|
|
|
|
/// TC-039: Paywall overlay appears on Year view when trial expired.
|
|
func testYearView_PaywallOverlay_WhenTrialExpired() {
|
|
let tabBar = TabBarScreen(app: app)
|
|
tabBar.tapYear()
|
|
|
|
// Verify the paywall overlay is present
|
|
let overlay = app.descendants(matching: .any)
|
|
.matching(identifier: UITestID.Paywall.yearOverlay)
|
|
.firstMatch
|
|
XCTAssertTrue(
|
|
overlay.waitForExistence(timeout: 5),
|
|
"Year paywall overlay should appear when trial is expired"
|
|
)
|
|
|
|
captureScreenshot(name: "year_paywall_overlay")
|
|
}
|
|
|
|
/// TC-048: Paywall overlay appears on Insights view when trial expired.
|
|
func testInsightsView_PaywallOverlay_WhenTrialExpired() {
|
|
let tabBar = TabBarScreen(app: app)
|
|
tabBar.tapInsights()
|
|
|
|
// Verify the paywall overlay is present
|
|
let overlay = app.descendants(matching: .any)
|
|
.matching(identifier: UITestID.Paywall.insightsOverlay)
|
|
.firstMatch
|
|
XCTAssertTrue(
|
|
overlay.waitForExistence(timeout: 5),
|
|
"Insights paywall overlay should appear when trial is expired"
|
|
)
|
|
|
|
captureScreenshot(name: "insights_paywall_overlay")
|
|
}
|
|
}
|