- Add 8 new test files: HeaderMoodLogging (TC-002), DayViewGrouping (TC-019), AllDayViewStyles (TC-021), MonthViewInteraction (TC-030), PaywallGate (TC-032/039/048), AppTheme (TC-070), IconPack (TC-072), PremiumCustomization (TC-075) - Add accessibility IDs for paywall overlays, icon packs, app theme cards, and day view section headers - Add --expire-trial launch argument to UITestMode for paywall gate testing - Update QA test plan spreadsheet with XCUITest names for 14 test cases - Include existing test infrastructure: screen objects, helpers, base class, and 19 previously written test files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
1.6 KiB
Swift
52 lines
1.6 KiB
Swift
//
|
|
// DataPersistenceTests.swift
|
|
// Tests iOS
|
|
//
|
|
// Data persistence tests — verify entries survive app relaunch.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
final class DataPersistenceTests: BaseUITestCase {
|
|
override var seedFixture: String? { "empty" }
|
|
|
|
/// TC-156: Log a mood, force quit, relaunch → entry should persist.
|
|
func testDataPersists_AcrossRelaunch() {
|
|
let dayScreen = DayScreen(app: app)
|
|
|
|
// Log a mood
|
|
dayScreen.assertMoodHeaderVisible()
|
|
dayScreen.logMood(.great)
|
|
|
|
// Verify entry was created
|
|
let greatEntry = app.descendants(matching: .any)
|
|
.matching(NSPredicate(format: "label CONTAINS[cd] %@", "Great"))
|
|
.firstMatch
|
|
XCTAssertTrue(
|
|
greatEntry.waitForExistence(timeout: 8),
|
|
"Entry should appear after logging"
|
|
)
|
|
|
|
captureScreenshot(name: "before_relaunch")
|
|
|
|
// Terminate the app
|
|
app.terminate()
|
|
|
|
// Relaunch WITHOUT --reset-state to preserve data
|
|
let freshApp = XCUIApplication()
|
|
freshApp.launchArguments = ["--ui-testing", "--disable-animations", "--bypass-subscription", "--skip-onboarding"]
|
|
freshApp.launch()
|
|
|
|
// The entry should still exist after relaunch
|
|
let entryRow = freshApp.descendants(matching: .any)
|
|
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
|
|
.firstMatch
|
|
XCTAssertTrue(
|
|
entryRow.waitForExistence(timeout: 8),
|
|
"Entry should persist after force quit and relaunch"
|
|
)
|
|
|
|
captureScreenshot(name: "after_relaunch_data_persists")
|
|
}
|
|
}
|