// Days' settings, organised as Comms' You (owner, 23 Nov 2026; shared/DECISIONS.md): the profile // card, Google calendars, Week starts on, Sync, Storage, Help and feedback and About, in that order, each saying how it // stands and opening its own page, Back returning to the list; Sign out on Profile alone. Storage's // parts and Free up space, Share a report shown whole first, and About's facts stand on their pages. // At the default text size and the largest. import XCTest final class DaysSettingsTests: XCTestCase { override func setUp() { continueAfterFailure = false } @MainActor private func launched(_ extra: [String] = []) -> XCUIApplication { DaysUI.launch(["-days-open", "settings"] + extra) } // RULE: the card, then Google calendars, Week starts on, Sync, Storage, Help and feedback and About, in that order. @MainActor func testSettingsAreGroupedAsComms() { SettingsGroupedUI.assertList(launched(), own: ["look", "calendars", "week"]) } // RULE: each row opens its own page and Back returns to the list; Sign out stands on Profile. @MainActor func testEachRowOpensItsPage() { SettingsGroupedUI.assertPages(launched(), backID: "days-settings-back") } // RULE: Share a report shows the whole report first; Close closes it with nothing shared. @MainActor func testShareAReportShowsTheReportFirst() { SettingsGroupedUI.assertReportShownFirst(launched()) } // RULE (store pass, 24 Nov 2026): signed out, Google calendars says why and offers Sign in right there, which // signs in as Settings' card does (the number asked); never a dead end. Skipped on a signed-in simulator. @MainActor func testGoogleCalendarsSignedOutOffersSignIn() throws { let app = launched() SettingsGroupedUI.open(app, "calendars") let unavailable = SettingsGroupedUI.id(app, "days-google-unavailable") // Signed out, the core says to sign in first; signed in, it offers Connect, or says this server cannot connect. guard unavailable.waitForExistence(timeout: 15), unavailable.label.localizedCaseInsensitiveContains("sign in") else { throw XCTSkip("Days is signed in on this simulator: Google calendars has no Sign in to offer") } let signIn = app.buttons["days-google-sign-in"] XCTAssertTrue(signIn.waitForExistence(timeout: 5), "Sign in stands under why") XCTAssertEqual(signIn.label, "Sign in") XCTAssertLessThan(unavailable.frame.minY, signIn.frame.minY) signIn.tap() XCTAssertTrue(SettingsGroupedUI.id(app, "home-customer-phone").waitForExistence(timeout: 20), "Sign in asks the number") } // RULE (store pass, 24 Nov 2026): Help and feedback ends with Privacy policy and Help and contact; the policy opens. @MainActor func testThePrivacyPolicyOpensFromHelp() { SettingsGroupedUI.assertPrivacyOpens(launched()) } // RULE: at the largest text every row still stands, each page opens, and the report's Close and Share stay in the window. @MainActor func testSettingsAtTheLargestText() { let app = launched(SettingsPartsUI.largestText) SettingsGroupedUI.assertList(app, own: ["look", "calendars", "week"]) SettingsGroupedUI.assertPages(app, backID: "days-settings-back") } // RULE: the whole list draws on the first frame from what this phone holds; the read fills values in place. @MainActor func testTheListDrawsWholeAtOnce() { SettingsGroupedUI.assertDrawnWhole({ self.launched($0) }, own: ["calendars", "week"]) } }