Skip to content

Commit f61f5a0

Browse files
docs: Add self-healing description
1 parent 3cfa48e commit f61f5a0

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

docs/api/commands/prompt.mdx

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,57 @@ describe('Campaign Management', () => {
382382
})
383383
```
384384

385-
## Viewing and exporting generated code
385+
## See self-healed steps in the Command Log
386386

387-
At any time during or after a test run, you can view the exact Cypress code that `cy.prompt` generated from your natural language steps. This transparency is built into every `cy.prompt` execution.
387+
cy.prompt self-heals when the element it needs to interact with has changed since the last time the step ran.
388+
389+
When `cy.prompt` self-heals a step, Cypress makes that change visible directly in the Command Log so you can understand exactly what changed and which element the step resolved to.
390+
391+
<DocsImage
392+
src="/img/api/prompt/cy-prompt-self-healed-command-log.png"
393+
alt="Self-healed tag in the Command Log for a cy.prompt step"
394+
/>
395+
396+
### Command Log
397+
398+
You can see that a step self-healed in three places:
399+
400+
- **Test** - The test entry shows when at least one `cy.prompt` step self-healed during the run.
401+
- **Prompt** - The `cy.prompt` command is marked when one or more of its steps self-healed.
402+
- **Step** - Individual prompt steps show a **Self-healed** tag when the element they resolved to has changed since the last time that step ran.
403+
404+
<DocsImage
405+
src="/img/api/prompt/cy-prompt-self-healed-prompt-level-logs.png"
406+
alt="Console logs for a self-healed cy.prompt step"
407+
/>
408+
409+
### Console logs
410+
411+
Clicking a `cy.prompt` command or an individual self-healed step prints detailed Console logs in the Developer Tools, including:
412+
413+
- **Resolved element** - The selector and element that this step resolved to after self-healing.
414+
- **Cached elements** - The previously resolved elements that the step checked before self-healing.
415+
- **Self-healed** - Whether the element was self-healed.
416+
417+
If the element was self-healed via cache, the Console logs will show the resolved element within the cached elements. If the element was self-healed via AI, the Console logs will not have the resolved element within the cached elements.
418+
419+
<DocsImage
420+
src="/img/api/prompt/cy-prompt-self-healed-step-level-logs.png"
421+
alt="Console logs for a self-healed cy.prompt step"
422+
/>
423+
424+
This level of detail makes it easy to tell whether a self-heal reflects an intentional product change or an unexpected behavior so you can refine or rewrite the step if necessary.
425+
426+
### Self-healed status definitions
427+
428+
**Self-Healed via Cache** - A selector changed since the last time `cy.prompt` ran and the element resolved to another element using the existing cache entry. In this case, `cy.prompt` did **not** call AI; the cached mapping was able to resolve the new element.
429+
430+
**Self-Healed via AI** - A selector changed since the last time `cy.prompt` ran and the element resolved to another element via an AI call because there was no matching cache entry. The Console logs make it clear that AI was used to find the new element.
431+
432+
433+
## View and export generated code
434+
435+
At any time during or after a test run, you can view the exact Cypress code that `cy.prompt` generated from your natural language steps. Combined with the self-healed tags and Console details in the Command Log, this gives you a clear, auditable record of what happened during `cy.prompt` execution. This transparency is built into every `cy.prompt` execution.
388436

389437
### How to view generated code
390438

114 KB
Loading
39.2 KB
Loading
38.6 KB
Loading

0 commit comments

Comments
 (0)