{
  "doc": {
    "id": "ui-coverage/configuration/allowedinteractioncommands",
    "title": "allowedInteractionCommands: choose which commands count as coverage",
    "description": "Use allowedInteractionCommands to control which Cypress interaction commands count as coverage for specific elements, so you can require a meaningful interaction or accept commands UI Coverage ignores by default.",
    "section": "ui-coverage",
    "source_path": "/llm/markdown/ui-coverage/configuration/allowedinteractioncommands.md",
    "version": "e6c8d867c21227247f14714fb5690c7c018983c5",
    "updated_at": "2026-08-08T12:39:37.868Z",
    "headings": [
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#limit-tracked-commands-allowedinteractioncommands",
        "text": "Limit tracked commands - allowedInteractionCommands",
        "level": 1
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#why-use-allowedinteractioncommands",
        "text": "Why use allowedInteractionCommands?",
        "level": 2
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#setting-allowedinteractioncommands",
        "text": "Setting allowedInteractionCommands",
        "level": 2
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#options",
        "text": "Options",
        "level": 3
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#how-rules-are-applied",
        "text": "How rules are applied",
        "level": 2
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#requiring-a-specific-interaction-for-a-component",
        "text": "Requiring a specific interaction for a component",
        "level": 3
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#config",
        "text": "Config",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#usage-in-tests",
        "text": "Usage in tests",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#different-rules-for-form-elements",
        "text": "Different rules for form elements",
        "level": 3
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#config",
        "text": "Config",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#usage-in-tests",
        "text": "Usage in tests",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#counting-third-party-commands-for-specific-elements",
        "text": "Counting third-party commands for specific elements",
        "level": 3
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#config",
        "text": "Config",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#usage-in-tests",
        "text": "Usage in tests",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#counting-assertions-as-coverage",
        "text": "Counting assertions as coverage",
        "level": 3
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#config",
        "text": "Config",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#usage-in-tests",
        "text": "Usage in tests",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#scoping-rules-to-shadow-dom",
        "text": "Scoping rules to shadow DOM",
        "level": 3
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#config",
        "text": "Config",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#html",
        "text": "HTML",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#usage-in-tests",
        "text": "Usage in tests",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#scoping-rules-to-iframes",
        "text": "Scoping rules to iframes",
        "level": 3
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#config",
        "text": "Config",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#html",
        "text": "HTML",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#usage-in-tests",
        "text": "Usage in tests",
        "level": 4
      },
      {
        "id": "ui-coverage/configuration/allowedinteractioncommands#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#why-use-allowedinteractioncommands",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Why use allowedInteractionCommands?",
      "heading_level": 2,
      "content_markdown": "## Why use allowedInteractionCommands?\n\n*   **Require a meaningful interaction**: For components where a plain `click` doesn't prove the feature works, such as charts, drag-and-drop canvases, and custom widgets, restrict coverage to the command that actually exercises it, so a superficial interaction no longer marks the element tested.\n*   **Credit commands ignored by default**: Count interactions UI Coverage doesn't track out of the box, such as an `assert` on a read-only element, as coverage for the specific elements where that interaction is what matters.\n*   **Reduce noise in reports**: Limit tracking to the interaction types that are relevant for a given element or component, so coverage reflects the interactions your team cares about.\n\nFor custom or third-party commands that should count as coverage **everywhere** rather than for specific elements, use [`additionalInteractionCommands`](/llm/markdown/ui-coverage/configuration/additionalinteractioncommands.md) instead. See [Which option do I need?](/llm/markdown/ui-coverage/configuration/overview.md#Which-option-do-I-need) in the configuration overview.\n",
      "section": "ui-coverage",
      "anchors": [
        "why-use-allowedinteractioncommands"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 188
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#setting-allowedinteractioncommands",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Setting allowedInteractionCommands",
      "heading_level": 2,
      "content_markdown": "## Setting allowedInteractionCommands\n\nTo add or edit `allowedInteractionCommands`, open the **App Quality** tab in your project settings in Cypress Cloud. `allowedInteractionCommands` is a UI Coverage–only option and is always nested under the `uiCoverage` key. See [Setting configuration](/llm/markdown/ui-coverage/configuration/overview.md#Setting-configuration) for details, including how to regenerate past reports with a new configuration without rerunning your tests.\n",
      "section": "ui-coverage",
      "anchors": [
        "setting-allowedinteractioncommands"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 71
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#syntax",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": string,        \"commands\": [string],        \"documentScope\": [string],        \"comment\": string      }    ]  }}\n```\n\n### Options\n\nThe `allowedInteractionCommands` property accepts an array of objects, where each object defines a rule that limits the interaction commands counted as coverage for elements matching a selector.\n\n| Option | Required | Default | Description |\n| --- | --- | --- | --- |\n| `selector` | Required |  | A CSS selector that identifies the elements the rule applies to. Supports standard CSS selector syntax, including IDs, classes, attributes, and combinators. |\n| `commands` | Required |  | An array of command names (strings) that count as coverage for elements matching the selector. Any command not in this list is ignored for those elements, including commands that would otherwise count by default. |\n| `documentScope` | Optional |  | An ordered list of CSS selectors identifying the iframe or shadow DOM hosts that must contain the element, from the outermost document to the innermost. When set, the rule applies only to matching elements inside those nested documents. |\n| `comment` | Optional |  | A note about why this rule exists, for your team's benefit. Comments appear only in the configuration itself. They have no effect on processing and are not displayed in reports. |\n\nEach `selector`/`documentScope` combination must be unique across the list; duplicate rules are rejected by validation.\n",
      "section": "ui-coverage",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 317
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#options",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Options",
      "heading_level": 3,
      "content_markdown": "### Options\n\nThe `allowedInteractionCommands` property accepts an array of objects, where each object defines a rule that limits the interaction commands counted as coverage for elements matching a selector.\n\n| Option | Required | Default | Description |\n| --- | --- | --- | --- |\n| `selector` | Required |  | A CSS selector that identifies the elements the rule applies to. Supports standard CSS selector syntax, including IDs, classes, attributes, and combinators. |\n| `commands` | Required |  | An array of command names (strings) that count as coverage for elements matching the selector. Any command not in this list is ignored for those elements, including commands that would otherwise count by default. |\n| `documentScope` | Optional |  | An ordered list of CSS selectors identifying the iframe or shadow DOM hosts that must contain the element, from the outermost document to the innermost. When set, the rule applies only to matching elements inside those nested documents. |\n| `comment` | Optional |  | A note about why this rule exists, for your team's benefit. Comments appear only in the configuration itself. They have no effect on processing and are not displayed in reports. |\n\nEach `selector`/`documentScope` combination must be unique across the list; duplicate rules are rejected by validation.\n",
      "section": "ui-coverage",
      "anchors": [
        "options"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 285
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#how-rules-are-applied",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "How rules are applied",
      "heading_level": 2,
      "content_markdown": "## How rules are applied\n\nUnderstanding the matching behavior is the key to using this option correctly:\n\n*   **Elements that match no rule are unaffected.** They keep the full [default set of interaction commands](/llm/markdown/ui-coverage/core-concepts/interactivity.md#Interaction-Commands), plus anything you've added with [`additionalInteractionCommands`](/llm/markdown/ui-coverage/configuration/additionalinteractioncommands.md).\n*   **Matching a rule replaces the defaults for that element.** Once an element matches a rule, only the commands listed in that rule count as coverage for it. The default commands no longer apply. This is how the option both narrows coverage (a listed command like `click` still counts, an unlisted default like `type` no longer does) and expands it (a listed non-default command like `assert` now counts).\n*   **Commands are combined across all matching rules.** If an element matches more than one rule, the commands from every matching rule are allowed for it. Because rules are additive this way, a later rule can never remove a command an earlier rule granted. Favor a high degree of selector specificity so each element matches only the rule you intend.\n*   **A custom command listed here doesn't need to be registered anywhere else.** Normally a custom or plugin command (one that isn't a [default command](/llm/markdown/ui-coverage/core-concepts/interactivity.md#Interaction-Commands)) only counts as an interaction if you add it to [`additionalInteractionCommands`](/llm/markdown/ui-coverage/configuration/additionalinteractioncommands.md). Naming it in a rule's `commands` list registers it as well, so a command like `realHover` is recognized here without also appearing in `additionalInteractionCommands`.\n*   **Command names are case-sensitive.** Each name in `commands` must match the command exactly as it appears in your test code, and only commands that actually target a DOM element produce coverage.\n",
      "section": "ui-coverage",
      "anchors": [
        "how-rules-are-applied"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 347
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#examples",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### Requiring a specific interaction for a component\n\nRestrict coverage for a chart component to the command that meaningfully exercises it. Because matching the rule replaces the defaults, a plain `click` no longer marks the chart tested.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"[data-cy='revenue-chart']\",        \"commands\": [\"trigger\"],        \"comment\": \"Only a hover (dispatched via trigger) proves the chart tooltip works\"      }    ]  }}\n```\n\n#### Usage in tests\n\n```\n// Only `trigger` counts as coverage for the chartcy.get('[data-cy=\"revenue-chart\"]').trigger('mouseover') // ✓ Trackedcy.get('[data-cy=\"revenue-chart\"]').click() // ✗ Not tracked (a default command, now excluded)\n```\n\n### Different rules for form elements\n\nApply distinct command sets to different kinds of form controls. Each control is credited only for the commands relevant to it.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"input[type='text'], textarea\",        \"commands\": [\"type\", \"clear\"]      },      {        \"selector\": \"select\",        \"commands\": [\"select\"]      },      {        \"selector\": \"input[type='checkbox'], input[type='radio']\",        \"commands\": [\"check\", \"uncheck\"]      }    ]  }}\n```\n\n#### Usage in tests\n\n```\n// Text inputs: only `type` and `clear` countcy.get('[data-cy=\"username\"]').type('john_doe') // ✓ Trackedcy.get('[data-cy=\"username\"]').clear() // ✓ Trackedcy.get('[data-cy=\"username\"]').focus() // ✗ Not tracked (a default command, now excluded)// Select elements: only `select` countscy.get('[data-cy=\"country\"]').select('US') // ✓ Trackedcy.get('[data-cy=\"country\"]').click() // ✗ Not tracked (a default command, now excluded)// Checkboxes/radios: only `check` and `uncheck` countcy.get('[data-cy=\"agree-terms\"]').check() // ✓ Trackedcy.get('[data-cy=\"agree-terms\"]').click() // ✗ Not tracked (a default command, now excluded)\n```\n\n### Counting third-party commands for specific elements\n\nCommands from a plugin such as [`cypress-real-events`](https://github.com/dmtrKovalenko/cypress-real-events) aren't tracked by default. Listing a command here both scopes it to the matching elements and registers it as a recognized interaction, so you don't also need to add it to [`additionalInteractionCommands`](/llm/markdown/ui-coverage/configuration/additionalinteractioncommands.md). Reach for `allowedInteractionCommands` when the command should only count for certain elements; if you want a plugin command counted on every element, add it to [`additionalInteractionCommands`](/llm/markdown/ui-coverage/configuration/additionalinteractioncommands.md) instead.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"[data-cy='tooltip-trigger']\",        \"commands\": [\"realHover\"]      }    ]  }}\n```\n\n#### Usage in tests\n\n```\n// `realHover` counts as coverage for the tooltip triggercy.get('[data-cy=\"tooltip-trigger\"]').realHover() // ✓ Trackedcy.get('[data-cy=\"tooltip-trigger\"]').click() // ✗ Not tracked (a default command, now excluded)\n```\n\nLike custom commands added with [`additionalInteractionCommands`](/llm/markdown/ui-coverage/configuration/additionalinteractioncommands.md), a command listed here only produces coverage if it logs a snapshot that references the subject element. Built-in Cypress commands and well-behaved plugins do this automatically. See [custom commands](/llm/markdown/api/cypress-api/custom-commands.md) for details.\n\n### Counting assertions as coverage\n\nSome elements are only ever validated, never interacted with, such as a read-only status badge or a computed total. Assertions don't count as coverage by default, but you can list `assert` to credit them. Remember that once a rule matches, only the commands you list count, so include any other commands you also want to accept.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"[data-cy='order-total']\",        \"commands\": [\"assert\"]      }    ]  }}\n```\n\n#### Usage in tests\n\n```\n// Assertions against the element count as coveragecy.get('[data-cy=\"order-total\"]').should('be.visible') // ✓ Trackedcy.get('[data-cy=\"order-total\"]').click() // ✗ Not tracked (`assert` is the only allowed command)\n```\n\n### Scoping rules to shadow DOM\n\nWhen a rule should apply only to elements inside a specific shadow DOM host, use `documentScope` to scope the selector to that document context.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"button\",        \"commands\": [\"click\"],        \"documentScope\": [\"custom-component\"]      }    ]  }}\n```\n\n#### HTML\n\n```\n<body>  <button id=\"root-button\">Root Button</button>  <custom-component>    #shadow-root    <button id=\"shadow-button\">Shadow Button</button>  </custom-component></body>\n```\n\n#### Usage in tests\n\n```\n// Root button: unaffected, keeps all default interaction commandscy.get('#root-button').click() // ✓ Trackedcy.get('#root-button').focus() // ✓ Tracked// Shadow DOM button: matches the rule, so only `click` countscy.get('custom-component').shadow().find('#shadow-button').click() // ✓ Trackedcy.get('custom-component').shadow().find('#shadow-button').focus() // ✗ Not tracked\n```\n\n### Scoping rules to iframes\n\n`documentScope` also scopes a rule to elements inside a specific iframe. List one selector per nested document, ordered from the outermost document to the innermost.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"input\",        \"commands\": [\"type\", \"clear\"],        \"documentScope\": [\"#embedded-form\"]      }    ]  }}\n```\n\n#### HTML\n\n```\n<body>  <input id=\"root-input\" />  <iframe id=\"embedded-form\" src=\"http://www.foo.com\">    <html>      <body>        <input id=\"embedded-input\" />      </body>    </html>  </iframe></body>\n```\n\n#### Usage in tests\n\n```\n// Root input: unaffected, keeps all default interaction commandscy.get('#root-input').type('text') // ✓ Trackedcy.get('#root-input').focus() // ✓ Tracked// Embedded input: matches the rule, so only `type` and `clear` countcy.get('#embedded-form').then(($iframe) => {  cy.wrap($iframe.contents().find('#embedded-input')).type('text') // ✓ Tracked  cy.wrap($iframe.contents().find('#embedded-input')).focus() // ✗ Not tracked})\n```\n",
      "section": "ui-coverage",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 945
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#requiring-a-specific-interaction-for-a-component",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Requiring a specific interaction for a component",
      "heading_level": 3,
      "content_markdown": "### Requiring a specific interaction for a component\n\nRestrict coverage for a chart component to the command that meaningfully exercises it. Because matching the rule replaces the defaults, a plain `click` no longer marks the chart tested.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"[data-cy='revenue-chart']\",        \"commands\": [\"trigger\"],        \"comment\": \"Only a hover (dispatched via trigger) proves the chart tooltip works\"      }    ]  }}\n```\n\n#### Usage in tests\n\n```\n// Only `trigger` counts as coverage for the chartcy.get('[data-cy=\"revenue-chart\"]').trigger('mouseover') // ✓ Trackedcy.get('[data-cy=\"revenue-chart\"]').click() // ✗ Not tracked (a default command, now excluded)\n```\n",
      "section": "ui-coverage",
      "anchors": [
        "requiring-a-specific-interaction-for-a-component"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 128
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#config",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Config",
      "heading_level": 4,
      "content_markdown": "#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"[data-cy='revenue-chart']\",        \"commands\": [\"trigger\"],        \"comment\": \"Only a hover (dispatched via trigger) proves the chart tooltip works\"      }    ]  }}\n```\n",
      "section": "ui-coverage",
      "anchors": [
        "config"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 43
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#different-rules-for-form-elements",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Different rules for form elements",
      "heading_level": 3,
      "content_markdown": "### Different rules for form elements\n\nApply distinct command sets to different kinds of form controls. Each control is credited only for the commands relevant to it.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"input[type='text'], textarea\",        \"commands\": [\"type\", \"clear\"]      },      {        \"selector\": \"select\",        \"commands\": [\"select\"]      },      {        \"selector\": \"input[type='checkbox'], input[type='radio']\",        \"commands\": [\"check\", \"uncheck\"]      }    ]  }}\n```\n\n#### Usage in tests\n\n```\n// Text inputs: only `type` and `clear` countcy.get('[data-cy=\"username\"]').type('john_doe') // ✓ Trackedcy.get('[data-cy=\"username\"]').clear() // ✓ Trackedcy.get('[data-cy=\"username\"]').focus() // ✗ Not tracked (a default command, now excluded)// Select elements: only `select` countscy.get('[data-cy=\"country\"]').select('US') // ✓ Trackedcy.get('[data-cy=\"country\"]').click() // ✗ Not tracked (a default command, now excluded)// Checkboxes/radios: only `check` and `uncheck` countcy.get('[data-cy=\"agree-terms\"]').check() // ✓ Trackedcy.get('[data-cy=\"agree-terms\"]').click() // ✗ Not tracked (a default command, now excluded)\n```\n",
      "section": "ui-coverage",
      "anchors": [
        "different-rules-for-form-elements"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 169
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#config",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Config",
      "heading_level": 4,
      "content_markdown": "#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"input[type='text'], textarea\",        \"commands\": [\"type\", \"clear\"]      },      {        \"selector\": \"select\",        \"commands\": [\"select\"]      },      {        \"selector\": \"input[type='checkbox'], input[type='radio']\",        \"commands\": [\"check\", \"uncheck\"]      }    ]  }}\n```\n",
      "section": "ui-coverage",
      "anchors": [
        "config"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 48
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#usage-in-tests",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Usage in tests",
      "heading_level": 4,
      "content_markdown": "#### Usage in tests\n\n```\n// Text inputs: only `type` and `clear` countcy.get('[data-cy=\"username\"]').type('john_doe') // ✓ Trackedcy.get('[data-cy=\"username\"]').clear() // ✓ Trackedcy.get('[data-cy=\"username\"]').focus() // ✗ Not tracked (a default command, now excluded)// Select elements: only `select` countscy.get('[data-cy=\"country\"]').select('US') // ✓ Trackedcy.get('[data-cy=\"country\"]').click() // ✗ Not tracked (a default command, now excluded)// Checkboxes/radios: only `check` and `uncheck` countcy.get('[data-cy=\"agree-terms\"]').check() // ✓ Trackedcy.get('[data-cy=\"agree-terms\"]').click() // ✗ Not tracked (a default command, now excluded)\n```\n",
      "section": "ui-coverage",
      "anchors": [
        "usage-in-tests"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 85
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#counting-third-party-commands-for-specific-elements",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Counting third-party commands for specific elements",
      "heading_level": 3,
      "content_markdown": "### Counting third-party commands for specific elements\n\nCommands from a plugin such as [`cypress-real-events`](https://github.com/dmtrKovalenko/cypress-real-events) aren't tracked by default. Listing a command here both scopes it to the matching elements and registers it as a recognized interaction, so you don't also need to add it to [`additionalInteractionCommands`](/llm/markdown/ui-coverage/configuration/additionalinteractioncommands.md). Reach for `allowedInteractionCommands` when the command should only count for certain elements; if you want a plugin command counted on every element, add it to [`additionalInteractionCommands`](/llm/markdown/ui-coverage/configuration/additionalinteractioncommands.md) instead.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"[data-cy='tooltip-trigger']\",        \"commands\": [\"realHover\"]      }    ]  }}\n```\n\n#### Usage in tests\n\n```\n// `realHover` counts as coverage for the tooltip triggercy.get('[data-cy=\"tooltip-trigger\"]').realHover() // ✓ Trackedcy.get('[data-cy=\"tooltip-trigger\"]').click() // ✗ Not tracked (a default command, now excluded)\n```\n\nLike custom commands added with [`additionalInteractionCommands`](/llm/markdown/ui-coverage/configuration/additionalinteractioncommands.md), a command listed here only produces coverage if it logs a snapshot that references the subject element. Built-in Cypress commands and well-behaved plugins do this automatically. See [custom commands](/llm/markdown/api/cypress-api/custom-commands.md) for details.\n",
      "section": "ui-coverage",
      "anchors": [
        "counting-third-party-commands-for-specific-elements"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 209
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#usage-in-tests",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Usage in tests",
      "heading_level": 4,
      "content_markdown": "#### Usage in tests\n\n```\n// `realHover` counts as coverage for the tooltip triggercy.get('[data-cy=\"tooltip-trigger\"]').realHover() // ✓ Trackedcy.get('[data-cy=\"tooltip-trigger\"]').click() // ✗ Not tracked (a default command, now excluded)\n```\n\nLike custom commands added with [`additionalInteractionCommands`](/llm/markdown/ui-coverage/configuration/additionalinteractioncommands.md), a command listed here only produces coverage if it logs a snapshot that references the subject element. Built-in Cypress commands and well-behaved plugins do this automatically. See [custom commands](/llm/markdown/api/cypress-api/custom-commands.md) for details.\n",
      "section": "ui-coverage",
      "anchors": [
        "usage-in-tests"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 85
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#counting-assertions-as-coverage",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Counting assertions as coverage",
      "heading_level": 3,
      "content_markdown": "### Counting assertions as coverage\n\nSome elements are only ever validated, never interacted with, such as a read-only status badge or a computed total. Assertions don't count as coverage by default, but you can list `assert` to credit them. Remember that once a rule matches, only the commands you list count, so include any other commands you also want to accept.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"[data-cy='order-total']\",        \"commands\": [\"assert\"]      }    ]  }}\n```\n\n#### Usage in tests\n\n```\n// Assertions against the element count as coveragecy.get('[data-cy=\"order-total\"]').should('be.visible') // ✓ Trackedcy.get('[data-cy=\"order-total\"]').click() // ✗ Not tracked (`assert` is the only allowed command)\n```\n",
      "section": "ui-coverage",
      "anchors": [
        "counting-assertions-as-coverage"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 144
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#scoping-rules-to-shadow-dom",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Scoping rules to shadow DOM",
      "heading_level": 3,
      "content_markdown": "### Scoping rules to shadow DOM\n\nWhen a rule should apply only to elements inside a specific shadow DOM host, use `documentScope` to scope the selector to that document context.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"button\",        \"commands\": [\"click\"],        \"documentScope\": [\"custom-component\"]      }    ]  }}\n```\n\n#### HTML\n\n```\n<body>  <button id=\"root-button\">Root Button</button>  <custom-component>    #shadow-root    <button id=\"shadow-button\">Shadow Button</button>  </custom-component></body>\n```\n\n#### Usage in tests\n\n```\n// Root button: unaffected, keeps all default interaction commandscy.get('#root-button').click() // ✓ Trackedcy.get('#root-button').focus() // ✓ Tracked// Shadow DOM button: matches the rule, so only `click` countscy.get('custom-component').shadow().find('#shadow-button').click() // ✓ Trackedcy.get('custom-component').shadow().find('#shadow-button').focus() // ✗ Not tracked\n```\n",
      "section": "ui-coverage",
      "anchors": [
        "scoping-rules-to-shadow-dom"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 139
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#usage-in-tests",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Usage in tests",
      "heading_level": 4,
      "content_markdown": "#### Usage in tests\n\n```\n// Root button: unaffected, keeps all default interaction commandscy.get('#root-button').click() // ✓ Trackedcy.get('#root-button').focus() // ✓ Tracked// Shadow DOM button: matches the rule, so only `click` countscy.get('custom-component').shadow().find('#shadow-button').click() // ✓ Trackedcy.get('custom-component').shadow().find('#shadow-button').focus() // ✗ Not tracked\n```\n",
      "section": "ui-coverage",
      "anchors": [
        "usage-in-tests"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 51
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#scoping-rules-to-iframes",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Scoping rules to iframes",
      "heading_level": 3,
      "content_markdown": "### Scoping rules to iframes\n\n`documentScope` also scopes a rule to elements inside a specific iframe. List one selector per nested document, ordered from the outermost document to the innermost.\n\n#### Config\n\nApp Quality Config\n\n```\n{  \"uiCoverage\": {    \"allowedInteractionCommands\": [      {        \"selector\": \"input\",        \"commands\": [\"type\", \"clear\"],        \"documentScope\": [\"#embedded-form\"]      }    ]  }}\n```\n\n#### HTML\n\n```\n<body>  <input id=\"root-input\" />  <iframe id=\"embedded-form\" src=\"http://www.foo.com\">    <html>      <body>        <input id=\"embedded-input\" />      </body>    </html>  </iframe></body>\n```\n\n#### Usage in tests\n\n```\n// Root input: unaffected, keeps all default interaction commandscy.get('#root-input').type('text') // ✓ Trackedcy.get('#root-input').focus() // ✓ Tracked// Embedded input: matches the rule, so only `type` and `clear` countcy.get('#embedded-form').then(($iframe) => {  cy.wrap($iframe.contents().find('#embedded-input')).type('text') // ✓ Tracked  cy.wrap($iframe.contents().find('#embedded-input')).focus() // ✗ Not tracked})\n```\n",
      "section": "ui-coverage",
      "anchors": [
        "scoping-rules-to-iframes"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 153
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#usage-in-tests",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "Usage in tests",
      "heading_level": 4,
      "content_markdown": "#### Usage in tests\n\n```\n// Root input: unaffected, keeps all default interaction commandscy.get('#root-input').type('text') // ✓ Trackedcy.get('#root-input').focus() // ✓ Tracked// Embedded input: matches the rule, so only `type` and `clear` countcy.get('#embedded-form').then(($iframe) => {  cy.wrap($iframe.contents().find('#embedded-input')).type('text') // ✓ Tracked  cy.wrap($iframe.contents().find('#embedded-input')).focus() // ✗ Not tracked})\n```\n",
      "section": "ui-coverage",
      "anchors": [
        "usage-in-tests"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 57
    },
    {
      "id": "ui-coverage/configuration/allowedinteractioncommands#see-also",
      "doc_id": "ui-coverage/configuration/allowedinteractioncommands",
      "heading": "See also",
      "heading_level": 2,
      "content_markdown": "## See also\n\n*   [`additionalInteractionCommands`](/llm/markdown/ui-coverage/configuration/additionalinteractioncommands.md): count a custom or plugin command as an interaction on every element, not just specific ones.\n*   [Interactivity](/llm/markdown/ui-coverage/core-concepts/interactivity.md#Interaction-Commands): the default set of commands UI Coverage tracks and how interactive elements are found.\n*   [Custom commands](/llm/markdown/api/cypress-api/custom-commands.md): writing commands that log a snapshot so UI Coverage can attribute them.\n*   [Configuration overview](/llm/markdown/ui-coverage/configuration/overview.md): where to set configuration and regenerate reports.\n*   [UI Coverage FAQ](/llm/markdown/ui-coverage/faq.md#Interaction-commands): common questions about interaction commands and troubleshooting.\n",
      "section": "ui-coverage",
      "anchors": [
        "see-also"
      ],
      "path": "/llm/json/chunked/ui-coverage/configuration/allowedinteractioncommands.json",
      "token_estimate": 97
    }
  ]
}