Cotton code
59 lines · 3.2 KB · SwiftRaw
// Words's settings, organised as Comms' You (owner, 23 Nov 2026; shared/DECISIONS.md): the profile// card, Look, Import notes, Export all notes, 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 XCTestfinal class NotesAccountSettingsTests: XCTestCase {    override func setUp() { continueAfterFailure = false }    @MainActor private func launched(_ extra: [String] = []) -> XCUIApplication {        NotesUI.launch(["-notes-open", "settings"] + extra)    }    // RULE: the card, then Look, Import notes, Export all notes, Sync, Storage, Help and feedback and About, in that order.    @MainActor func testSettingsAreGroupedAsComms() {        SettingsGroupedUI.assertList(launched(), own: ["look", "import", "export"])    }    // 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: "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): 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", "import", "export"])        SettingsGroupedUI.assertPages(app, backID: "settings-back")    }    // RULE: the side page's Account opens Settings on Profile, and its Back closes it.    @MainActor func testAccountOpensProfile() {        let app = NotesUI.launch(["-notes-open", "account"])        XCTAssertTrue(SettingsGroupedUI.id(app, "notes-account").waitForExistence(timeout: 60), "Account opens Profile")        let way = SettingsGroupedUI.id(app, "settings-sign-out").waitForExistence(timeout: 30)            || SettingsGroupedUI.id(app, "settings-profile-account_sign_in").exists        XCTAssertTrue(way, "Profile holds Sign out, or Sign in signed out")        SettingsGroupedUI.id(app, "settings-back").tap()        XCTAssertTrue(SettingsPartsUI.waitGone(SettingsGroupedUI.id(app, "notes-account")), "Back closes it")        XCTAssertFalse(SettingsGroupedUI.id(app, "settings-card").exists, "and does not stand on the list")    }    // 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: ["look", "import", "export"])    }}