Cotton code
60 lines · 3.1 KB · SwiftRaw
// Comms' You offers the one settings shape (DECISIONS.md "Settings", 21 Nov// 2026), grouped as you-grouped.html draws it: Storage (Your data, Photos// and files, Other, and Downloads where the app keeps any; Free up space), Help and feedback (Share a// report, the whole report shown before it is shared) and About (Version,// and the account's internal facts, which live there alone) are each their// own page under You's rows. At the default text size and the largest.import XCTestfinal class ChatYouSettingsTests: XCTestCase {    override func setUp() { continueAfterFailure = false }    @MainActor private func launched(_ page: String, _ extra: [String] = []) -> XCUIApplication {        let app = XCUIApplication()        app.launchArguments += ["-chat-warm-seed", "YES", "-chat-warm-place", "you", "-chat-warm-you", page] + extra        app.launch()        return app    }    @MainActor private func shape(_ extra: [String]) {        let storage = launched("storage", extra)        XCTAssertTrue(SettingsPartsUI.id(storage, "you-storage-page").waitForExistence(timeout: 60), "Storage is its own page")        // Downloads stands only in an app that keeps downloads (c8dd6239db), so not in Comms.        for part in ["data", "files", "other"] {            XCTAssertTrue(SettingsPartsUI.id(storage, "settings-storage-\(part)").waitForExistence(timeout: 10), "Storage says \(part)")        }        XCTAssertTrue(SettingsPartsUI.id(storage, "settings-free-up").exists, "Storage offers Free up space")        XCTAssertFalse(SettingsPartsUI.id(storage, "settings-share-report").exists, "Help and feedback stands on its own page")        storage.terminate()        let about = launched("about", extra)        XCTAssertTrue(SettingsPartsUI.id(about, "settings-about-version").waitForExistence(timeout: 60), "About says the version")        XCTAssertFalse(SettingsPartsUI.id(about, "settings-storage-data").exists, "Storage stands on its own page")    }    // RULE: Storage, Help and feedback and About each stand on their own page.    @MainActor func testSettingsHaveOneShape() {        shape([])    }    // RULE: the account's facts stand under About, and nowhere else on You.    @MainActor func testTheFactsStandUnderAbout() {        let app = launched("about")        SettingsPartsUI.assertFactsUnderAbout(app)        app.terminate()        let top = launched("none")        XCTAssertTrue(SettingsPartsUI.id(top, "you-row-about").waitForExistence(timeout: 60))        XCTAssertEqual(top.descendants(matching: .any).matching(NSPredicate(format: "identifier BEGINSWITH 'settings-about-'")).count, 0, "no fact on You's top level")    }    // RULE: Share a report shows the whole report first; Close closes it with nothing shared.    @MainActor func testShareAReportShowsTheReportFirst() {        SettingsPartsUI.assertReportShownFirst(launched("help"))    }    // RULE: at the largest text the pages still stand, and the report's Close and Share stay in the window.    @MainActor func testSettingsAtTheLargestText() {        shape(SettingsPartsUI.largestText)        SettingsPartsUI.assertReportShownFirst(launched("help", SettingsPartsUI.largestText))    }}