Self-healing

in Japanese(日本語)

When self-healing is enabled and a selector fails to resolve during a device run, fleetest looks for a stand-in element in the following order before failing the scenario:

  1. Primary selector, then your written fallbacks (a||b), as usual.
  2. Locator fingerprint — fleetest remembers the type and label (and the placeholder, for input fields) of the element the step's selector last resolved to directly. If exactly one element on the current screen matches that fingerprint, it is used. This follows the typical change "the id was renamed but the label stayed the same" deterministically. Elements with neither a label nor a placeholder are never remembered (the type alone does not identify an element), and a match with more than one element is never used.

Self-healing is fingerprint matching only — it does not call FM (Foundation Models).

Enabling it

What happens on a repair

Automatic write-back to the source

At the end of the run, the fix suggestions (those with file, line, old and new selector) are written back to your scenario .swift sources automatically. This assumes the project is kept in git: review the changes with git diff and commit them (the tool never commits).

After the existing ⚠️ line, the run output prints the following (to stderr for fleetest api run):

✏️ Self-healing wrote 1 selector fix(es) back to the scenarios — review them with git diff and commit:
   - scenarios/LoginTest.swift:17: "#email_input" → "#email"

Anything that could not be written is listed with its reason; the suggestions stay in the scenario reports:

⚠️ Self-healing could not write 1 selector fix(es) back (the suggestions stay in the scenario reports):
   - scenarios/LoginTest.swift:17: <reason>

To avoid write-back, turn self-healing off (--set heal=false, or heal: false in the run profile).

VSCode extension

When a non-dry-run run ends with fix suggestions, the extension shows a notification with the number of fixed selectors. The execution log lists what was written back and what could not be. The "Show Changes" button opens VSCode's Source Control view; review the git diff and commit.