// Comms' You, grouped (assets/design/chat/you-grouped.html, the owner's // review of 22 Nov 2026; CONTRACT.md "You, grouped"), over Chat Dev's // invented people (-chat-warm-seed YES, an invented Claude connected): the // profile card and the seven rows `chat.you` answers, in order, each saying // how it stands; each row opens its page and Back returns; Sign out on the // profile alone; Your Claude connected offers no Connect; About never says // Rows or Database. At the default text size and the largest. import XCTest final class ChatYouGroupedTests: XCTestCase { override func setUp() { continueAfterFailure = false } private static let largest = ["-UIPreferredContentSizeCategoryName", "UICTContentSizeCategoryAccessibilityXXXL"] private static let rows: [(id: String, name: String)] = [ ("export", "Export"), ("sync", "Sync"), ("claude", "Your Claude"), ("privacy", "Privacy"), ("notifications", "Notifications"), ("storage", "Storage"), ("help", "Help and feedback"), ("about", "About"), ] @MainActor private func launched(_ extra: [String], large: Bool) -> XCUIApplication { let app = XCUIApplication() app.launchArguments += ["-chat-warm-seed", "YES", "-chat-warm-place", "you"] + extra + (large ? Self.largest : []) app.launch() return app } @MainActor private func id(_ app: XCUIApplication, _ identifier: String) -> XCUIElement { app.descendants(matching: .any).matching(identifier: identifier).firstMatch } /// Swipes `inside` up (or down) until `element` can be touched. @MainActor private func reach(_ element: XCUIElement, in app: XCUIApplication, down: Bool = false) { for _ in 0..<14 where !element.isHittable { if down { app.swipeDown(velocity: .slow) } else { app.swipeUp(velocity: .slow) } } } @MainActor private func size(_ large: Bool) -> String { large ? "largest" : "default" } // MARK: the top level @MainActor private func topLevel(large: Bool) { let app = launched([], large: large) let card = id(app, "you-card") XCTAssertTrue(card.waitForExistence(timeout: 30), "the profile card stands: " + String(app.debugDescription.prefix(3000))) XCTAssertTrue(card.label.hasPrefix("Kavi Rao"), "the card says the name others see: \(card.label)") XCTAssertTrue(card.label.contains("+15550100100"), "and the number: \(card.label)") let first = id(app, "you-row-sync") XCTAssertTrue(first.waitForExistence(timeout: 30), "the rows stand") var above = card.frame.maxY for (row, name) in Self.rows { let element = id(app, "you-row-\(row)") XCTAssertTrue(element.exists, "\(name) stands") XCTAssertTrue(element.label.hasPrefix(name + ", "), "\(name) says how it stands: \(element.label)") XCTAssertGreaterThan(element.label.count, name.count + 2, "\(name)'s line is not empty") XCTAssertGreaterThanOrEqual(element.frame.minY, above - 0.5, "\(name) stands in its place, after the one above") above = element.frame.maxY } XCTAssertEqual(id(app, "you-row-claude").label, "Your Claude, Can read any time", "the row says how Claude reads") XCTAssertTrue(id(app, "you-row-storage").label.hasSuffix("on this phone"), id(app, "you-row-storage").label) XCTAssertFalse(id(app, "you-sign-out").exists, "Sign out is not on the top level") XCTAssertTrue(app.buttons["chat-place-you"].exists, "the place switch stands on the top level") keepShot("you-grouped-top-\(size(large))") if large { reach(id(app, "you-row-about"), in: app) keepShot("you-grouped-top-largest-end") } } // RULE: the top level is the profile card, then the seven rows in order, each with how it stands. // RULE: You draws whole on its first frame (owner, build 24: the card came first and the rows a second or two // later). You is opened once, so this phone holds its rows; then a cold launch opens it with the rows' read held // back 6 s (`-settings-held`): the card and the seven rows stand at once, and none moves when the read lands. @MainActor func testYouDrawsWholeAtOnce() { let first = launched([], large: false) XCTAssertTrue(id(first, "you-row-about").waitForExistence(timeout: 60), "You read once") first.terminate() let app = launched(["-settings-held", "6"], large: false) XCTAssertTrue(id(app, "you-card").waitForExistence(timeout: 60), "the card stands") let shown = Date() var frames: [String: CGRect] = [:] for row in Self.rows { let element = id(app, "you-row-\(row.id)") XCTAssertTrue(element.exists, "\(row.name) stands with the card, before the read answers") frames[row.id] = element.frame } XCTAssertLessThan(Date().timeIntervalSince(shown), 5, "every row was seen before the held read could answer") _ = app.buttons["__none__"].waitForExistence(timeout: 7) for (row, frame) in frames { XCTAssertEqual(id(app, "you-row-\(row)").frame, frame, "\(row) stayed where it stood") } } @MainActor func testTheTopLevelIsTheCardAndSevenRows() { topLevel(large: false) } @MainActor func testTheTopLevelAtTheLargestText() { topLevel(large: true) } // MARK: each row opens its page @MainActor private func opensAndReturns(large: Bool) { let app = launched([], large: large) XCTAssertTrue(id(app, "you-row-about").waitForExistence(timeout: 30)) let pages = [("profile", "you-card")] + Self.rows.map { ($0.id, "you-row-\($0.id)") } for (page, opener) in pages { let row = id(app, opener) reach(row, in: app, down: page == "profile") XCTAssertTrue(row.isHittable, "\(page)'s row can be touched") row.tap() let shown = id(app, "you-\(page)-page") XCTAssertTrue(shown.waitForExistence(timeout: 10), "\(page) opens its page") XCTAssertFalse(app.buttons["chat-place-you"].exists, "\(page): a page has Back, no place switch under it") let back = id(app, "you-\(page)-page-back") XCTAssertTrue(back.waitForExistence(timeout: 5) && back.isHittable, "\(page) has Back") keepShot("you-grouped-\(page)-\(size(large))") back.tap() XCTAssertTrue(row.waitForExistence(timeout: 10), "Back returns to You from \(page)") XCTAssertFalse(shown.exists, "\(page) has gone") } } // RULE: the card and each of the seven rows open their own page, and Back returns to You. @MainActor func testEachRowOpensItsPageAndBackReturns() { opensAndReturns(large: false) } @MainActor func testEachRowOpensItsPageAtTheLargestText() { opensAndReturns(large: true) } // MARK: Profile @MainActor private func signOutOnProfile(large: Bool) { let app = launched(["-chat-warm-you", "profile"], large: large) let name = app.textFields["you-name"] XCTAssertTrue(name.waitForExistence(timeout: 30), "the name field stands on Profile") let named = XCTNSPredicateExpectation(predicate: NSPredicate(format: "value == 'Kavi Rao'"), object: name) XCTAssertEqual(XCTWaiter.wait(for: [named], timeout: 10), .completed, "the name others see: \(name.value ?? "none")") XCTAssertTrue(id(app, "you-picture").exists, "Change picture") XCTAssertTrue(app.staticTexts["+15550100100"].exists, "the number") XCTAssertFalse(app.switches["you-findable"].exists, "no findable switch (DISCOVERY OFF 1)") let out = id(app, "you-sign-out") XCTAssertTrue(out.waitForExistence(timeout: 15), "Sign out stands on Profile") reach(out, in: app) XCTAssertTrue(out.isHittable, "Sign out can be touched") let line = id(app, "you-sign-out-line") XCTAssertTrue(line.exists && line.label == "To come back you'll need your number and a code.", "its line: \(line.label)") XCTAssertGreaterThan(line.frame.minY, out.frame.minY, "the line under Sign out") keepShot("you-grouped-profile-foot-\(size(large))") // Nowhere else: not on Sync, where it stood before. id(app, "you-profile-page-back").tap() let sync = id(app, "you-row-sync") XCTAssertTrue(sync.waitForExistence(timeout: 10)) sync.tap() XCTAssertTrue(id(app, "you-sync-now").waitForExistence(timeout: 10), "Sync now on Sync") XCTAssertFalse(id(app, "you-sign-out").exists, "Sign out is not on Sync") } // RULE: Sign out stands at the foot of Profile with its line, and nowhere else. @MainActor func testSignOutIsOnProfile() { signOutOnProfile(large: false) } @MainActor func testSignOutIsOnProfileAtTheLargestText() { signOutOnProfile(large: true) } // MARK: Sync @MainActor private func syncPage(large: Bool) { let app = launched(["-chat-warm-you", "sync", "-chat-warm-unreachable", "YES"], large: large) let state = id(app, "you-sync-state") XCTAssertTrue(state.waitForExistence(timeout: 30)) XCTAssertEqual(state.label, "3 changes waiting to sync") XCTAssertEqual(id(app, "you-sync-last").label, "Last synced at 9:53") XCTAssertTrue(id(app, "you-sync-unreachable").exists, "the out-of-reach line") XCTAssertTrue(id(app, "you-sync-now").exists, "Sync now") XCTAssertEqual(app.descendants(matching: .any).matching(NSPredicate(format: "label CONTAINS[c] 'full copy' OR label CONTAINS[c] 'back up'")).count, 0, "no full copy, no Back up") keepShot("you-grouped-sync-unreachable-\(size(large))") } // RULE: Sync is the state, the waiting count, the out-of-reach line and Sync now; no full copy. @MainActor func testSyncSaysHowItStands() { syncPage(large: false) } @MainActor func testSyncAtTheLargestText() { syncPage(large: true) } // MARK: Your Claude @MainActor private func claude(large: Bool, timed: Bool) { let app = launched(["-chat-warm-you", "claude"] + (timed ? ["-chat-warm-claude", "timed"] : []), large: large) let connected = id(app, "you-claude-connected") XCTAssertTrue(connected.waitForExistence(timeout: 30), "connected, it says so: " + String(app.debugDescription.prefix(3000))) XCTAssertFalse(id(app, "you-claude-connect").exists, "no Connect while connected") let title = id(app, "you-claude-state-title") XCTAssertEqual(title.label, timed ? "Claude can read until 10:30" : "Claude can read any time") XCTAssertTrue(id(app, timed ? "you-claude-act-stop" : "you-claude-act-ask_all").exists, timed ? "Stop now" : "Ask each time instead") var above = title.frame.maxY for group in ["chats", "mail", "photos", "calls", "recordings", "contacts", "files"] { let row = id(app, "you-claude-group-\(group)") XCTAssertTrue(row.exists, "\(group) stands") XCTAssertGreaterThan(row.frame.minY, above, "\(group) in the kit's order") above = row.frame.minY for access in ["on", "ask", "off"] { XCTAssertTrue(id(app, "you-claude-\(group)-\(access)").exists, "\(group) offers \(access)") } } XCTAssertEqual(app.descendants(matching: .any).matching(NSPredicate(format: "identifier BEGINSWITH 'account-your-claude-table-'")).count, 0, "no table list") let disconnect = id(app, "you-claude-disconnect") XCTAssertTrue(disconnect.exists, "Disconnect at the foot") XCTAssertGreaterThan(disconnect.frame.minY, above, "after the groups") keepShot("you-grouped-claude-\(timed ? "timed" : "standing")-\(size(large))") reach(disconnect, in: app) XCTAssertTrue(disconnect.isHittable) keepShot("you-grouped-claude-\(timed ? "timed" : "standing")-\(size(large))-foot") } // RULE: Your Claude connected says so and offers no Connect; standing it offers Ask each time instead; six groups. @MainActor func testYourClaudeShowsNoConnectWhenConnected() { claude(large: false, timed: false) } @MainActor func testYourClaudeAtTheLargestText() { claude(large: true, timed: false) } // RULE: for a while, it says until when and offers Stop now; the top row says so too. @MainActor func testYourClaudeForAWhile() { claude(large: false, timed: true) let app = launched(["-chat-warm-claude", "timed"], large: false) let row = id(app, "you-row-claude") XCTAssertTrue(row.waitForExistence(timeout: 30)) XCTAssertEqual(row.label, "Your Claude, Can read until 10:30") } @MainActor func testYourClaudeForAWhileAtTheLargestText() { claude(large: true, timed: true) } // MARK: Privacy, Notifications, Storage, Help @MainActor private func pages(large: Bool) { var app = launched(["-chat-warm-you", "privacy"], large: large) let blocked = id(app, "you-blocked") XCTAssertTrue(blocked.waitForExistence(timeout: 30)) XCTAssertTrue(blocked.label.contains("1"), "Blocked people with a count: \(blocked.label)") XCTAssertTrue(id(app, "you-safety-line").exists, "the safety-number words") XCTAssertTrue(id(app, "you-last-seen").exists, "never last seen") XCTAssertEqual(app.descendants(matching: .any).matching(NSPredicate(format: "label CONTAINS[c] 'new chats'")).count, 0, "no default timer for new chats") let toClaude = id(app, "you-privacy-claude") reach(toClaude, in: app) keepShot("you-grouped-privacy-foot-\(size(large))") toClaude.tap() XCTAssertTrue(id(app, "you-claude-page").waitForExistence(timeout: 10), "Privacy leads to Your Claude") id(app, "you-claude-page-back").tap() XCTAssertTrue(id(app, "you-privacy-page").waitForExistence(timeout: 10), "Back from there returns to Privacy") app.terminate() app = launched(["-chat-warm-you", "notifications"], large: large) XCTAssertTrue(id(app, "you-notifications-phone").waitForExistence(timeout: 30), "the phone's own settings") XCTAssertTrue(id(app, "you-muted-none").exists || app.descendants(matching: .any).matching(NSPredicate(format: "identifier BEGINSWITH 'you-muted-'")).count > 0, "the muted chats") app.terminate() app = launched(["-chat-warm-you", "storage"], large: large) XCTAssertTrue(id(app, "you-storage-total").waitForExistence(timeout: 30), "the whole, measured") // The shared measured parts; Downloads stands only in an app that keeps downloads (c8dd6239db), so not in Comms. for part in ["data", "files", "other"] { XCTAssertTrue(id(app, "settings-storage-\(part)").exists, "Storage says \(part)") } let free = id(app, "settings-free-up") reach(free, in: app) XCTAssertTrue(free.exists, "Free up space") keepShot("you-grouped-storage-foot-\(size(large))") app.terminate() app = launched(["-chat-warm-you", "help"], large: large) XCTAssertTrue(id(app, "settings-share-report").waitForExistence(timeout: 30), "Share a report") let write = id(app, "you-write-us") reach(write, in: app) XCTAssertTrue(write.isHittable, "Write to us") // Then the privacy policy and Help and contact (store pass, 24 Nov 2026). let privacy = id(app, "settings-link-privacy"), support = id(app, "settings-link-support") reach(support, in: app) XCTAssertTrue(privacy.exists && support.exists, "Privacy policy and Help and contact") XCTAssertLessThan(write.frame.minY, privacy.frame.minY) XCTAssertLessThan(privacy.frame.minY, support.frame.minY) SettingsPartsUI.assertReportShownFirst(app) } // RULE: Privacy, Notifications, Storage and Help hold what the drawing draws that the core can do. @MainActor func testThePagesHoldWhatTheCoreAnswers() { pages(large: false) } @MainActor func testThePagesAtTheLargestText() { pages(large: true) } // MARK: About @MainActor private func about(large: Bool) { let app = launched(["-chat-warm-you", "about"], large: large) let version = id(app, "settings-about-version") XCTAssertTrue(version.waitForExistence(timeout: 30), "About says the version") XCTAssertTrue(id(app, "you-about-copy").waitForExistence(timeout: 10), "Copy these details") let banned = app.descendants(matching: .any).matching(NSPredicate(format: "label CONTAINS 'Rows' OR label CONTAINS 'rows' OR label CONTAINS 'Database' OR label CONTAINS 'database'")) XCTAssertEqual(banned.count, 0, "About never says Rows or Database: " + banned.allElementsBoundByIndex.map(\.label).joined(separator: " | ")) let items = id(app, "settings-about-here") if items.exists { XCTAssertTrue(items.label.hasPrefix("Items on this phone"), items.label) } let account = id(app, "settings-about-database") if account.exists { XCTAssertTrue(account.label.hasPrefix("Account"), account.label) } keepShot("you-grouped-about-\(size(large))") } // RULE: About says the version and the account's facts for the curious, never Rows or Database. @MainActor func testAboutNeverSaysRowsOrDatabase() { about(large: false) } @MainActor func testAboutAtTheLargestText() { about(large: true) } }