// Your assistant on the side page (CONTRACT.md section 13, 21 Nov 2026), on// invented assistant writing (`notes-assistant-seed.json`, written by Cotton// Dev's developer.inventAssistantWriting): From your assistant opens the// assistant's notes and pages, a page opens the sealed reader with Close and// its title above it, and Memory reads with no way to change it. At the// default text size and the largest. Nothing here is anyone's real writing.import XCTestfinalclassNotesAssistantTests: XCTestCase {overridefunc setUp() { continueAfterFailure = false } @MainActor privatefunc id(_ app: XCUIApplication, _ identifier: String) -> XCUIElement { app.descendants(matching: .any).matching(identifier: identifier).firstMatch }/// The side page, with Your assistant's two lines in reach. @MainActor privatefunc side(_ app: XCUIApplication) {// The list first: on a first launch the invented notes are written before the look opens the side page.let place = id(app, "notes-place") XCTAssertTrue(place.waitForExistence(timeout: 90), "Words came in")let page = id(app, "side-page")if !page.waitForExistence(timeout: 8) { place.tap() } XCTAssertTrue(page.waitForExistence(timeout: 15), "the side page opened: " + String(app.debugDescription.prefix(2500)))let assistant = id(app, "side-assistant") XCTAssertTrue(assistant.waitForExistence(timeout: 30), "From your assistant stands on the side page")for _ in0..<6where !id(app, "side-memory").isHittable { page.swipeUp(velocity: .slow) } XCTAssertTrue(id(app, "side-memory").exists, "Memory stands on the side page") }// RULE: From your assistant holds the assistant's notes and pages; a page opens the reader; Close closes it. @MainActor func testFromYourAssistantOpensTheReader() {let app = NotesUI.launch(["-notes-assistant", "YES", "-notes-open", "side"]) side(app) id(app, "side-assistant").tap()let note = app.descendants(matching: .any).matching(NSPredicate(format: "label CONTAINS %@", "Invented weekly summary")).firstMatch XCTAssertTrue(note.waitForExistence(timeout: 30), "the assistant's note stands in its list") XCTAssertFalse(id(app, "notes-compose").exists, "nothing is written into the assistant's list")let page = app.descendants(matching: .any).matching(NSPredicate(format: "identifier == 'notes-page-row' AND label CONTAINS %@", "Invented garden chart")).firstMatch XCTAssertTrue(page.waitForExistence(timeout: 10), "the assistant's page stands in its list") page.tap()let reader = id(app, "notes-page-reader") XCTAssertTrue(reader.waitForExistence(timeout: 10), "the page opens in the reader")let close = id(app, "page-reader-close") XCTAssertTrue(close.isHittable, "the reader's Close stands above the page") XCTAssertTrue(id(app, "page-reader-web").waitForExistence(timeout: 10) || id(app, "page-reader-missing").exists,"the reader shows the page, or says it is not on this phone yet") close.tap() XCTAssertFalse(reader.waitForExistence(timeout: 2), "Close closes the reader") }// RULE: Notes says, quietly above its rows, where the assistant's writing is, and takes you there. @MainActor func testNotesLeadsToTheAssistantsWriting() {let app = NotesUI.launch(["-notes-assistant", "YES"])let line = id(app, "list-to-assistant") XCTAssertTrue(line.waitForExistence(timeout: 90), "Notes' quiet line to the assistant's writing") line.tap() XCTAssertTrue(id(app, "notes-page-row").waitForExistence(timeout: 30), "it opens From your assistant") }// RULE: Memory reads, grouped, with no way to change it. @MainActor func testMemoryReadsWithoutAnyEdit() {let app = NotesUI.launch(["-notes-assistant", "YES", "-notes-open", "side"]) side(app) id(app, "side-memory").tap()let memory = id(app, "notes-memory") XCTAssertTrue(memory.waitForExistence(timeout: 10), "Memory opens") XCTAssertTrue(id(app, "memory-about").waitForExistence(timeout: 10), "Memory says what it is") XCTAssertTrue(id(app, "memory-entry-me-invented-name").exists, "an entry about you") XCTAssertTrue(id(app, "memory-entry-drusket-sleeps").exists, "a project's entry") XCTAssertEqual(memory.textFields.count + memory.textViews.count + memory.switches.count, 0, "nothing to edit")let buttons = memory.buttons.allElementsBoundByIndex.map(\.identifier) XCTAssertEqual(buttons, ["memory-back"], "Back is Memory's one control") id(app, "memory-back").tap() XCTAssertFalse(memory.waitForExistence(timeout: 2), "Back leaves Memory") }// RULE: at the largest text the side page's lines, the reader's Close and title, and Memory still stand. @MainActor func testYourAssistantAtTheLargestText() {let app = NotesUI.launch(["-notes-assistant", "YES", "-notes-open", "reader"] + NotesUI.largestText)let reader = id(app, "notes-page-reader") XCTAssertTrue(reader.waitForExistence(timeout: 90), "the reader opened")let window = app.windows.firstMatch.framelet close = id(app, "page-reader-close") XCTAssertTrue(close.isHittable && window.contains(close.frame), "Close stands inside the window") close.tap() side(app) id(app, "side-memory").tap() XCTAssertTrue(id(app, "memory-about").waitForExistence(timeout: 10), "Memory opens at the largest text") }}