Skip to content

[Bug] Text search and click-by-text match loosely with no exact option, causing false passes in UI tests #143

Open

Description

@gin419

Tool: VMPal (VMPalMachine --cli ui … and the matching MCP tools)
Host: macOS 27.2 (Apple silicon) · Guest: macOS 27.2.1 (26B131), fixed display 1440×900@2x
Date: 2026-11-19

Summary

ui observe --find <text> (and, as far as we can tell, ui click --text <text>, ui wait --text, and the expect/until: {text} step of ui act) match the query loosely against the OCR text. A query for a word that is not on screen matches a different word that is. With no way to ask for an exact (substring) match, a test that checks "is X visible?" can pass when X is absent.

Steps to reproduce

  1. In the guest, put a document on screen whose text is:
    Installer was closed before it finished.
    Open Installer again above
    
    (for example, printf '…' > ~/fz.txt; open -a TextEdit ~/fz.txt).
  2. On the host:
    VMPalMachine --cli ui <VM> observe --find "Installed." --json

Expected

No matches. "Installed." does not occur on the screen.

Actual

Two matches:

x=160 y=90  "Installer was closed before it finished."
x=190 y=102 "Open Installer again above"

--find "Installed" (no period) returns the same two lines. Exact phrases do work: --find "Installer was closed" returns only the first line.

Why it matters

In our test harness, a check like "the card now says Installed." passed while the card actually said "Installer was closed before it finished." In other words, the opposite state. We only found this because a later check in the same scenario contradicted it.

Request

Any of these would do:

  • an --exact (case-insensitive substring) flag for observe --find, click --text, wait --text and act's expect/until;
  • or a match score/kind in the JSON (exact / fuzzy), so a caller can reject fuzzy hits;
  • or documentation of the matching rule, so callers know to verify.

Workaround

We read all text with observe --text --json and do our own case-insensitive substring match. Before matching, we fold only curly quotes, ellipsis, middle dot/bullet and whitespace. We click at the computed position of the matched substring instead of using click --text.

Activity

  1. sonswift commented on Nov 25, 2026

    @sonswift
    Collaborator

    Thanks for reporting this! We’ve noted the issue and will look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions