// The one settings shape every app's settings page offers (DECISIONS.md// "Settings", 21 Nov 2026), as each app's tests check it: Storage's four// parts and Free up space, Help and feedback's Share a report, About's// Version, in that order under Account; Share a report showing the whole// report before anything is shared; the account's internal facts said under// About alone. Every word is the core's; these find the parts by identifier.import XCTestenumSettingsPartsUI { @MainActor staticfunc id(_ app: XCUIApplication, _ identifier: String) -> XCUIElement { app.descendants(matching: .any).matching(identifier: identifier).firstMatch }/// Swipes up until `element` can be touched (at most `tries` times). @MainActor staticfunc reach(_ app: XCUIApplication, _ element: XCUIElement, tries: Int = 14) {for _ in0..<tries where !element.isHittable { app.swipeUp(velocity: .slow) } }/// Storage (Your data, Photos and files, Other, Free up space; Downloads only where the app keeps any),/// Help and feedback (Share a report) and About (Version), in that order. @MainActor staticfunc assertShape(_ app: XCUIApplication, file: StaticString = #filePath, line: UInt = #line) {let storage = id(app, "settings-storage") XCTAssertTrue(storage.waitForExistence(timeout: 60), "Storage stands on the settings page", file: file, line: line)// Downloads stands only in an app that keeps downloads (c8dd6239db): Days, Words, Story and Comms keep none.for part in ["data", "files", "other"] { XCTAssertTrue(id(app, "settings-storage-\(part)").exists, "Storage says \(part)", file: file, line: line) } XCTAssertTrue(id(app, "settings-free-up").exists, "Storage offers Free up space", file: file, line: line)let help = id(app, "settings-help")let about = id(app, "settings-about") XCTAssertTrue(help.exists, "Help and feedback stands", file: file, line: line) XCTAssertTrue(id(app, "settings-share-report").exists, "Help and feedback offers Share a report", file: file, line: line) XCTAssertTrue(about.exists, "About stands", file: file, line: line) XCTAssertTrue(id(app, "settings-about-version").exists, "About says the version", file: file, line: line) XCTAssertLessThan(storage.frame.minY, help.frame.minY, "Storage before Help and feedback", file: file, line: line) XCTAssertLessThan(help.frame.minY, about.frame.minY, "Help and feedback before About", file: file, line: line) }/// Share a report shows the report whole, Close and Share in the window,/// before anything is shared; Close closes it and nothing is shared. @MainActor staticfunc assertReportShownFirst(_ app: XCUIApplication, file: StaticString = #filePath, line: UInt = #line) {let share = id(app, "settings-share-report") XCTAssertTrue(share.waitForExistence(timeout: 60), file: file, line: line) reach(app, share) share.tap()let preview = id(app, "settings-report-preview") XCTAssertTrue(preview.waitForExistence(timeout: 15), "the report is shown first", file: file, line: line)let text = id(app, "settings-report-text") XCTAssertTrue(text.exists, "the report's text stands", file: file, line: line) XCTAssertFalse(text.label.isEmpty, "the report says something", file: file, line: line)let window = app.windows.firstMatch.framefor act in ["settings-report-close", "settings-report-share"] {let button = id(app, act) XCTAssertTrue(button.exists, "\(act) stands", file: file, line: line) XCTAssertTrue(window.contains(button.frame), "\(act) stands inside the window", file: file, line: line) } XCTAssertFalse(app.otherElements["ActivityListView"].exists, "nothing is shared before Share", file: file, line: line) id(app, "settings-report-close").tap() XCTAssertTrue(waitGone(preview), "Close closes the report", file: file, line: line) }/// The account's database fact, where the core says it, stands under About. @MainActor staticfunc assertFactsUnderAbout(_ app: XCUIApplication, file: StaticString = #filePath, line: UInt = #line) {let about = id(app, "settings-about") XCTAssertTrue(about.waitForExistence(timeout: 60), file: file, line: line)let facts = app.descendants(matching: .any).matching(NSPredicate(format: "identifier BEGINSWITH 'settings-about-' AND identifier != 'settings-about-version'"))// The page stands at once; its facts fill in when the read answers. XCTAssertTrue(facts.firstMatch.waitForExistence(timeout: 15), "About holds the account's facts", file: file, line: line)let top = about.frame.minYlet database = app.descendants(matching: .any).matching(NSPredicate(format: "label BEGINSWITH 'Database'")).allElementsBoundByIndexfor said in database { XCTAssertGreaterThanOrEqual(said.frame.minY, top, "the database is said under About only", file: file, line: line) } } @MainActor staticfunc waitGone(_ element: XCUIElement, timeout: TimeInterval = 5) -> Bool {let gone = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: element)return XCTWaiter().wait(for: [gone], timeout: timeout) == .completed }/// The largest accessibility text size, set at launch.staticlet largestText = ["-UIPreferredContentSizeCategoryName", "UICTContentSizeCategoryAccessibilityXXXL"]}