// Nothing moves at the moment a person acts (DECISIONS, 21 Nov 2026, above// every other rule): ticking ten of today's chores one after another, as// fast as a thumb goes, ticks every one, each struck through where it// stood; ticking them again unticks every one, still where it stood. The// same in Sometime. Invented crowd only, left as it came in.import XCTestfinalclassDaysTickTests: DaysUITestCase {/// The circle's part of a row: the time and the mark on its first line/// (one target to tick), however many lines its words wrap onto. @MainActor privatefunc circle(_ app: XCUIApplication, _ row: DaysUI.Seen) -> XCUICoordinate { app.windows.firstMatch.coordinate(withNormalizedOffset: .zero).withOffset(CGVector(dx: row.frame.minX + 40, dy: row.frame.minY + 22)) }/// Open to-dos standing whole in the list: under Days' own top bar/// (another device's unlock card may stand above it, never touched, and/// rows scrolled past the list's top keep frames up there) and above the/// foot, top to bottom. @MainActor privatefunc standing(_ app: XCUIApplication, _ words: String) -> [DaysUI.Seen] {let all = DaysUI.seen(app)let foot = DaysUI.footTop(app, all)let top = [DaysUI.filter(app), DaysUI.button(app, "More: settings")].filter(\.exists).map(\.frame.maxY).max() ?? 120returnDaysUI.todosOnScreen(app, all).filter { $0.label.contains(words) && $0.frame.minY > top + 4 && $0.frame.maxY < foot - 4 } }/// Ten in a row, a screenful at a time: tick every one standing, scroll on, tick again. @MainActor privatefunc tenInARow(_ app: XCUIApplication, _ words: String, _ what: String) {var ticked = 0var screens = 0while ticked < 10 && screens < 8 { screens += 1let rows = Array(standing(app, words).prefix(10 - ticked)) tickAll(app, rows, reading: "Done", "ticked, \(what)")let done = rows.map { row inDaysUI.Seen(type: row.type, label: DaysUI.words(row.label) + ", Done", frame: row.frame) } tickAll(app, done, reading: "To-do", "unticked, \(what)") ticked += rows.countDaysUI.drag(app, from: CGVector(dx: 0.5, dy: 0.75), by: CGVector(dx: 0, dy: -260)) settle(1.5) } XCTAssertEqual(ticked, 10, "ten ticked and unticked in a row (\(what))") }/// Taps each row's circle in turn, without waiting between, then sees each/// read `now` ("Done" or "To-do") where it stood. @MainActor privatefunc tickAll(_ app: XCUIApplication, _ rows: [DaysUI.Seen], reading now: String, _ what: String) {for row in rows { circle(app, row).tap() } settle(2.5)let seen = DaysUI.seen(app)for row in rows {let words = DaysUI.words(row.label)let copies = seen.filter { $0.type == .button && $0.label.hasPrefix(words + ",") }guardlet nearest = copies.min(by: { abs($0.frame.minY - row.frame.minY) < abs($1.frame.minY - row.frame.minY) }) else { XCTFail("\(words) still stands (\(what))"); continue } XCTAssertTrue(nearest.label.hasSuffix(", " + now), "\(words) reads \(now) (\(what)): \(nearest.label)") XCTAssertEqual(nearest.frame.minY, row.frame.minY, accuracy: 2, "\(words) stands where it stood (\(what))") } }// RULE: ten ticks in a row on today each register, and nothing moves; ten more untick them all, in place. @MainActor func testTenTicksInARowEachRegisterAndNothingMoves() {let app = DaysUI.launch()DaysUI.days(app)DaysUI.drag(app, from: CGVector(dx: 0.5, dy: 0.75), by: CGVector(dx: 0, dy: -300)) settle(1.5) tenInARow(app, "Invented chore", "today") }// RULE: ten ticks in a row in Sometime each register, and each stays in Sometime where it stood, struck through, until Sometime is opened again. @MainActor func testTenTicksInSometimeStayWhereTheyStood() {let app = DaysUI.launch(["-days-open", "sometime"])DaysUI.sometime(app)DaysUI.drag(app, from: CGVector(dx: 0.5, dy: 0.75), by: CGVector(dx: 0, dy: -300)) settle(1.5) tenInARow(app, "Invented", "Sometime") }}