| 1 | # Document window smoke test |
| 2 | |
| 3 | Run `python3 native/scripts/test-document-window.py` from a logged-in macOS |
| 4 | session. It opens a temporary app window and needs permission to become active. |
| 5 | No account, production service, or user document is used: a loopback HTTP server |
| 6 | serves the repository's synthetic letter seed. |
| 7 | |
| 8 | The test exercises the public DocsWorkspace in a SwiftUI document scene. It waits |
| 9 | for the editor to load, opens/closes the inspector eight times through the native |
| 10 | menu, checks the editor gains/loses panel space, resizes the window, and verifies |
| 11 | that the same text view retains its content and selection. |
| 12 | |
| 13 | Regression: Docs 0.1.1 (3) could crash opening its first document on macOS 27. |
| 14 | Restoring the `.inspector` container reproduces SIGTRAP with AppKit's “more Update |
| 15 | Constraints in Window passes than there are views” exception. The docked settings |
| 16 | panel avoids that container. The negative and fixed scene runs were verified on |
| 17 | macOS 27 build 26A5388g; the user report was build 26A428. |
| 18 | |
| 19 | The typing regression now sends native key events and checks the actual |
| 20 | NSTextInsertionIndicator against glyph geometry and document bounds, including |
| 21 | repeated Enter presses. To exercise multiple pages (the short seeds do not): |
| 22 | |
| 23 | ```sh |
| 24 | cargo run --manifest-path native/crdt/Cargo.toml --example caret_fixture -- /tmp/docs-caret.bin |
| 25 | DOCS_SMOKE_UPDATE=/tmp/docs-caret.bin python3 native/scripts/test-document-window.py |
| 26 | ``` |
| 27 | |
| 28 | The generated fixture has 60 independent paragraphs. Optional |
| 29 | `DOCS_SMOKE_SCREENSHOT=/tmp/docs-caret.png` captures the window after typing. |
| 30 | The same executable imports the real window command source through symlinks and |
| 31 | verifies Accounts/Sign out are in the app menu and Accounts reopens closed Home. |
| 32 | |
| 33 | To exercise immediate untitled creation, use `DOCS_SMOKE_DRAFT=1 python3 native/scripts/test-document-window.py`. |
| 34 | The server deliberately waits two seconds. The test types before acknowledgement, |
| 35 | asserts the same text view and content survive attachment, and saves an actively |
| 36 | edited header title without pressing Return. Both modes then test Enter/caret |
| 37 | geometry, inspector resizing, and native account menus. |
| 38 | |
| 39 | `python3 native/scripts/test-document-drafts.py` covers lost creation replies, |
| 40 | retry identity, pending edits and deletes across different document GUIDs, |
| 41 | rename during reconnect, oversized title retention, close-save, and discard. |
| 42 | |