Files
MosisService/designer/test
2026-01-16 12:43:06 +01:00
..
2026-01-16 12:43:06 +01:00
2026-01-16 12:43:06 +01:00
2026-01-16 12:43:06 +01:00
2026-01-16 12:43:06 +01:00
2026-01-16 12:43:06 +01:00
2026-01-16 12:43:06 +01:00
2026-01-16 12:43:06 +01:00
2026-01-16 12:43:06 +01:00
2026-01-16 12:43:06 +01:00
2026-01-16 12:43:06 +01:00
2026-01-16 12:43:06 +01:00
2026-01-16 12:43:06 +01:00

Mosis Designer UI Testing with AutoHotkey

Overview

This folder contains AutoHotkey v2 scripts for automated UI testing of the Mosis Designer.

Testing Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Test Runner (run_tests.ahk)              │
│  - Launches designer process                                │
│  - Captures stdout for verification                         │
│  - Runs test scripts sequentially                           │
│  - Generates test report                                    │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                    Test Scripts (test_*.ahk)                │
│  - test_navigation.ahk: Click apps, verify screen change    │
│  - test_back_button.ahk: Navigate and go back               │
│  - test_home_button.ahk: Navigate deep, press home          │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                    Utilities (lib/utils.ahk)                │
│  - FindDesignerWindow(): Get window handle                  │
│  - ClickPhone(x, y): Click at phone coordinates             │
│  - WaitForScreen(name): Wait for navigation log             │
│  - CaptureScreenshot(path): Save window image               │
└─────────────────────────────────────────────────────────────┘

Window Identification

  • Window Title: "Mosis Designer"
  • Window Class: GLFW window class (varies by version)
  • Size: 540x960 client area (phone resolution)

Coordinate System

The phone UI uses a 540x960 coordinate system. AHK needs to:

  1. Find the designer window
  2. Get the client area position
  3. Convert phone coordinates to screen coordinates
Phone Coordinates (0,0 to 540,960)
       │
       ▼
┌──────────────────┐
│  Window Title    │  ← Window decorations
├──────────────────┤
│                  │
│   Phone UI       │  ← Client area (540x960)
│   (0,0)          │
│       ┌──────┐   │
│       │ App  │   │  ← Click target
│       │ Icon │   │
│       └──────┘   │
│                  │
│          (540,960)
└──────────────────┘

App Icon Positions (Home Screen)

Based on the home.rml layout with 4 columns:

Row App Approx X Approx Y
1 Phone 67 100
1 Messages 202 100
1 Contacts 337 100
1 Browser 472 100
2 Gallery 67 200
2 Camera 202 200
2 Settings 337 200
2 Music 472 200

Dock items at bottom (~900 Y):

  • Phone: 67
  • Messages: 202
  • Contacts: 337
  • Browser: 472

Verification Methods

1. Console Output Parsing

The designer outputs navigation events to stdout:

navigateTo called with: dialer
Loaded screen: apps/dialer/dialer.rml
Navigated to: dialer (history depth: 1)
goBack called (history depth: 1)
Back to: home

We can redirect stdout to a file and parse it for verification.

2. Screenshot Comparison

Take screenshots at key points and compare with baselines.

3. Window Title Changes (future)

Could modify designer to include current screen in title.

Test Execution Flow

1. Start designer with stdout redirected to log file
2. Wait for window to appear
3. Wait for "Document loaded successfully" in log
4. Execute test actions (clicks, waits)
5. Parse log for expected navigation events
6. Report pass/fail
7. Close designer

Files

  • lib/utils.ahk - Shared utility functions
  • run_tests.ahk - Main test runner
  • test_navigation.ahk - Navigation test suite
  • test_back_button.ahk - Back button test suite
  • config.ahk - Test configuration (paths, timeouts)

Usage

# Run all tests
& "C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe" run_tests.ahk

# Run specific test
& "C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe" test_navigation.ahk

Requirements

  • AutoHotkey v2 (installed at C:\Program Files\AutoHotkey\v2)
  • Mosis Designer built (designer\build\Debug\mosis-designer.exe)
  • Test assets in place (src\main\assets)