Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

UI Testing

Hone’s UI is rendered natively on each platform. Since there is no browser DOM, UI testing uses platform-specific automation tools.

macOS — geisterhand

geisterhand is the UI automation tool for testing Perry-compiled macOS binaries. It interacts with native windows at the pixel level.

Taking Screenshots

geisterhand screenshot --output /tmp/shot.png

Captures the frontmost window to a PNG file. Use this to verify visual state during tests.

Clicking

geisterhand click 200 350

Sends a mouse click at the specified (x, y) pixel coordinates relative to the screen.

Typical Test Flow

  1. Launch the Perry-compiled binary.
  2. Wait for the window to appear.
  3. Take a screenshot to verify initial state.
  4. Perform interactions (clicks, key presses).
  5. Take another screenshot to verify the result.
# Launch the IDE
./hone-ide &

# Wait for window
sleep 2

# Screenshot the initial state
geisterhand screenshot --output /tmp/initial.png

# Click the file explorer icon in the activity bar
geisterhand click 25 60

# Screenshot after interaction
geisterhand screenshot --output /tmp/after-click.png

iOS Simulator

For iOS Simulator targets, use AppleScript (osascript) to automate interactions. geisterhand does not work with the Simulator.

# Activate the Simulator
osascript -e 'tell application "Simulator" to activate'

For programmatic interaction with the simulated device, use xcrun simctl:

# Boot a simulator
xcrun simctl boot "iPhone 15 Pro"

# Install the app
xcrun simctl install booted Hone.app

# Launch the app
xcrun simctl launch booted codes.hone.ide

# Take a screenshot
xcrun simctl io booted screenshot /tmp/ios-shot.png

Limitations

  • No DOM testing: There is no browser, no document, no querySelector. All UI assertions are visual (screenshot comparison) or coordinate-based.
  • No accessibility tree (yet): Automated assertions currently rely on pixel coordinates and screenshot diffs rather than semantic element queries.
  • Platform-specific: Each platform requires its own automation toolchain. macOS uses geisterhand, iOS uses simctl/osascript, and other platforms have their own tools.