// Nothing in Days is out of reach at the end of a long list: the last of // today's sixty-odd invented chores and the last to-do in Sometime can be // scrolled to, stand clear of the foot (the switch and the "+"), and open, // upright and at the largest text. Days stays upright when the phone turns, // as every Cotton iPhone app. import XCTest final class DaysReachTests: DaysUITestCase { // RULE: with the adding bar open over Sometime, its last to-do still scrolls clear of the bar (Android 88997d9b3d). @MainActor func testTheLastOfSometimeClearsTheAddingBar() throws { let app = DaysUI.launch(["-days-open", "sometime"]) DaysUI.sometime(app) try skipUnderTheShellsCard(app) DaysUI.button(app, "Add").tap() let field = DaysUI.field(app, "What, and when?") XCTAssertTrue(field.waitForExistence(timeout: 5), "the adding bar opened") _ = DaysUI.keyboard(app) var last = "" for _ in 0..<120 { DaysUI.drag(app, from: CGVector(dx: 0.5, dy: 0.4), by: CGVector(dx: 0, dy: -150)) let now = DaysUI.todosOnScreen(app).last { $0.frame.maxY < field.frame.minY }.map { "\($0.label)@\(Int($0.frame.minY))" } ?? "" if now == last { break } last = now } // At the end: the last row of the list stands wholly above the bar. let rows = DaysUI.todosOnScreen(app) let under = rows.filter { $0.frame.maxY > field.frame.minY - 12 && $0.frame.minY < app.windows.firstMatch.frame.maxY } XCTAssertTrue(under.isEmpty, "no to-do is left under the adding bar at the list's end: \(under.map(\.label))") } // RULE: turning the phone changes nothing: Days stays upright. @MainActor func testTurningThePhoneKeepsDaysUpright() { let app = DaysUI.launch() DaysUI.days(app) let before = app.windows.firstMatch.frame XCUIDevice.shared.orientation = .landscapeLeft settle(1) let after = app.windows.firstMatch.frame XCTAssertGreaterThan(after.height, after.width, "Days stayed upright with the phone turned") XCTAssertEqual(before.size, after.size) } }