{
  "slug": "cypress-adds-the-cy-getbyrole-query-d6e262c51acd",
  "title": "Cypress adds the cy.getByRole() query",
  "tools": [
    "cypress"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-10-13T00:00:00.000Z",
  "announced_at": "2026-10-13T00:00:00.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When a Cypress test needs an element by ARIA role, optionally narrowed by accessible name, use `cy.getByRole(role, options)`; it retries until a match and chained assertions pass. By default it skips elements hidden from the accessibility tree and, for roles with native HTML elements, matches native elements only; set `hidden: true` or `native: false` to include those alternatives.",
    "examples": [
      "cy.getByRole('tab', { name: 'Billing' })"
    ],
    "gotchas": [
      "Version: 16.2.0",
      "role (required): Role string to find, such as `button` or `tab`.",
      "options.name: Match elements whose accessible name matches; accepts a string, number, regular expression, or function.",
      "options.hidden: Defaults to `false`; set `true` to include elements hidden from the accessibility tree.",
      "options.native: Defaults to `true` for roles with a corresponding HTML element, otherwise `false`; set `false` to also match elements given the role through a `role` attribute. These options are alternatives for the native matching behavior, not mutually exclusive with `hidden`.",
      "Elements hidden from the accessibility tree are skipped unless `{ hidden: true }` is passed.",
      "For a role that HTML has an element for, only that element matches by default; pass `{ native: false }` to also match elements with a `role` attribute."
    ]
  },
  "why_it_matters": "In a Cypress test, locate an element by its ARIA role and optionally its accessible name.",
  "sources": [
    "https://docs.cypress.io/app/references/changelog#16-2-0",
    "https://docs.cypress.io/api/commands/getbyrole"
  ],
  "rank": 0.99053,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave2b-20261017",
    "verdict_id": "wave2b-20261017:wave2b-20261017-922109a4afbfa547-0:gate",
    "evidence_hash": "0cbe8fd15ae645935f38947fccac9b50bed302ec3f6674c74b4740c43493aa58"
  },
  "review": {
    "draft_hash": "8509d0a5802d1be2a08bcf143946911bbdc4d8bbb2c639374e3c0328128dc24f",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-13T00:00:00.000Z",
    "decision": "wave2b-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.99 >= 0.9; 2 needed) and Jev gave 0.84 (>= 0.6 needed)."
  }
}
