{
  "doc": {
    "id": "app/guides/ai-test-generation",
    "title": "AI Test Generation",
    "description": "Write Cypress E2E tests in natural language with cy.prompt. Generate tests from plain steps, get self-healing selectors, export the generated code, and reduce end-to-end test maintenance.",
    "section": "app",
    "source_path": "/llm/markdown/app/guides/ai-test-generation.md",
    "version": "3b85801b725bd02bf0cb58cedaf42944712cdc72",
    "updated_at": "2026-07-12T03:11:07.806Z",
    "headings": [
      {
        "id": "app/guides/ai-test-generation#ai-test-generation",
        "text": "AI Test Generation",
        "level": 1
      },
      {
        "id": "app/guides/ai-test-generation#why-use-cy-prompt",
        "text": "Why use cy.prompt?",
        "level": 2
      },
      {
        "id": "app/guides/ai-test-generation#get-started",
        "text": "Get started",
        "level": 2
      },
      {
        "id": "app/guides/ai-test-generation#how-it-works",
        "text": "How it works",
        "level": 2
      },
      {
        "id": "app/guides/ai-test-generation#choose-your-workflow",
        "text": "Choose your workflow",
        "level": 2
      },
      {
        "id": "app/guides/ai-test-generation#workflow-1-generate-once-commit-to-source-control",
        "text": "Workflow 1: Generate once, commit to source control",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#why-choose-this-workflow",
        "text": "Why choose this workflow?",
        "level": 4
      },
      {
        "id": "app/guides/ai-test-generation#example",
        "text": "Example",
        "level": 4
      },
      {
        "id": "app/guides/ai-test-generation#workflow-2-continuous-self-healing",
        "text": "Workflow 2: Continuous self-healing",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#why-choose-this-workflow",
        "text": "Why choose this workflow?",
        "level": 4
      },
      {
        "id": "app/guides/ai-test-generation#example",
        "text": "Example",
        "level": 4
      },
      {
        "id": "app/guides/ai-test-generation#write-effective-prompts",
        "text": "Write effective prompts",
        "level": 2
      },
      {
        "id": "app/guides/ai-test-generation#targeting-elements-by-text-content",
        "text": "Targeting elements by text content",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#example-good-vs-poor-steps",
        "text": "Example: Good vs. poor steps",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#if-cypress-cannot-interpret-a-step",
        "text": "If Cypress cannot interpret a step",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#self-healing",
        "text": "Self-healing",
        "level": 2
      },
      {
        "id": "app/guides/ai-test-generation#how-often-should-self-healing-happen",
        "text": "How often should self-healing happen?",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#keep-self-healing-from-firing-every-run",
        "text": "Keep self-healing from firing every run",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#see-what-self-healed",
        "text": "See what self-healed",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#console-logs",
        "text": "Console logs",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#self-healed-status-definitions",
        "text": "Self-healed status definitions",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#placeholders",
        "text": "Placeholders",
        "level": 2
      },
      {
        "id": "app/guides/ai-test-generation#the-caching-problem",
        "text": "The caching problem",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#the-placeholder-solution",
        "text": "The placeholder solution",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#example-usage",
        "text": "Example usage",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#sensitive-data-handling",
        "text": "Sensitive data handling",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#sensitive-data-in-the-dom",
        "text": "Sensitive data in the DOM",
        "level": 4
      },
      {
        "id": "app/guides/ai-test-generation#sensitive-data-from-the-prompt",
        "text": "Sensitive data from the prompt",
        "level": 4
      },
      {
        "id": "app/guides/ai-test-generation#view-and-export-generated-code",
        "text": "View and export generated code",
        "level": 2
      },
      {
        "id": "app/guides/ai-test-generation#how-to-view-generated-code",
        "text": "How to view generated code",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#what-you-can-do-with-the-generated-code",
        "text": "What you can do with the generated code",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#customizing-selectors-in-generated-code",
        "text": "Customizing selectors in generated code",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#download-a-prompt-report-for-a-run",
        "text": "Download a prompt report for a run",
        "level": 3
      },
      {
        "id": "app/guides/ai-test-generation#pricing-and-usage-limits",
        "text": "Pricing and usage limits",
        "level": 2
      },
      {
        "id": "app/guides/ai-test-generation#privacy-and-security",
        "text": "Privacy and security",
        "level": 2
      },
      {
        "id": "app/guides/ai-test-generation#disabling-ai-features",
        "text": "Disabling AI features",
        "level": 2
      },
      {
        "id": "app/guides/ai-test-generation#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "app/guides/ai-test-generation#why-use-cy-prompt",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Why use cy.prompt?",
      "heading_level": 2,
      "content_markdown": "## Why use cy.prompt?\n\n*   **Write tests faster**: Turn natural language test ideas into runnable Cypress commands without hand-writing every selector and assertion.\n*   **Spend less time on maintenance**: Self-healing selectors absorb many routine UI changes, so minor markup edits don't send you back to update tests.\n*   **Lower the barrier to contributing**: Product owners, QA, and developers can all describe steps in natural language that become real tests.\n*   **Stay in control**: Every step maps to standard Cypress commands you can view, export, and commit, with no black box.\n",
      "section": "app",
      "anchors": [
        "why-use-cy-prompt"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 120
    },
    {
      "id": "app/guides/ai-test-generation#get-started",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Get started",
      "heading_level": 2,
      "content_markdown": "## Get started\n\n`cy.prompt` uses AI under the hood, so it needs a secure connection to Cypress Cloud to interpret your prompts. Cypress Cloud manages those requests, applies organization-level controls, and tracks usage. We never use your prompts to train AI models, and you can turn AI features off at any time. `cy.prompt` is available on every [Cypress Cloud plan type](https://www.cypress.io/pricing).\n\n**To use `cy.prompt`, you must either:**\n\n*   Log into Cypress Cloud, or\n*   Run with `--record` and a valid `--key`. See the [setup instructions](/llm/markdown/cloud/get-started/setup.md).\n\nDon't have a Cloud account? Create a free one to start a 30-day trial of all paid features.\n\n[Sign up ➜](https://cloud.cypress.io/signup) [See a demo](https://www.youtube.com/watch?v=vFLShoCM8pA) [Explore an example project](https://cloud.cypress.io/projects/7s5okt)\n\nOnce you're connected, add a `cy.prompt` call to an E2E test and run it:\n\n```\ncy.prompt([  'visit /products',  'search for \"laptop\" in the search field',  'click the \"Dell XPS 13\" product in the results',  'click the \"Add to Cart\" button',  'verify the cart shows 1 item',])\n```\n\nWhen the test runs, `cy.prompt` interprets each step, generates the Cypress commands, and executes them. Click the **Code** button in the Command Log to see exactly what it generated.\n",
      "section": "app",
      "anchors": [
        "get-started"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 252
    },
    {
      "id": "app/guides/ai-test-generation#how-it-works",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "How it works",
      "heading_level": 2,
      "content_markdown": "## How it works\n\nWhen you call `cy.prompt`, Cypress performs a multi-step process:\n\n1.  **Interpret prompt:** Each string in your `steps[]` array is parsed using an AI model. Cypress maps the intent (e.g. 'click the login button') to Cypress commands (`cy.get(...).click()`) and target elements.\n    \n2.  **Generate selectors:** Cypress evaluates your app's DOM and picks a selector based on priority rules (unique identifiers that are likely to be stable).\n    \n3.  **Generate Cypress code:** Commands are generated and executed in sequence. The Command Log shows both your natural language step and the commands Cypress ran. You can view the complete generated code at any time using the **Code** button in the Command Log.\n    \n4.  **Cache for speed:** Generated code is cached and shared across machines and environments, including CI. Re-running the same test does not re-call the AI model unless the prompt or DOM changes in a way that invalidates the cached code. This means that once a prompt is cached, it benefits all team members and CI runs without an additional performance hit.\n    \n5.  **Self-heal if needed:** If cached selectors fail (an element was renamed, attributes changed, and so on), Cypress regenerates code for that step automatically on the next run. See [Self-healing](#Self-healing).\n    \n\nFrom there, you decide how `cy.prompt` fits into your project: export the generated code and commit it, or keep `cy.prompt` running so it continues to self-heal. The next section walks through both.\n",
      "section": "app",
      "anchors": [
        "how-it-works"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 312
    },
    {
      "id": "app/guides/ai-test-generation#choose-your-workflow",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Choose your workflow",
      "heading_level": 2,
      "content_markdown": "## Choose your workflow\n\n`cy.prompt` supports two workflows. Both give you full visibility into the generated code, so you can always inspect and modify the results. The difference is whether you commit that code or let `cy.prompt` keep running.\n\n### Workflow 1: Generate once, commit to source control\n\nUse `cy.prompt` to generate tests, then export and commit the code.\n\n#### Why choose this workflow?\n\n*   **Predictable execution** - You know exactly what code runs every time\n*   **Fast test generation** - Use AI to quickly create test skeletons\n*   **No AI dependency** - Tests run without calling the AI service\n*   **PR review friendly** - Generated code fits into existing review processes\n*   **Stable selectors** - Your app has stable, predictable elements\n\n#### Example\n\n```\n// Generate the testcy.prompt(  [    'visit https://cloud.cypress.io/login',    'type \"user@example.com\" in the email field',    'type {{password}} in the password field',    'click the login button',    'verify we are redirected to the dashboard',  ],  {    placeholders: { password: 'secret123' },  })\n```\n\nAfter the test runs, click the **Code** button in the Command Log to view the generated Cypress code, then [save it to your test file](#View-and-export-generated-code). This workflow lets you use AI to quickly generate test code, then commit the exact generated code to your repository for predictable, version-controlled tests.\n\n### Workflow 2: Continuous self-healing\n\nKeep `cy.prompt` in your tests and let it self-heal and adapt to changes.\n\n#### Why choose this workflow?\n\n*   **Self-healing selectors** - Tests adapt when your app changes\n*   **Less maintenance** - No need to update tests for every UI change\n*   **Dynamic content friendly** - Works well with changing data or structure\n*   **Smart regeneration** - AI handles selector failures automatically\n*   **Rapid iteration** - Perfect for apps in active development\n\n#### Example\n\n```\n// Let cy.prompt run on every test executioncy.prompt([  'visit the product catalog',  'filter by category \"Electronics\"',  'sort by price high to low',  'verify the product count is 25',])\n```\n\nBecause your app may change between runs, `cy.prompt` regenerates broken selectors automatically. To keep self-healing working for you instead of firing on every run, see [Self-healing](#Self-healing). You can still inspect the generated code at any time, see [View and export generated code](#View-and-export-generated-code).\n",
      "section": "app",
      "anchors": [
        "choose-your-workflow"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 485
    },
    {
      "id": "app/guides/ai-test-generation#workflow-1-generate-once-commit-to-source-control",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Workflow 1: Generate once, commit to source control",
      "heading_level": 3,
      "content_markdown": "### Workflow 1: Generate once, commit to source control\n\nUse `cy.prompt` to generate tests, then export and commit the code.\n\n#### Why choose this workflow?\n\n*   **Predictable execution** - You know exactly what code runs every time\n*   **Fast test generation** - Use AI to quickly create test skeletons\n*   **No AI dependency** - Tests run without calling the AI service\n*   **PR review friendly** - Generated code fits into existing review processes\n*   **Stable selectors** - Your app has stable, predictable elements\n\n#### Example\n\n```\n// Generate the testcy.prompt(  [    'visit https://cloud.cypress.io/login',    'type \"user@example.com\" in the email field',    'type {{password}} in the password field',    'click the login button',    'verify we are redirected to the dashboard',  ],  {    placeholders: { password: 'secret123' },  })\n```\n\nAfter the test runs, click the **Code** button in the Command Log to view the generated Cypress code, then [save it to your test file](#View-and-export-generated-code). This workflow lets you use AI to quickly generate test code, then commit the exact generated code to your repository for predictable, version-controlled tests.\n",
      "section": "app",
      "anchors": [
        "workflow-1-generate-once-commit-to-source-control"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 232
    },
    {
      "id": "app/guides/ai-test-generation#why-choose-this-workflow",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Why choose this workflow?",
      "heading_level": 4,
      "content_markdown": "#### Why choose this workflow?\n\n*   **Predictable execution** - You know exactly what code runs every time\n*   **Fast test generation** - Use AI to quickly create test skeletons\n*   **No AI dependency** - Tests run without calling the AI service\n*   **PR review friendly** - Generated code fits into existing review processes\n*   **Stable selectors** - Your app has stable, predictable elements\n",
      "section": "app",
      "anchors": [
        "why-choose-this-workflow"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 84
    },
    {
      "id": "app/guides/ai-test-generation#example",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Example",
      "heading_level": 4,
      "content_markdown": "#### Example\n\n```\n// Generate the testcy.prompt(  [    'visit https://cloud.cypress.io/login',    'type \"user@example.com\" in the email field',    'type {{password}} in the password field',    'click the login button',    'verify we are redirected to the dashboard',  ],  {    placeholders: { password: 'secret123' },  })\n```\n\nAfter the test runs, click the **Code** button in the Command Log to view the generated Cypress code, then [save it to your test file](#View-and-export-generated-code). This workflow lets you use AI to quickly generate test code, then commit the exact generated code to your repository for predictable, version-controlled tests.\n",
      "section": "app",
      "anchors": [
        "example"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 121
    },
    {
      "id": "app/guides/ai-test-generation#workflow-2-continuous-self-healing",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Workflow 2: Continuous self-healing",
      "heading_level": 3,
      "content_markdown": "### Workflow 2: Continuous self-healing\n\nKeep `cy.prompt` in your tests and let it self-heal and adapt to changes.\n\n#### Why choose this workflow?\n\n*   **Self-healing selectors** - Tests adapt when your app changes\n*   **Less maintenance** - No need to update tests for every UI change\n*   **Dynamic content friendly** - Works well with changing data or structure\n*   **Smart regeneration** - AI handles selector failures automatically\n*   **Rapid iteration** - Perfect for apps in active development\n\n#### Example\n\n```\n// Let cy.prompt run on every test executioncy.prompt([  'visit the product catalog',  'filter by category \"Electronics\"',  'sort by price high to low',  'verify the product count is 25',])\n```\n\nBecause your app may change between runs, `cy.prompt` regenerates broken selectors automatically. To keep self-healing working for you instead of firing on every run, see [Self-healing](#Self-healing). You can still inspect the generated code at any time, see [View and export generated code](#View-and-export-generated-code).\n",
      "section": "app",
      "anchors": [
        "workflow-2-continuous-self-healing"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 201
    },
    {
      "id": "app/guides/ai-test-generation#why-choose-this-workflow",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Why choose this workflow?",
      "heading_level": 4,
      "content_markdown": "#### Why choose this workflow?\n\n*   **Self-healing selectors** - Tests adapt when your app changes\n*   **Less maintenance** - No need to update tests for every UI change\n*   **Dynamic content friendly** - Works well with changing data or structure\n*   **Smart regeneration** - AI handles selector failures automatically\n*   **Rapid iteration** - Perfect for apps in active development\n",
      "section": "app",
      "anchors": [
        "why-choose-this-workflow"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 79
    },
    {
      "id": "app/guides/ai-test-generation#example",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Example",
      "heading_level": 4,
      "content_markdown": "#### Example\n\n```\n// Let cy.prompt run on every test executioncy.prompt([  'visit the product catalog',  'filter by category \"Electronics\"',  'sort by price high to low',  'verify the product count is 25',])\n```\n\nBecause your app may change between runs, `cy.prompt` regenerates broken selectors automatically. To keep self-healing working for you instead of firing on every run, see [Self-healing](#Self-healing). You can still inspect the generated code at any time, see [View and export generated code](#View-and-export-generated-code).\n",
      "section": "app",
      "anchors": [
        "example"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 99
    },
    {
      "id": "app/guides/ai-test-generation#write-effective-prompts",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Write effective prompts",
      "heading_level": 2,
      "content_markdown": "## Write effective prompts\n\n**Language Support:** `cy.prompt` is optimized for English prompts and provides the most reliable results when prompts are written in English. We cannot guarantee accuracy or provide support for non-English prompts.\n\nPrompt clarity determines reliability. Follow these rules:\n\n*   **Imperative voice**: Start with an action (click, type, verify).\n*   **Use absolute URLs**: Use the full URL of the page you want to visit.\n*   **One action per step**: Avoid chaining multiple actions in one string.\n*   **Avoid ambiguity**: Specify the action or element explicitly.\n*   **Include positional context**: `click the login button in the header` is better than `click login button`.\n*   **Specify Cypress options**: Some Cypress command options can be specified directly in your prompts using natural language. Force and timeout are the only options that are currently supported. For example: `'go to \"/users\" with a timeout of 10 seconds'` or `'force click the submit button'`.\n\n### Targeting elements by text content\n\nWhen an element is best identified by its visible text, you have two ways to target it. Choosing the right one depends on what is more stable in your application: the element's selector, or its content.\n\n**Quoted text** resolves to `cy.contains(text)` and uses the text as the primary identifier. Use this when:\n\n*   The selector is variable or unstable, and the visible content is what matters.\n*   You are testing that specific text appears and is interactive, for example verifying a localized label or a dynamically generated button label is correct and clickable.\n*   You want the test to fail if the content changes, because the content itself is what you are asserting on.\n\n**Unquoted descriptions** resolve to `cy.get(selector)`, where Cypress identifies the element by its structural role in the DOM. Use this when the selector is stable and the content may change, for example a submit button whose label varies by locale.\n\n```\n'click the login button''press the submit button in the form'\n```\n\n### Example: Good vs. poor steps\n\n```\n// ✅ Good - clear and descriptivecy.prompt([  'visit https://cloud.cypress.io/users/settings',  'click the \"Edit Profile\" button in the profile section',  'type \"John Doe\" in the name field',  'type \"john.doe@example.com\" in the email field',  'click the \"Save Changes\" button',  'verify the success message \"Profile updated successfully\" appears',])// ❌ Poor - vague and error-pronecy.prompt([  'go to profile',  'click button',  'type name',  'type email',  'save',  'check success',])\n```\n\n### If Cypress cannot interpret a step\n\nIf Cypress cannot interpret a step, you'll see a dialog prompting you to refine your prompt. Fill out each step that needs information with a more specific prompt and click **Save** to update the `cy.prompt` code within your test file. The test will then run with the new prompt.\n",
      "section": "app",
      "anchors": [
        "write-effective-prompts"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 596
    },
    {
      "id": "app/guides/ai-test-generation#targeting-elements-by-text-content",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Targeting elements by text content",
      "heading_level": 3,
      "content_markdown": "### Targeting elements by text content\n\nWhen an element is best identified by its visible text, you have two ways to target it. Choosing the right one depends on what is more stable in your application: the element's selector, or its content.\n\n**Quoted text** resolves to `cy.contains(text)` and uses the text as the primary identifier. Use this when:\n\n*   The selector is variable or unstable, and the visible content is what matters.\n*   You are testing that specific text appears and is interactive, for example verifying a localized label or a dynamically generated button label is correct and clickable.\n*   You want the test to fail if the content changes, because the content itself is what you are asserting on.\n\n**Unquoted descriptions** resolve to `cy.get(selector)`, where Cypress identifies the element by its structural role in the DOM. Use this when the selector is stable and the content may change, for example a submit button whose label varies by locale.\n\n```\n'click the login button''press the submit button in the form'\n```\n",
      "section": "app",
      "anchors": [
        "targeting-elements-by-text-content"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 228
    },
    {
      "id": "app/guides/ai-test-generation#example-good-vs-poor-steps",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Example: Good vs. poor steps",
      "heading_level": 3,
      "content_markdown": "### Example: Good vs. poor steps\n\n```\n// ✅ Good - clear and descriptivecy.prompt([  'visit https://cloud.cypress.io/users/settings',  'click the \"Edit Profile\" button in the profile section',  'type \"John Doe\" in the name field',  'type \"john.doe@example.com\" in the email field',  'click the \"Save Changes\" button',  'verify the success message \"Profile updated successfully\" appears',])// ❌ Poor - vague and error-pronecy.prompt([  'go to profile',  'click button',  'type name',  'type email',  'save',  'check success',])\n```\n",
      "section": "app",
      "anchors": [
        "example-good-vs-poor-steps"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 93
    },
    {
      "id": "app/guides/ai-test-generation#if-cypress-cannot-interpret-a-step",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "If Cypress cannot interpret a step",
      "heading_level": 3,
      "content_markdown": "### If Cypress cannot interpret a step\n\nIf Cypress cannot interpret a step, you'll see a dialog prompting you to refine your prompt. Fill out each step that needs information with a more specific prompt and click **Save** to update the `cy.prompt` code within your test file. The test will then run with the new prompt.\n",
      "section": "app",
      "anchors": [
        "if-cypress-cannot-interpret-a-step"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 75
    },
    {
      "id": "app/guides/ai-test-generation#self-healing",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Self-healing",
      "heading_level": 2,
      "content_markdown": "## Self-healing\n\n`cy.prompt` self-heals a step when the element it needs has changed since the step last ran, so your tests keep passing as the UI evolves. When that happens, Cypress surfaces the change directly in the Command Log so you can see exactly what changed and which element the step resolved to.\n\n### How often should self-healing happen?\n\n`cy.prompt` self-heals when a **selector or its text content** changes between runs. Self-healing works best when it catches occasional, unexpected changes, **not when it fires on every run**.\n\nIf you use `cy.prompt` to target an element whose selector changes frequently (like dynamically generated selectors), `cy.prompt` will attempt to self-heal on every run. This increases AI calls, slows test execution, and reduces the cache benefit that makes `cy.prompt` fast in CI. This is not what you want.\n\n### Keep self-healing from firing every run\n\nTo keep a step from self-healing on every run, point it at something stable:\n\n*   **Target by visible text** with [text-based targeting](#Targeting-elements-by-text-content) when the content is more stable than the selector.\n*   **Use [placeholders](#Placeholders)** to supply a dynamic value at runtime instead of baking it into the step.\n*   **Configure the [ElementSelector API](/llm/markdown/api/cypress-api/element-selector-api.md)** to prioritize a more stable attribute or selector.\n\nThe right strategy is the one that matches what is actually stable in your application.\n\n### See what self-healed\n\nYou can see that a step self-healed in several places.\n\nIn the Command Log:\n\n*   **Test** - The test entry shows when at least one `cy.prompt` step self-healed during the run.\n*   **Prompt** - The `cy.prompt` command is marked when one or more of its steps self-healed.\n*   **Step** - Individual prompt steps show a **Self-healed** tag when the element they resolved to has changed since the last time that step ran.\n\nIn [Cypress Cloud](https://cloud.cypress.io):\n\n*   **Runs list** - A run that includes self-healed tests is flagged in the runs list.\n*   **Run overview** - Filter the tests in a run by those that self-healed.\n*   **Run properties** - See how many prompt definitions ran and how many self-healed in the run.\n*   **Test Replay** - Review the self-heal directly in the [Test Replay](/llm/markdown/cloud/features/test-replay.md) of the test.\n\n### Console logs\n\nIn the Cypress App or in [Test Replay](/llm/markdown/cloud/features/test-replay.md), open your browser's Developer Tools and click a `cy.prompt` command or an individual self-healed step to print detailed Console logs, including:\n\n*   **Resolved element** - The selector and element that this step resolved to after self-healing.\n*   **Cached elements** - The previously resolved elements that the step checked before self-healing.\n*   **Self-healed** - Whether the element was self-healed.\n\nIf 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.\n\nThis 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.\n\n### Self-healed status definitions\n\n**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.\n\n**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.\n",
      "section": "app",
      "anchors": [
        "self-healing"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 768
    },
    {
      "id": "app/guides/ai-test-generation#how-often-should-self-healing-happen",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "How often should self-healing happen?",
      "heading_level": 3,
      "content_markdown": "### How often should self-healing happen?\n\n`cy.prompt` self-heals when a **selector or its text content** changes between runs. Self-healing works best when it catches occasional, unexpected changes, **not when it fires on every run**.\n\nIf you use `cy.prompt` to target an element whose selector changes frequently (like dynamically generated selectors), `cy.prompt` will attempt to self-heal on every run. This increases AI calls, slows test execution, and reduces the cache benefit that makes `cy.prompt` fast in CI. This is not what you want.\n",
      "section": "app",
      "anchors": [
        "how-often-should-self-healing-happen"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 109
    },
    {
      "id": "app/guides/ai-test-generation#keep-self-healing-from-firing-every-run",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Keep self-healing from firing every run",
      "heading_level": 3,
      "content_markdown": "### Keep self-healing from firing every run\n\nTo keep a step from self-healing on every run, point it at something stable:\n\n*   **Target by visible text** with [text-based targeting](#Targeting-elements-by-text-content) when the content is more stable than the selector.\n*   **Use [placeholders](#Placeholders)** to supply a dynamic value at runtime instead of baking it into the step.\n*   **Configure the [ElementSelector API](/llm/markdown/api/cypress-api/element-selector-api.md)** to prioritize a more stable attribute or selector.\n\nThe right strategy is the one that matches what is actually stable in your application.\n",
      "section": "app",
      "anchors": [
        "keep-self-healing-from-firing-every-run"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 111
    },
    {
      "id": "app/guides/ai-test-generation#see-what-self-healed",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "See what self-healed",
      "heading_level": 3,
      "content_markdown": "### See what self-healed\n\nYou can see that a step self-healed in several places.\n\nIn the Command Log:\n\n*   **Test** - The test entry shows when at least one `cy.prompt` step self-healed during the run.\n*   **Prompt** - The `cy.prompt` command is marked when one or more of its steps self-healed.\n*   **Step** - Individual prompt steps show a **Self-healed** tag when the element they resolved to has changed since the last time that step ran.\n\nIn [Cypress Cloud](https://cloud.cypress.io):\n\n*   **Runs list** - A run that includes self-healed tests is flagged in the runs list.\n*   **Run overview** - Filter the tests in a run by those that self-healed.\n*   **Run properties** - See how many prompt definitions ran and how many self-healed in the run.\n*   **Test Replay** - Review the self-heal directly in the [Test Replay](/llm/markdown/cloud/features/test-replay.md) of the test.\n",
      "section": "app",
      "anchors": [
        "see-what-self-healed"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 188
    },
    {
      "id": "app/guides/ai-test-generation#console-logs",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Console logs",
      "heading_level": 3,
      "content_markdown": "### Console logs\n\nIn the Cypress App or in [Test Replay](/llm/markdown/cloud/features/test-replay.md), open your browser's Developer Tools and click a `cy.prompt` command or an individual self-healed step to print detailed Console logs, including:\n\n*   **Resolved element** - The selector and element that this step resolved to after self-healing.\n*   **Cached elements** - The previously resolved elements that the step checked before self-healing.\n*   **Self-healed** - Whether the element was self-healed.\n\nIf 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.\n\nThis 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.\n",
      "section": "app",
      "anchors": [
        "console-logs"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 185
    },
    {
      "id": "app/guides/ai-test-generation#self-healed-status-definitions",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Self-healed status definitions",
      "heading_level": 3,
      "content_markdown": "### Self-healed status definitions\n\n**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.\n\n**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.\n",
      "section": "app",
      "anchors": [
        "self-healed-status-definitions"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 104
    },
    {
      "id": "app/guides/ai-test-generation#placeholders",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Placeholders",
      "heading_level": 2,
      "content_markdown": "## Placeholders\n\nPlaceholders let you feed dynamic and sensitive values into a prompt without invalidating the cache or sending those values to the AI.\n\n### The caching problem\n\n`cy.prompt` caches the code it generates for your steps so it doesn't call the AI on every run. That cache is shared across machines and environments, including CI, so once a prompt is cached the whole team and every CI run reuse it for free.\n\nThe catch: **any change to your step strings invalidates the cache** and forces a new AI call. That's a problem when a step contains a **dynamic value** that changes each run, such as a timestamp, user ID, or randomly generated data. Hardcoded directly in the step, those values would bust the cache every time.\n\n### The placeholder solution\n\nReference values with the `{{placeholder}}` syntax and pass them through the `placeholders` option instead of inlining them. This keeps the step string constant, so:\n\n*   **Cache stays valid**: changing a placeholder's value doesn't invalidate the cache.\n*   **Values are substituted at runtime**: `{{placeholder}}` is replaced with the real value when the step executes.\n*   **Sensitive data stays private**: placeholder values are never sent to the AI.\n\n### Example usage\n\n```\ndescribe('Campaign Management', () => {  it('creates multiple campaigns with different discount percentages', () => {    cy.env(['ADMIN_PASSWORD']).then(({ adminPassword }) => {      const campaigns = [        { name: 'Fall Sale', discountPct: 10 },        { name: 'Spring Sale', discountPct: 15 },      ]      // This loop demonstrates the caching benefit:      // - First iteration: AI generates and caches the code      // - Subsequent iterations: Reuse cached code with different placeholder values      campaigns.forEach((campaign) => {        const campaignName = campaign.name        const campaignDiscountPct = campaign.discountPct        cy.prompt(          [            `Visit ${Cypress.expose('ADMIN_URL')}/admin/login`,            // Using {{adminPassword}} prevents this sensitive value from being sent to AI            'Type {{adminPassword}} into the password field',            'Click Sign In',            'Open the Promotions tab',            'Click to create a new campaign',            // Using {{campaignName}} and {{campaignDiscountPct}}            // allows for high performance caching with different values            'Type {{campaignName}} into the name field',            'Set discount to {{campaignDiscountPct}}% for all products',            'Save the campaign',            'Verify the campaign \"{{campaignName}}\" appears in the list',          ],          {            placeholders: {              adminPassword,              campaignName,              campaignDiscountPct,            },          }        )      })    })  })})\n```\n\n### Sensitive data handling\n\n#### Sensitive data in the DOM\n\nWhen `cy.prompt` reads your application's DOM to resolve element context, values from certain field types are automatically excluded before any data is sent to the AI model. This applies to:\n\n*   **Password fields** (`input[type=password]`)\n*   **Credit card fields** using standard autocomplete attributes, including card name, card number, expiry date, security code, and card type\n*   **Hidden inputs** (`input[type=hidden]`)\n\nThe structure and surrounding DOM context of these fields are still used to identify and interact with them. Only the field values are excluded.\n\n#### Sensitive data from the prompt\n\nIf you write:\n\n```\n'type \"hunter2\" in the password field'\n```\n\nThe string `\"hunter2\"` is part of your test code and is not affected by this feature. To keep sensitive values out of your step strings entirely, use placeholders:\n\n```\ncy.env(['USER_PASSWORD']).then(({ userPassword }) => {  cy.prompt(['type {{password}} in the password field'], {    placeholders: { password: userPassword },  })})\n```\n\nPlaceholder values are never sent to the AI model.\n",
      "section": "app",
      "anchors": [
        "placeholders"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 709
    },
    {
      "id": "app/guides/ai-test-generation#the-caching-problem",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "The caching problem",
      "heading_level": 3,
      "content_markdown": "### The caching problem\n\n`cy.prompt` caches the code it generates for your steps so it doesn't call the AI on every run. That cache is shared across machines and environments, including CI, so once a prompt is cached the whole team and every CI run reuse it for free.\n\nThe catch: **any change to your step strings invalidates the cache** and forces a new AI call. That's a problem when a step contains a **dynamic value** that changes each run, such as a timestamp, user ID, or randomly generated data. Hardcoded directly in the step, those values would bust the cache every time.\n",
      "section": "app",
      "anchors": [
        "the-caching-problem"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 137
    },
    {
      "id": "app/guides/ai-test-generation#the-placeholder-solution",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "The placeholder solution",
      "heading_level": 3,
      "content_markdown": "### The placeholder solution\n\nReference values with the `{{placeholder}}` syntax and pass them through the `placeholders` option instead of inlining them. This keeps the step string constant, so:\n\n*   **Cache stays valid**: changing a placeholder's value doesn't invalidate the cache.\n*   **Values are substituted at runtime**: `{{placeholder}}` is replaced with the real value when the step executes.\n*   **Sensitive data stays private**: placeholder values are never sent to the AI.\n",
      "section": "app",
      "anchors": [
        "the-placeholder-solution"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 93
    },
    {
      "id": "app/guides/ai-test-generation#example-usage",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Example usage",
      "heading_level": 3,
      "content_markdown": "### Example usage\n\n```\ndescribe('Campaign Management', () => {  it('creates multiple campaigns with different discount percentages', () => {    cy.env(['ADMIN_PASSWORD']).then(({ adminPassword }) => {      const campaigns = [        { name: 'Fall Sale', discountPct: 10 },        { name: 'Spring Sale', discountPct: 15 },      ]      // This loop demonstrates the caching benefit:      // - First iteration: AI generates and caches the code      // - Subsequent iterations: Reuse cached code with different placeholder values      campaigns.forEach((campaign) => {        const campaignName = campaign.name        const campaignDiscountPct = campaign.discountPct        cy.prompt(          [            `Visit ${Cypress.expose('ADMIN_URL')}/admin/login`,            // Using {{adminPassword}} prevents this sensitive value from being sent to AI            'Type {{adminPassword}} into the password field',            'Click Sign In',            'Open the Promotions tab',            'Click to create a new campaign',            // Using {{campaignName}} and {{campaignDiscountPct}}            // allows for high performance caching with different values            'Type {{campaignName}} into the name field',            'Set discount to {{campaignDiscountPct}}% for all products',            'Save the campaign',            'Verify the campaign \"{{campaignName}}\" appears in the list',          ],          {            placeholders: {              adminPassword,              campaignName,              campaignDiscountPct,            },          }        )      })    })  })})\n```\n",
      "section": "app",
      "anchors": [
        "example-usage"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 225
    },
    {
      "id": "app/guides/ai-test-generation#sensitive-data-handling",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Sensitive data handling",
      "heading_level": 3,
      "content_markdown": "### Sensitive data handling\n\n#### Sensitive data in the DOM\n\nWhen `cy.prompt` reads your application's DOM to resolve element context, values from certain field types are automatically excluded before any data is sent to the AI model. This applies to:\n\n*   **Password fields** (`input[type=password]`)\n*   **Credit card fields** using standard autocomplete attributes, including card name, card number, expiry date, security code, and card type\n*   **Hidden inputs** (`input[type=hidden]`)\n\nThe structure and surrounding DOM context of these fields are still used to identify and interact with them. Only the field values are excluded.\n\n#### Sensitive data from the prompt\n\nIf you write:\n\n```\n'type \"hunter2\" in the password field'\n```\n\nThe string `\"hunter2\"` is part of your test code and is not affected by this feature. To keep sensitive values out of your step strings entirely, use placeholders:\n\n```\ncy.env(['USER_PASSWORD']).then(({ userPassword }) => {  cy.prompt(['type {{password}} in the password field'], {    placeholders: { password: userPassword },  })})\n```\n\nPlaceholder values are never sent to the AI model.\n",
      "section": "app",
      "anchors": [
        "sensitive-data-handling"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 221
    },
    {
      "id": "app/guides/ai-test-generation#sensitive-data-in-the-dom",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Sensitive data in the DOM",
      "heading_level": 4,
      "content_markdown": "#### Sensitive data in the DOM\n\nWhen `cy.prompt` reads your application's DOM to resolve element context, values from certain field types are automatically excluded before any data is sent to the AI model. This applies to:\n\n*   **Password fields** (`input[type=password]`)\n*   **Credit card fields** using standard autocomplete attributes, including card name, card number, expiry date, security code, and card type\n*   **Hidden inputs** (`input[type=hidden]`)\n\nThe structure and surrounding DOM context of these fields are still used to identify and interact with them. Only the field values are excluded.\n",
      "section": "app",
      "anchors": [
        "sensitive-data-in-the-dom"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 117
    },
    {
      "id": "app/guides/ai-test-generation#sensitive-data-from-the-prompt",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Sensitive data from the prompt",
      "heading_level": 4,
      "content_markdown": "#### Sensitive data from the prompt\n\nIf you write:\n\n```\n'type \"hunter2\" in the password field'\n```\n\nThe string `\"hunter2\"` is part of your test code and is not affected by this feature. To keep sensitive values out of your step strings entirely, use placeholders:\n\n```\ncy.env(['USER_PASSWORD']).then(({ userPassword }) => {  cy.prompt(['type {{password}} in the password field'], {    placeholders: { password: userPassword },  })})\n```\n\nPlaceholder values are never sent to the AI model.\n",
      "section": "app",
      "anchors": [
        "sensitive-data-from-the-prompt"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 99
    },
    {
      "id": "app/guides/ai-test-generation#view-and-export-generated-code",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "View and export generated code",
      "heading_level": 2,
      "content_markdown": "## View and export generated code\n\nDuring or after any test run, you can view the exact Cypress code that `cy.prompt` generated from your natural language steps, with no black box. Combined with the self-healed tags and Console details in the Command Log, this gives you an auditable record of what happened during execution, so you can debug AI-generated tests and reduce flaky end-to-end tests over time.\n\n### How to view generated code\n\n*   **Run your test** with `cy.prompt` in Cypress App\n*   **Click the \"Code\" button** - This button appears next to each `cy.prompt` command in the Command Log, even for failing tests\n\n*   **Review the generated code** - A dialog displays the complete Cypress code with all of the generated commands (e.g., `cy.get()`, `cy.click()`, `cy.type()`) and comments showing which prompt step generated each command.\n\n### What you can do with the generated code\n\nOnce you have the generated code, you can:\n\n*   **Save code to your test file** - Replace the `cy.prompt` call with the generated Cypress commands for predictable, version-controlled tests.\n*   **Copy code to your clipboard** - Use the code in other files or share it with your team.\n\nThis helps you review and modify the generated code as needed or just use it as a reference to understand what `cy.prompt` is doing behind the scenes.\n\n### Customizing selectors in generated code\n\nYou can customize which selectors `cy.prompt` uses by configuring the [ElementSelector API](/llm/markdown/api/cypress-api/element-selector-api.md). This lets you control which attributes Cypress prioritizes (like `data-*`, `id`, `aria-label`, etc.) when querying for selectors, ensuring the generated code matches your project's selector strategy.\n\nConfigure the selector priority in your support file or test file:\n\n```\n// cypress/support/e2e.js or in your test fileCypress.ElementSelector.defaults({  selectorPriority: [    'data-cy', // Prefer data-cy attributes    'attribute:role', // Then ARIA roles    'attribute:aria-label', // Then ARIA labels    'id', // Then IDs    'class', // Finally classes  ],})\n```\n\nFor more examples and details, see the [ElementSelector API documentation](/llm/markdown/api/cypress-api/element-selector-api.md).\n\n### Download a prompt report for a run\n\nThe **Code** button exports one test at a time. To capture **every** `cy.prompt` from a recorded run at once, download a report from Cypress Cloud. This is useful for auditing AI-generated code across a CI build, sharing it with your team, or feeding it into other tools.\n\n1.  Open the run in [Cypress Cloud](https://cloud.cypress.io) and select its **Properties** tab.\n2.  Scroll to the **cy.prompt** section. It summarizes the run's `cy.prompt` usage, including the number of prompts in the run and the number of self-healed tests.\n3.  Click **Download report** and choose a format: **JSON**, **YAML**, or **Markdown**.\n\nThe report lists each prompt grouped by spec and test, along with the natural language steps and the Cypress code that was generated from them. For example, a downloaded Markdown report looks like this:\n\n```\n# cy.prompt export: build 10595_Project: d9sdrd · Exported: 2026-06-24T22:17:03.291Z_## Spec: `cypress/e2e/blog.cy.ts`### Test: _[\"Blog\",\"should render the blog list page\"]_**Prompts:**- \"Validate the presence of the blog category tabs: All, Releases, Community, Education, Customer Stories, Company\"- \"Validate that the \"All\" tab has the class \"text-indigo-500\"\"```javascript// Prompt step 1: Validate the presence of the blog category tabs: All, Releases, Community, Education, Customer Stories, Companycy.get('#tab-all').should('be.visible')cy.get('#tab-releases').should('be.visible')cy.get('#tab-community').should('be.visible')cy.get('#tab-education').should('be.visible')cy.get('#tab-customer\\\\ stories').should('be.visible')cy.get('#tab-company').should('be.visible')// Prompt step 2: Validate that the \"All\" tab has the class \"text-indigo-500\"cy.get('#tab-all').should('have.class', 'text-indigo-500')```\n```\n",
      "section": "app",
      "anchors": [
        "view-and-export-generated-code"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 713
    },
    {
      "id": "app/guides/ai-test-generation#how-to-view-generated-code",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "How to view generated code",
      "heading_level": 3,
      "content_markdown": "### How to view generated code\n\n*   **Run your test** with `cy.prompt` in Cypress App\n*   **Click the \"Code\" button** - This button appears next to each `cy.prompt` command in the Command Log, even for failing tests\n\n*   **Review the generated code** - A dialog displays the complete Cypress code with all of the generated commands (e.g., `cy.get()`, `cy.click()`, `cy.type()`) and comments showing which prompt step generated each command.\n",
      "section": "app",
      "anchors": [
        "how-to-view-generated-code"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 92
    },
    {
      "id": "app/guides/ai-test-generation#what-you-can-do-with-the-generated-code",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "What you can do with the generated code",
      "heading_level": 3,
      "content_markdown": "### What you can do with the generated code\n\nOnce you have the generated code, you can:\n\n*   **Save code to your test file** - Replace the `cy.prompt` call with the generated Cypress commands for predictable, version-controlled tests.\n*   **Copy code to your clipboard** - Use the code in other files or share it with your team.\n\nThis helps you review and modify the generated code as needed or just use it as a reference to understand what `cy.prompt` is doing behind the scenes.\n",
      "section": "app",
      "anchors": [
        "what-you-can-do-with-the-generated-code"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 112
    },
    {
      "id": "app/guides/ai-test-generation#customizing-selectors-in-generated-code",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Customizing selectors in generated code",
      "heading_level": 3,
      "content_markdown": "### Customizing selectors in generated code\n\nYou can customize which selectors `cy.prompt` uses by configuring the [ElementSelector API](/llm/markdown/api/cypress-api/element-selector-api.md). This lets you control which attributes Cypress prioritizes (like `data-*`, `id`, `aria-label`, etc.) when querying for selectors, ensuring the generated code matches your project's selector strategy.\n\nConfigure the selector priority in your support file or test file:\n\n```\n// cypress/support/e2e.js or in your test fileCypress.ElementSelector.defaults({  selectorPriority: [    'data-cy', // Prefer data-cy attributes    'attribute:role', // Then ARIA roles    'attribute:aria-label', // Then ARIA labels    'id', // Then IDs    'class', // Finally classes  ],})\n```\n\nFor more examples and details, see the [ElementSelector API documentation](/llm/markdown/api/cypress-api/element-selector-api.md).\n",
      "section": "app",
      "anchors": [
        "customizing-selectors-in-generated-code"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 133
    },
    {
      "id": "app/guides/ai-test-generation#download-a-prompt-report-for-a-run",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Download a prompt report for a run",
      "heading_level": 3,
      "content_markdown": "### Download a prompt report for a run\n\nThe **Code** button exports one test at a time. To capture **every** `cy.prompt` from a recorded run at once, download a report from Cypress Cloud. This is useful for auditing AI-generated code across a CI build, sharing it with your team, or feeding it into other tools.\n\n1.  Open the run in [Cypress Cloud](https://cloud.cypress.io) and select its **Properties** tab.\n2.  Scroll to the **cy.prompt** section. It summarizes the run's `cy.prompt` usage, including the number of prompts in the run and the number of self-healed tests.\n3.  Click **Download report** and choose a format: **JSON**, **YAML**, or **Markdown**.\n\nThe report lists each prompt grouped by spec and test, along with the natural language steps and the Cypress code that was generated from them. For example, a downloaded Markdown report looks like this:\n\n```\n# cy.prompt export: build 10595_Project: d9sdrd · Exported: 2026-06-24T22:17:03.291Z_## Spec: `cypress/e2e/blog.cy.ts`### Test: _[\"Blog\",\"should render the blog list page\"]_**Prompts:**- \"Validate the presence of the blog category tabs: All, Releases, Community, Education, Customer Stories, Company\"- \"Validate that the \"All\" tab has the class \"text-indigo-500\"\"```javascript// Prompt step 1: Validate the presence of the blog category tabs: All, Releases, Community, Education, Customer Stories, Companycy.get('#tab-all').should('be.visible')cy.get('#tab-releases').should('be.visible')cy.get('#tab-community').should('be.visible')cy.get('#tab-education').should('be.visible')cy.get('#tab-customer\\\\ stories').should('be.visible')cy.get('#tab-company').should('be.visible')// Prompt step 2: Validate that the \"All\" tab has the class \"text-indigo-500\"cy.get('#tab-all').should('have.class', 'text-indigo-500')```\n```\n",
      "section": "app",
      "anchors": [
        "download-a-prompt-report-for-a-run"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 287
    },
    {
      "id": "app/guides/ai-test-generation#pricing-and-usage-limits",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Pricing and usage limits",
      "heading_level": 2,
      "content_markdown": "## Pricing and usage limits\n\nCypress Cloud meters [`cy.prompt`](/llm/markdown/api/commands/prompt.md) usage at the organization level as **cy.prompt executions**, with separate per-user hourly limits on runs that are not recording to Cypress Cloud. The [cy.prompt FAQ](/llm/markdown/cloud/faq.md#cyprompt) is the full reference for execution counting, usage limits, the grace period, billing, and usage notifications.\n\nThrough August 1, 2026, accumulated usage before that date is ignored for billing purposes. There are no charges or limiting behavior related to usage prior to the cutoff. See [What happens at the end of the grace period?](/llm/markdown/cloud/faq.md#What-happens-at-the-end-of-the-cyprompt-grace-period) in the Cloud FAQ.\n",
      "section": "app",
      "anchors": [
        "pricing-and-usage-limits"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 123
    },
    {
      "id": "app/guides/ai-test-generation#disabling-ai-features",
      "doc_id": "app/guides/ai-test-generation",
      "heading": "Disabling AI features",
      "heading_level": 2,
      "content_markdown": "## Disabling AI features\n\nAI capabilities, including `cy.prompt`, are enabled by default for all users on any Cloud plan. Organization admins and owners can enable and disable the AI capabilities for their entire organization from their organization settings. For more information, see [Disabling AI features](/llm/markdown/cloud/features/cypress-ai-features.md#Disabling-AI-features).\n",
      "section": "app",
      "anchors": [
        "disabling-ai-features"
      ],
      "path": "/llm/json/chunked/app/guides/ai-test-generation.json",
      "token_estimate": 60
    }
  ]
}