<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Cypress</title>
    <description>The latest articles on DEV Community by Cypress (cypress).</description>
    <link>https://dev.to/cypress</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F1689%2F7be136d1-5863-4f25-804d-90437a10c851.jpg</url>
      <title>DEV Community: Cypress</title>
      <link>https://dev.to/cypress</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cypress"/>
    <language>en</language>
    <item>
      <title>Finding elements by role with cy.getByRole()</title>
      <dc:creator>Walmyr</dc:creator>
      <pubDate>Wed, 18 Nov 2026 01:30:32 +0000</pubDate>
      <link>https://dev.to/cypress/finding-elements-by-role-with-cygetbyrole-1kle</link>
      <guid>https://dev.to/cypress/finding-elements-by-role-with-cygetbyrole-1kle</guid>
      <description>&lt;h2&gt;
  
  
  Learn how to query elements the way your users perceive them, with no plugin.
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;🇧🇷 This content was also written in Portuguese, on the &lt;a href="https://talkingabouttesting.com/2026/11/18/encontrando-elementos-pelo-papel-com-cy-getbyrole/" rel="noopener noreferrer"&gt;Talking About Testing blog&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For years, when someone asked me how to find elements by their role in Cypress, my answer was the same: install Cypress Testing Library.&lt;/p&gt;

&lt;p&gt;That's no longer needed. Since Cypress 16.2.0, &lt;code&gt;cy.getByRole()&lt;/code&gt; ships with Cypress itself.&lt;/p&gt;

&lt;p&gt;But you might be wondering: why would I find an element by its role?&lt;/p&gt;

&lt;p&gt;Because that's how your users find it. Nobody sees &lt;code&gt;[data-test="save-button"]&lt;/code&gt; on a page. A sighted user sees a button that says "Save", and a screen reader user hears "Save, button". When the test looks for the same thing, it also tells you when that button stops being a button, or stops having a name, which is a real accessibility bug.&lt;/p&gt;

&lt;p&gt;That's precisely what I will show you in this pinch of Cypress.&lt;/p&gt;

&lt;h2&gt;
  
  
  The page
&lt;/h2&gt;

&lt;p&gt;Let's imagine the following settings page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Settings&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;nav&lt;/span&gt; &lt;span class="na"&gt;aria-label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Settings"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/profile"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Profile&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/billing"&lt;/span&gt; &lt;span class="na"&gt;aria-current&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"page"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Billing&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;form&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Email&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;label&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"checkbox"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    Send me the newsletter
  &lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Save&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"alert"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the form is saved, the alert shows "Changes saved".&lt;/p&gt;

&lt;h2&gt;
  
  
  The test
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Settings'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;beforeEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/settings'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'saves the email and the newsletter preference'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'textbox'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Email'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'walmyr@example.com'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'checkbox'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Send me the newsletter'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'button'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Save'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'alert'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'have.text'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Changes saved'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's understand what this code does.&lt;/p&gt;

&lt;p&gt;First, &lt;code&gt;cy.getByRole('textbox', { name: 'Email' })&lt;/code&gt; finds the email field. An &lt;code&gt;&amp;lt;input type="email"&amp;gt;&lt;/code&gt; has the &lt;code&gt;textbox&lt;/code&gt; role, and its accessible name comes from the &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; pointing at it.&lt;/p&gt;

&lt;p&gt;Then, the checkbox is found the same way. Its name comes from the text inside the &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; that wraps it.&lt;/p&gt;

&lt;p&gt;After that, we click the button named "Save". Its name is its own content.&lt;/p&gt;

&lt;p&gt;Finally, &lt;code&gt;cy.getByRole('alert')&lt;/code&gt; finds the status message, and &lt;code&gt;.should()&lt;/code&gt; waits until it has the expected text. Like &lt;code&gt;cy.get()&lt;/code&gt;, &lt;code&gt;cy.getByRole()&lt;/code&gt; is a query, so Cypress retries it until the element exists and every chained assertion passes, up to &lt;code&gt;defaultCommandTimeout&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Notice that there's not a single CSS selector in the test.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I still like &lt;code&gt;data-test&lt;/code&gt; attributes, and I'm not telling you to replace all of them. But when what matters is how an element is exposed to the user, a role and a name tell you much more than an attribute that only exists for the test.&lt;/p&gt;

&lt;p&gt;Everything okay so far? Then let's look at the details.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the name is matched
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;name&lt;/code&gt; option accepts a string, a number, a regular expression, or a function.&lt;/p&gt;

&lt;p&gt;A string must match the whole accessible name, and the comparison is case-sensitive (whitespace is collapsed and trimmed first). So &lt;code&gt;{ name: 'Save' }&lt;/code&gt; does not find a button named "Save changes".&lt;/p&gt;

&lt;p&gt;When you want a partial match, use a regular expression.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'button'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;/^&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'have.length'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The accessible name comes from the element's content, a &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt;, &lt;code&gt;aria-label&lt;/code&gt;, &lt;code&gt;aria-labelledby&lt;/code&gt;, an image's &lt;code&gt;alt&lt;/code&gt;, or &lt;code&gt;title&lt;/code&gt;. Content marked &lt;code&gt;aria-hidden="true"&lt;/code&gt; and CSS &lt;code&gt;::before&lt;/code&gt; and &lt;code&gt;::after&lt;/code&gt; content are left out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scoping the search
&lt;/h2&gt;

&lt;p&gt;You can chain &lt;code&gt;cy.getByRole()&lt;/code&gt; off any command that yields DOM elements. In that case, it only searches inside that subject.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'nav'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'link'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'have.length'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It also works inside &lt;code&gt;.within()&lt;/code&gt;, which reads really nice with a dialog.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'dialog'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Delete user'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;within&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'button'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Delete'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What about checked, selected, or level?
&lt;/h2&gt;

&lt;p&gt;If you come from Testing Library, you might try &lt;code&gt;{ checked: true }&lt;/code&gt; or &lt;code&gt;{ level: 2 }&lt;/code&gt;. &lt;code&gt;cy.getByRole()&lt;/code&gt; doesn't accept them. Any option it doesn't know throws an error.&lt;/p&gt;

&lt;p&gt;Instead, you narrow the result with &lt;code&gt;.filter()&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'link'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'[aria-current="page"]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'have.text'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Billing'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'checkbox'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;':checked'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'have.length'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first I found it a bit strange, but it makes sense. &lt;code&gt;cy.getByRole()&lt;/code&gt; yields every match, in document order, and the rest is plain Cypress that you already know.&lt;/p&gt;

&lt;h2&gt;
  
  
  Native elements first
&lt;/h2&gt;

&lt;p&gt;This is the part I like the most.&lt;/p&gt;

&lt;p&gt;By default, for roles that HTML has an element for, &lt;code&gt;cy.getByRole()&lt;/code&gt; only matches the native element. So, a &lt;code&gt;&amp;lt;div role="button"&amp;gt;&lt;/code&gt; is not found by &lt;code&gt;cy.getByRole('button')&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If your application (or your component library) really needs it, use the &lt;code&gt;native&lt;/code&gt; option.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'button'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Cancel'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;native&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why do I like this default? Because a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; pretending to be a button is often where the keyboard bugs live. Having to write &lt;code&gt;native: false&lt;/code&gt; makes you stop and think about it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Roles that HTML has no element for, such as &lt;code&gt;tab&lt;/code&gt; or &lt;code&gt;alert&lt;/code&gt;, are matched through the &lt;code&gt;role&lt;/code&gt; attribute without any extra option. That's why &lt;code&gt;cy.getByRole('alert')&lt;/code&gt; worked in the test above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note 2:&lt;/strong&gt; By default, elements hidden from the accessibility tree are skipped (the &lt;code&gt;hidden&lt;/code&gt; attribute, &lt;code&gt;aria-hidden="true"&lt;/code&gt;, &lt;code&gt;display: none&lt;/code&gt;, or &lt;code&gt;visibility: hidden&lt;/code&gt;). To include them, pass &lt;code&gt;{ hidden: true }&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When it fails
&lt;/h2&gt;

&lt;p&gt;When nothing matches, the error tells you what Cypress found instead.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Timed out retrying after 4000ms: Expected to find an accessible native element with the role "button" and name "Svae", but never did.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below that message, it lists the roles and names it did find on the page. A typo like the one above is solved in seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Coming from Cypress Testing Library?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;cy.getByRole()&lt;/code&gt; covers what &lt;code&gt;findByRole()&lt;/code&gt; and &lt;code&gt;findAllByRole()&lt;/code&gt; did for role queries. The migration is mostly about the state options.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Before&lt;/span&gt;
&lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'tab'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;selected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'have.text'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Billing'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// After&lt;/span&gt;
&lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'tab'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'[aria-selected="true"]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'have.text'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Billing'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If no other Testing Library query is left in your project, you can remove &lt;code&gt;@testing-library/cypress&lt;/code&gt; from the dependencies, its import from the support file, and its types from &lt;code&gt;tsconfig.json&lt;/code&gt;. One dependency less. 🎉&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Attention:&lt;/strong&gt; If your project already has a custom command called &lt;code&gt;getByRole&lt;/code&gt;, it now errors. Rename it.&lt;/p&gt;

&lt;h2&gt;
  
  
  That's it!
&lt;/h2&gt;

&lt;p&gt;To sum up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upgrade to Cypress 16.2.0 or later.&lt;/li&gt;
&lt;li&gt;Find elements by role and accessible name, the way your users find them.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;.filter()&lt;/code&gt; for states.&lt;/li&gt;
&lt;li&gt;Prefer native elements, and use &lt;code&gt;native: false&lt;/code&gt; only when you need it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For all the options, check the &lt;a href="https://docs.cypress.io/api/commands/getbyrole" rel="noopener noreferrer"&gt;official cy.getByRole() documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I hope you learned something new. Did you like the content? Leave a comment, and let's talk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Want to go deeper?
&lt;/h2&gt;

&lt;p&gt;At the &lt;a href="https://talkingabouttesting.school" rel="noopener noreferrer"&gt;Talking About Testing School&lt;/a&gt;, you'll find hands-on courses where you learn by writing real tests, not by watching passive tutorials.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;New to Cypress? Start with &lt;a href="https://talkingabouttesting.school/courses/cypress-basics" rel="noopener noreferrer"&gt;Cypress Basics&lt;/a&gt;, which is free.&lt;/li&gt;
&lt;li&gt;Want to find accessibility issues with Cypress? Bruno Pulis teaches you how in &lt;a href="https://talkingabouttesting.school/courses/common-accessibility-issues" rel="noopener noreferrer"&gt;The 6 Most Common Accessibility Issues&lt;/a&gt;, with Cypress and axe-core, and goes through the standard in the WCAG 2.2 Level A and Level AA courses. All three are in the &lt;a href="https://talkingabouttesting.school/accessibility-bundle" rel="noopener noreferrer"&gt;Accessibility Bundle&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Want to master Cypress? The &lt;a href="https://talkingabouttesting.school/cypress-bundle" rel="noopener noreferrer"&gt;Cypress Mastery Bundle&lt;/a&gt; has six Cypress courses, from the fundamentals to agentic testing with Cypress Tap.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And it's Black November! Until November 30, every course and every bundle is 40% off. The code to enter at checkout is on the site.&lt;/p&gt;

&lt;p&gt;Every paid course has a free preview lesson and a 14-day money-back guarantee, so you can try it without risk.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://talkingabouttesting.school" rel="noopener noreferrer"&gt;Come learn with us at the TAT School!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Until next time, and happy testing! 👋&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>testing</category>
      <category>getbyrole</category>
      <category>a11y</category>
    </item>
    <item>
      <title>Mocking the Gap: How to Load Test Unfinished APIs with Cypress and k6</title>
      <dc:creator>cuongld2</dc:creator>
      <pubDate>Wed, 04 Nov 2026 02:43:02 +0000</pubDate>
      <link>https://dev.to/cypress/mocking-the-gap-how-to-load-test-unfinished-apis-with-cypress-and-k6-5770</link>
      <guid>https://dev.to/cypress/mocking-the-gap-how-to-load-test-unfinished-apis-with-cypress-and-k6-5770</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;ℹ️ &lt;strong&gt;Note:&lt;/strong&gt; Cypress is designed for functional end-to-end testing, not high-volume load testing. However, it is the perfect tool for simulating user behavior to discover and record the exact API sequences your load tests need.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We all know that we should strive for &lt;strong&gt;shift-left testing&lt;/strong&gt; to get fast feedback about application quality and catch bugs early. &lt;/p&gt;

&lt;p&gt;However, load testing often hits a wall: &lt;strong&gt;What do you do when some APIs involved in a critical user journey aren't ready yet?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Waiting for an environment to be 100% complete before running performance tests delays feedback and pushes critical bottleneck discoveries right up against deadlines. &lt;/p&gt;

&lt;p&gt;In this guide, we'll walk through how to &lt;strong&gt;shift-left your performance strategy&lt;/strong&gt; using Cypress to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Stub missing APIs&lt;/strong&gt; using &lt;code&gt;cy.intercept&lt;/code&gt; so the UI flow isn't blocked.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observe and capture&lt;/strong&gt; the sequence of real backend API calls.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Map that blueprint&lt;/strong&gt; directly into a &lt;strong&gt;k6&lt;/strong&gt; script to test performance early.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The Scenario: A Blocked User Journey
&lt;/h2&gt;

&lt;p&gt;Let's say we have an application that allows users to manage their books (create, edit, or delete).&lt;/p&gt;

&lt;p&gt;To verify the application can handle expected traffic spikes, we want to run a load test simulating a user creating a new book.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[UI: Add Book Page] 
       │
       ├──&amp;gt; GET /genres       &amp;lt;-- ❌ Unfinished / 500 Error (Blocks UI dropdown)
       │
       └──&amp;gt; POST /api/books   &amp;lt;-- ✅ Ready for performance testing!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The Blocker:&lt;/strong&gt; Creating a book requires selecting a &lt;strong&gt;Genre&lt;/strong&gt; from a dropdown. But the &lt;code&gt;/genres&lt;/code&gt; API isn't finished or deployed yet. Without genre options, the frontend validation blocks the form submission, preventing us from reaching and testing the &lt;code&gt;POST /api/books&lt;/code&gt; endpoint.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Mental Model: Cypress as the Observer
&lt;/h2&gt;

&lt;p&gt;Before diving into the code, keep this model in mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cypress is the Observer / Architect:&lt;/strong&gt; It lives inside the browser, mocks what is broken or missing, navigates through the user actions, and captures the exact network blueprint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;k6 is the Builder / Engine:&lt;/strong&gt; It takes that blueprint and simulates high-concurrency workloads against your backend.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 1: Unblock the Flow with &lt;code&gt;cy.intercept&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Instead of waiting sprints for the &lt;code&gt;/genres&lt;/code&gt; endpoint to be ready, we can stub it directly in Cypress:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// cypress/e2e/load-test-prep.cy.js&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mockGenres&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Classic&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Science Fiction&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Fantasy&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;completes the book creation flow to capture API traffic&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// 1. Stub the missing API with pre-defined response data&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;intercept&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;**/genres&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mockGenres&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;as&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;getGenres&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// 2. Perform user actions in the UI&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/add-book&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#title&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;The Great Gatsby&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#author&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;F. Scott Fitzgerald&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#genre-select&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Classic&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#submit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;// The flow is unblocked and reaches the real backend endpoints!&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 2: Capture the Network Blueprint
&lt;/h2&gt;

&lt;p&gt;To automatically record every API call triggered during this flow, we can set up a global interceptor that logs requests and outputs an &lt;code&gt;api-sequence.json&lt;/code&gt; artifact:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// cypress/e2e/record-apis.cy.ts&lt;/span&gt;

&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;ApiRequestInfo&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;requestHeaders&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;requestBody&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;responseStatusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;allApiRequests&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ApiRequestInfo&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

&lt;span class="nf"&gt;beforeEach&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;intercept&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;**&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Only capture target backend service calls&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://localhost:3001/api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="na"&gt;requestData&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ApiRequestInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;requestHeaders&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt; &lt;span class="kd"&gt;as &lt;/span&gt;&lt;span class="nb"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;requestBody&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;responseStatusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="nx"&gt;allApiRequests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;requestData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reply&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;allApiRequests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;responseStatusCode&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
      &lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;responseStatusCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nf"&gt;after&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cypress/fixtures/api-sequence.json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;allApiRequests&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Output Blueprint (&lt;code&gt;api-sequence.json&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Once Cypress completes the run, you get a clean record containing the exact request payloads, headers, and sequence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http://localhost:3001/api/books"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"POST"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"requestHeaders"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"content-type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"application/json"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"requestBody"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The Great Gatsby"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"author"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"F. Scott Fitzgerald"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"publishedYear"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1925&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"genreTypeId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"A classic American novel set in the Jazz Age."&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"responseStatusCode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http://localhost:3001/api/books"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"GET"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"requestHeaders"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"accept"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*/*"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"requestBody"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"responseStatusCode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 3: Translate into a k6 Performance Script
&lt;/h2&gt;

&lt;p&gt;With the endpoints, parameters, and flow captured, you can now write a realistic k6 script.&lt;/p&gt;

&lt;p&gt;Here is an example running a &lt;strong&gt;ramping VUs scenario&lt;/strong&gt; targeting 10 concurrent users with response time thresholds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// book-scenario.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;k6/http&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;check&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sleep&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;k6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Trend&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Rate&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;k6/metrics&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getBooksDuration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Trend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;get_books_duration&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;createBookDuration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Trend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;create_book_duration&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;errorRate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Rate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;errors&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;API_BASE_URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://localhost:3001/api&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;THINK_TIME&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;scenarios&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;smoke&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;executor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;per-vu-iterations&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;vus&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;iterations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;maxDuration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;30s&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;load&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;executor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ramping-vus&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;startVUs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;stages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;30s&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1m&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;30s&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="na"&gt;gracefulRampDown&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;10s&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;thresholds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;http_req_duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;p(95)&amp;lt;500&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rate&amp;lt;0.1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// 1. Initial list lookup&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getBooksRes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;API_BASE_URL&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/books`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GetBooks&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;getBooksDuration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;getBooksRes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;timings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getBooksOk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;getBooksRes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET /books - status is 200&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;errorRate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;getBooksOk&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;THINK_TIME&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// 2. Create Book (Payload recorded from Cypress blueprint)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;The Great Gatsby&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;F. Scott Fitzgerald&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;publishedYear&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1925&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;genreTypeId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;A classic American novel set in the Jazz Age.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;createBookRes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;API_BASE_URL&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/books`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;CreateBook&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;createBookDuration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createBookRes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;timings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;createBookOk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createBookRes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST /books - status is 201&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST /books - has id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;errorRate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createBookOk&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// 3. Verify created book appears in list&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createBookOk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;THINK_TIME&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;verifyRes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;API_BASE_URL&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/books`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;VerifyBooks&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;verifyOk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;verifyRes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET /books after create - status is 200&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="nx"&gt;errorRate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;verifyOk&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 4: Run and Analyze Results Early
&lt;/h2&gt;

&lt;p&gt;Execute your test using the k6 CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;k6 run book-scenario.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Early Insights
&lt;/h3&gt;

&lt;p&gt;By testing the ready APIs early, we get instant visibility:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the &lt;code&gt;POST /books&lt;/code&gt; duration spikes to 450ms while &lt;code&gt;GET&lt;/code&gt; requests stay under 20ms, we immediately know where our database or indexing bottlenecks lie.&lt;/li&gt;
&lt;li&gt;We identify and fix these latency issues &lt;strong&gt;weeks before&lt;/strong&gt; the &lt;code&gt;/genres&lt;/code&gt; service is even finished.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Don't let incomplete environments stall your performance testing.&lt;/p&gt;

&lt;p&gt;By using &lt;strong&gt;Cypress as an observer&lt;/strong&gt;, you can stub the missing dependencies, unblock the user journey, record the exact network traffic, and hand off an accurate blueprint to &lt;strong&gt;k6&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Shift-left performance testing isn't just about speed—it builds a continuous feedback loop where performance verification becomes a regular part of the development lifecycle rather than a last-minute panic before launch.&lt;/p&gt;

&lt;p&gt;Happy testing! 🚀&lt;/p&gt;

</description>
      <category>performance</category>
      <category>testing</category>
      <category>cypress</category>
      <category>k6</category>
    </item>
    <item>
      <title>How to choose the right Cypress plugins for your project</title>
      <dc:creator>Jennifer Shehane</dc:creator>
      <pubDate>Mon, 02 Nov 2026 16:41:49 +0000</pubDate>
      <link>https://dev.to/cypress/how-to-choose-the-right-cypress-plugins-for-your-project-3e3p</link>
      <guid>https://dev.to/cypress/how-to-choose-the-right-cypress-plugins-for-your-project-3e3p</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr956m61yolsc1lveyle4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr956m61yolsc1lveyle4.png" alt="How to choose Cypress plugins" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You need your tests to do something Cypress doesn’t do on its own, such as waiting for a sign-up email or comparing a screenshot against an approved baseline. A search turns up several plugins that claim to handle it, and integrating the plugin only takes a few minutes. Finding out you integrated the wrong one takes longer, because the problems rarely show up on the day you install it. They show up when a CI job ignores your tag filter and runs the whole suite, or when the plugin blocks your next Cypress upgrade, or when Cypress runs slower until you disable that one plugin.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Integrating a plugin only takes a few minutes. Finding out you integrated the wrong one takes longer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A &lt;strong&gt;Cypress plugin&lt;/strong&gt; is a package that adds functionality to your Cypress test suite: custom commands, a preprocessor, visual or accessibility checks, a CI integration, or a reporter. Most are npm packages that you install and update separately from Cypress, so each one is a dependency your team maintains. Cypress doesn’t formally review vendor or community plugins, so you decide what goes into your suite.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://on.cypress.io/plugins-list?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Cypress%20plugin%20directory&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;Cypress plugin directory&lt;/a&gt; helps with that choice. It groups official, vendor, and community plugins by where they fit in your test suite, and each card shows who maintains the plugin, when it last published, and which Cypress versions it declares support for. Those signals, plus a few questions about your own project, tell you whether a plugin belongs in your suite before you install it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fies5tzxibl6d5oo0njmx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fies5tzxibl6d5oo0njmx.png" alt="Cypress Plugins directory on the Cypress documentation showing a description, search, category filter, maintained by filter, and sort by." width="799" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not every entry in the directory is an npm plugin. Its AI tooling category lists &lt;a href="https://on.cypress.io/ai-skills?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Cypress%20AI%20Skills&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;Cypress AI Skills&lt;/a&gt;, which help AI coding assistants write, explain, and fix Cypress tests, and the &lt;a href="https://on.cypress.io/cloud-mcp?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Cloud%20MCP&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;Cloud MCP&lt;/a&gt; server, which gives those assistants your Cypress Cloud test data. The directory also lists CI integrations such as the CircleCI orb, the Cypress GitHub Action, Docker images, editor extensions, and Cypress Cloud features. Each of these sets up in its own way, so follow its linked docs. The npm-specific advice in this post, such as peer ranges and &lt;code&gt;setupNodeEvents&lt;/code&gt;, applies to the npm packages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with where a Cypress plugin fits in your test suite
&lt;/h2&gt;

&lt;p&gt;The directory sorts its categories into five stages. The stage tells you what a plugin touches once it’s installed.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;Directory categories&lt;/th&gt;
&lt;th&gt;What plugins in this stage change&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Set up&lt;/td&gt;
&lt;td&gt;App framework integrations, Component testing, Preprocessors&lt;/td&gt;
&lt;td&gt;How Cypress is configured to your project and how specs are bundled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Write&lt;/td&gt;
&lt;td&gt;AI tooling, Custom commands, Developer tooling, Test data &amp;amp; fixtures, User interactions&lt;/td&gt;
&lt;td&gt;The code in your specs and support file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Run&lt;/td&gt;
&lt;td&gt;Authentication &amp;amp; security, Databases &amp;amp; storage, Email &amp;amp; SMS, Network &amp;amp; API testing, Test selection &amp;amp; execution&lt;/td&gt;
&lt;td&gt;What a test can reach while it runs, and which tests run&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Check&lt;/td&gt;
&lt;td&gt;Accessibility, Performance, Visual testing&lt;/td&gt;
&lt;td&gt;What a test checks beyond functional behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Report &amp;amp; ship&lt;/td&gt;
&lt;td&gt;Continuous integration &amp;amp; parallelization, Coverage &amp;amp; reporting&lt;/td&gt;
&lt;td&gt;Your CI pipeline and the reports your team reads&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The stage also hints at what a plugin costs to remove later. A reporter usually lives in one place, so replacing it is a configuration change. A plugin that adds commands, like a drag-and-drop helper or an inbox command for email tests, spreads into every spec that calls those commands, and replacing it means editing each of those specs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check whether Cypress already does what you need
&lt;/h2&gt;

&lt;p&gt;Several jobs that once called for a plugin are now built into Cypress, and some official entries in the directory already ship inside the &lt;code&gt;cypress&lt;/code&gt; package.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;If you need to&lt;/th&gt;
&lt;th&gt;Cypress already includes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Press Tab and other single keys as native keyboard events&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://on.cypress.io/press?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=cy.press%28%29&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;&lt;code&gt;cy.press()&lt;/code&gt;&lt;/a&gt;, added in Cypress 14.3.0 for Tab and extended to other keys in 15.1.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Find elements by ARIA role and accessible name&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://on.cypress.io/getbyrole?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=cy.getByRole%28%29&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;&lt;code&gt;cy.getByRole()&lt;/code&gt;&lt;/a&gt;, added in Cypress 16.2.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Log in once and reuse the session across tests&lt;/td&gt;
&lt;td&gt;&lt;a href="https://on.cypress.io/session?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=cy.session%28%29&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;&lt;code&gt;cy.session()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stub network responses or call an API directly&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://on.cypress.io/intercept?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=cy.intercept%28%29&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;&lt;code&gt;cy.intercept()&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://on.cypress.io/request?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=cy.request%28%29&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;&lt;code&gt;cy.request()&lt;/code&gt;&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Re-run failed tests automatically&lt;/td&gt;
&lt;td&gt;&lt;a href="https://on.cypress.io/test-retries?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Test%20retries&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;Test retries&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mount React, Vue, Angular, or Svelte components&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;cypress/react&lt;/code&gt;, &lt;code&gt;cypress/vue&lt;/code&gt;, &lt;code&gt;cypress/angular&lt;/code&gt;, and &lt;code&gt;cypress/svelte&lt;/code&gt;, plus the &lt;a href="https://on.cypress.io/component-framework-configuration?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=built-in%20Vite%20and%20webpack%20dev%20servers&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;built-in Vite and webpack dev servers&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A plugin is still the right choice when it does something Cypress doesn’t, such as sending screenshots to a visual review service or creating a disposable inbox for each test run.&lt;/p&gt;

&lt;p&gt;If you record your runs to Cypress Cloud, some plugins in the directory do work that you already get with your account.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;If you need to&lt;/th&gt;
&lt;th&gt;Cypress Cloud includes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Split specs across CI machines&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://on.cypress.io/parallelization?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Parallelization&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;Parallelization&lt;/a&gt; with load balancing, which assigns specs by their recorded durations so you don’t maintain spec lists&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stop a run after the first failure&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://on.cypress.io/auto-cancellation?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Auto%20Cancellation&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;Auto Cancellation&lt;/a&gt;, which cancels the whole run across every machine once failures reach a threshold you set&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Re-run only what failed&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://on.cypress.io/rerun-optimization?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Re-run%20optimization&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;Re-run optimization&lt;/a&gt;, which skips the specs or tests that already passed when you re-run a failed CI job, and &lt;a href="https://on.cypress.io/spec-prioritization?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Spec%20Prioritization&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;Spec Prioritization&lt;/a&gt;, which runs the previously failed specs first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Capture browser console logs or network traffic to debug CI failures&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://on.cypress.io/test-replay?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Test%20Replay&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;Test Replay&lt;/a&gt;, which records the DOM, network requests, and console logs of each test in CI so you can replay a failure&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Read the signals on each Cypress plugin card
&lt;/h2&gt;

&lt;p&gt;Each card pairs a maintainer label with signals from npm. Hover over or focus a card to see the Cypress app version range it supports, and use the “Maintained by” filter to narrow the list to official, vendor, or community plugins.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuxwl56dmovrilbrobsru.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuxwl56dmovrilbrobsru.png" alt="Reading a Cypress plugin card - check the maintainer, last npm release, npm package and version, and Cypress version range" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Signal on the card&lt;/th&gt;
&lt;th&gt;What it tells you&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Built by Cypress&lt;/td&gt;
&lt;td&gt;An official plugin that the Cypress team owns and maintains&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Built by &lt;em&gt;company&lt;/em&gt;
&lt;/td&gt;
&lt;td&gt;A vendor plugin, owned by the company behind the product it connects to&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Community · &lt;em&gt;name&lt;/em&gt;
&lt;/td&gt;
&lt;td&gt;An independent author, usually the owner of the plugin’s repository&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Updated date and npm version&lt;/td&gt;
&lt;td&gt;The latest release the directory has recorded, and when it was published to npm&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cypress version range&lt;/td&gt;
&lt;td&gt;The Cypress versions the package names as supported&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deprecated&lt;/td&gt;
&lt;td&gt;The npm package was unpublished or marked deprecated, or its repository was archived&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;To check a Cypress plugin’s peer range, ask npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm view @cypress/grep peerDependencies.cypress
# &amp;gt;=15.10.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the command prints nothing, the plugin doesn’t declare a Cypress peer version range.&lt;/p&gt;

&lt;p&gt;A recent publish date shows that someone is working on the plugin, but an older date isn’t automatically a problem. A small plugin that does one job may not need frequent releases. What matters more is whether its range includes the Cypress version you run, and how its maintainers respond to issues.&lt;/p&gt;

&lt;p&gt;To have a Cypress plugin included in the directory, Cypress maintainers ask plugin authors for tests around the functionality, clear documentation, and support for at least the latest Cypress version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Questions to answer before you install a Cypress plugin
&lt;/h2&gt;

&lt;p&gt;The card tells you about the plugin. These questions are about your project, and the plugin’s README usually answers them.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Does its range include the Cypress version you run&lt;/strong&gt; , and the next major version you plan to move to? A plugin that supports only your current major can hold back your next upgrade.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does it support every testing type you use?&lt;/strong&gt; End-to-end and component tests each have their own support file and their own &lt;code&gt;setupNodeEvents&lt;/code&gt;, and some plugins document only one of them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does it run in every browser you test in?&lt;/strong&gt; Plugins built on the Chrome DevTools Protocol (CDP), the automation interface that Chromium-based browsers expose, run only in those browsers, such as Chrome, Chromium, and Edge. The &lt;a href="https://github.com/dmtrKovalenko/cypress-real-events?ref=cypress-io.ghost.io" rel="noopener noreferrer"&gt;&lt;code&gt;cypress-real-events&lt;/code&gt; README&lt;/a&gt;, for example, notes that Firefox isn’t supported.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What will it do with your data?&lt;/strong&gt; Code in &lt;code&gt;setupNodeEvents&lt;/code&gt; runs in Node with access to your file system, network, and environment variables. Plugins that connect to a hosted service, such as a visual review platform, send test artifacts like screenshots or page snapshots to that service, so check that against your data-handling requirements. Keep any sensitive credentials the plugin needs in &lt;code&gt;env&lt;/code&gt;, which stays in the Node process and which tests read with &lt;a href="https://on.cypress.io/env?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=cy.env%28%29&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;&lt;code&gt;cy.env()&lt;/code&gt;&lt;/a&gt;, rather than in &lt;a href="https://on.cypress.io/expose?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Cypress.expose%28%29&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;&lt;code&gt;Cypress.expose()&lt;/code&gt;&lt;/a&gt; values, which are readable in the browser.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who on your team will own it?&lt;/strong&gt; Someone needs to read its release notes and test it before each Cypress upgrade. Name that person before you install.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Run Cypress plugins through your standard security review
&lt;/h2&gt;

&lt;p&gt;A Cypress plugin is third-party code that runs in your pipeline, so send it through the same security review as any other dependency. Being listed in the directory isn’t a security review, and installing a plugin as a dev dependency doesn’t limit what it can reach.&lt;/p&gt;

&lt;p&gt;Keep the review in force after the plugin is in your suite:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scan dev dependencies. When &lt;code&gt;npm audit&lt;/code&gt; runs with &lt;code&gt;--omit=dev&lt;/code&gt;, or with &lt;code&gt;NODE_ENV=production&lt;/code&gt; set, npm leaves dev dependencies out of the report, and your Cypress plugins with them.&lt;/li&gt;
&lt;li&gt;Install from your lockfile in CI with &lt;code&gt;npm ci&lt;/code&gt;, so the versions that passed review are the versions that run.&lt;/li&gt;
&lt;li&gt;Give the Cypress job only the secrets it needs, and run tests with test accounts and non-production data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to integrate a Cypress plugin, step by step
&lt;/h2&gt;

&lt;p&gt;Installing a plugin isn’t enough on its own. You also need to register it with Cypress, in one or two places, depending on where its code needs to run:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Register code that runs in Node in &lt;a href="https://on.cypress.io/setup-node-events?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=setupNodeEvents&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;&lt;code&gt;setupNodeEvents&lt;/code&gt;&lt;/a&gt; in your Cypress configuration. That covers preprocessors, browser launch handling, tasks, and anything that touches the file system or test results.&lt;/li&gt;
&lt;li&gt;Register code that runs in the browser alongside your tests and your application in your &lt;a href="https://on.cypress.io/support-file?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=support%20file&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;support file&lt;/a&gt;. That covers custom commands, assertion libraries, and overrides of built-in behavior. The support file loads before every spec: &lt;code&gt;cypress/support/e2e.js&lt;/code&gt; for end-to-end tests and &lt;code&gt;cypress/support/component.js&lt;/code&gt; for component tests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg685b5n23leav5t7kbuw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg685b5n23leav5t7kbuw.png" alt="Node versus Browser code - cypress.config.js runs setupNodeEvents with plugin tasks and events. The Browser runs the support file with plugin commands and assertions. They are connected via cy.task()." width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Plugins with code on both sides need both registrations. The steps below use &lt;a href="https://github.com/cypress-io/cypress/tree/develop/npm/grep?ref=cypress-io.ghost.io" rel="noopener noreferrer"&gt;&lt;code&gt;@cypress/grep&lt;/code&gt;&lt;/a&gt;, an official plugin that filters tests by title or tag and registers in both places.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Check the plugin’s README and Cypress range
&lt;/h3&gt;

&lt;p&gt;Read the README for its registration steps, and confirm the declared range includes the Cypress version you run. &lt;code&gt;@cypress/grep&lt;/code&gt; 7.0.0 declares &lt;code&gt;&amp;gt;=15.10.0&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Install a Cypress plugin as a dev dependency
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install --save-dev @cypress/grep
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://on.cypress.io/plugins-guide?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Use%20plugins%20guide&amp;amp;utm_campaign=plugin-directory-blog#Installing-a-plugin" rel="noopener noreferrer"&gt;Use plugins guide&lt;/a&gt; has the equivalent Yarn, pnpm, and Bun commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Register the Node side in &lt;code&gt;setupNodeEvents&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Call the plugin’s setup function inside &lt;code&gt;setupNodeEvents&lt;/code&gt;, then return &lt;code&gt;config&lt;/code&gt; so any changes the plugin makes take effect. For &lt;code&gt;@cypress/grep&lt;/code&gt;, the Node side is optional: it skips spec files with no matching tests when you pass &lt;code&gt;grepFilterSpecs=true&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// cypress.config.js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'cypress'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;plugin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;cypressGrepPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@cypress/grep/plugin'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;e2e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setupNodeEvents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;on&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nf"&gt;cypressGrepPlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

      &lt;span class="c1"&gt;// Return config so the plugin's changes take effect&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you also run component tests, register the plugin in &lt;code&gt;component.setupNodeEvents&lt;/code&gt; too.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Register the browser side in the support file
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// cypress/support/e2e.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;register&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;registerCypressGrep&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@cypress/grep'&lt;/span&gt;

&lt;span class="nf"&gt;registerCypressGrep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For component tests, add the same lines to &lt;code&gt;cypress/support/component.js&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Add a Cypress plugin’s TypeScript types
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;@cypress/grep&lt;/code&gt; ships its own type definitions, which TypeScript usually detects. Plugins that add commands often ask you to list their package in the &lt;code&gt;types&lt;/code&gt; array of your Cypress &lt;code&gt;tsconfig.json&lt;/code&gt;, next to &lt;code&gt;cypress&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"types"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"cypress"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"@cypress/grep"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 6: Verify a Cypress plugin locally, then in CI
&lt;/h3&gt;

&lt;p&gt;Run a filtered set of tests from the command line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx cypress run --expose &lt;span class="nv"&gt;grep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"login"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only tests with “login” in their title run, and the rest show as pending. If you use &lt;code&gt;cypress open&lt;/code&gt;, restart it after changing your configuration file. Then run the same command in CI, in every browser your pipeline uses, since several of the gotchas below appear only in CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Cypress plugin gotchas and how to fix them
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Only half of a Cypress plugin is registered
&lt;/h3&gt;

&lt;p&gt;A plugin with code on both sides fails in a different way depending on which half is missing. A plugin registered only for end-to-end tests is also missing from component tests.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What you see&lt;/th&gt;
&lt;th&gt;Cause&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TypeError: cy.get(...).realClick is not a function&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The support file for the testing type you’re running doesn’t import the plugin&lt;/td&gt;
&lt;td&gt;Import the plugin in &lt;code&gt;cypress/support/e2e.js&lt;/code&gt;, &lt;code&gt;cypress/support/component.js&lt;/code&gt;, or both&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;The task '&amp;lt;task name&amp;gt;' was not handled in the setupNodeEvents method&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;setupNodeEvents&lt;/code&gt; for the testing type you’re running doesn’t register the plugin&lt;/td&gt;
&lt;td&gt;Register the plugin in &lt;code&gt;e2e.setupNodeEvents&lt;/code&gt;, &lt;code&gt;component.setupNodeEvents&lt;/code&gt;, or both, then restart Cypress&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;cy is not defined&lt;/code&gt; inside &lt;code&gt;setupNodeEvents&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Browser code is registered in &lt;code&gt;setupNodeEvents&lt;/code&gt;, which runs in Node&lt;/td&gt;
&lt;td&gt;Move that registration to your support file&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Cypress plugin settings are lost without &lt;code&gt;return config&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Many plugins pass settings to their browser code by modifying the &lt;code&gt;config&lt;/code&gt; object. If &lt;code&gt;setupNodeEvents&lt;/code&gt; doesn’t return that object, Cypress discards the changes without an error. &lt;a href="https://github.com/cypress-io/code-coverage?ref=cypress-io.ghost.io" rel="noopener noreferrer"&gt;&lt;code&gt;@cypress/code-coverage&lt;/code&gt;&lt;/a&gt;, for example, sets a flag in &lt;code&gt;config&lt;/code&gt; to tell its support file that its tasks are registered. Without &lt;code&gt;return config&lt;/code&gt;, the flag never reaches the browser, so the support file logs &lt;code&gt;Code coverage tasks were not registered by the plugins file&lt;/code&gt;, skips collecting coverage, and the run still passes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;setupNodeEvents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;on&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@cypress/code-coverage/task'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;on&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="c1"&gt;// Without this line, the run collects no coverage&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a plugin’s setup function returns a promise, make &lt;code&gt;setupNodeEvents&lt;/code&gt; &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;await&lt;/code&gt; the setup call before you return &lt;code&gt;config&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  A plugin ignores &lt;code&gt;CYPRESS_*&lt;/code&gt; environment variables in CI
&lt;/h3&gt;

&lt;p&gt;Cypress 15.10.0 introduced &lt;a href="https://on.cypress.io/expose?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Cypress.expose%28%29&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;&lt;code&gt;Cypress.expose()&lt;/code&gt;&lt;/a&gt; for non-sensitive values that tests read in the browser, along with &lt;a href="https://on.cypress.io/env?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=cy.env%28%29&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;&lt;code&gt;cy.env()&lt;/code&gt;&lt;/a&gt; for sensitive ones, and Cypress 16 removed &lt;code&gt;Cypress.env()&lt;/code&gt;. Many plugins updated for these APIs, including &lt;code&gt;@cypress/grep&lt;/code&gt;, read their options from &lt;code&gt;expose&lt;/code&gt;. &lt;code&gt;CYPRESS_*&lt;/code&gt; environment variables populate &lt;code&gt;env&lt;/code&gt; only, so a plugin that reads &lt;code&gt;expose&lt;/code&gt; never sees them, and nothing errors. With &lt;code&gt;@cypress/grep&lt;/code&gt;, a &lt;code&gt;CYPRESS_grepTags&lt;/code&gt; variable set in CI is ignored, and the run includes every test.&lt;/p&gt;

&lt;p&gt;Pass plugin options with &lt;code&gt;--expose&lt;/code&gt; instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx cypress run --expose &lt;span class="nv"&gt;grepTags&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"@smoke"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your CI has to keep setting &lt;code&gt;CYPRESS_*&lt;/code&gt; variables, copy each key into &lt;code&gt;config.expose&lt;/code&gt; before you register the plugin that reads it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;setupNodeEvents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;on&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Copy CI values from env into expose before the plugin reads them&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;grepTags&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;expose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;grepTags&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;grepTags&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;cypressGrepPlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://on.cypress.io/migration-guide?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=migration%20guide%20covers%20this%20pattern&amp;amp;utm_campaign=plugin-directory-blog#Via-CYPRESS_-environment-variables-in-CI" rel="noopener noreferrer"&gt;migration guide covers this pattern&lt;/a&gt; in more detail.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;npm install&lt;/code&gt; fails with &lt;code&gt;ERESOLVE&lt;/code&gt; after a Cypress upgrade
&lt;/h3&gt;

&lt;p&gt;npm 7 and later checks peer dependencies when you install. If a plugin’s &lt;code&gt;peerDependencies&lt;/code&gt; range stops at an earlier major, installing a newer Cypress next to it fails:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error Found: cypress@16.2.0
npm error Could not resolve dependency:
npm error peer cypress@"^10 || ^11 || ^12 || ^13 || ^14 || ^15" from &amp;lt;plugin&amp;gt;@&amp;lt;version&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update the plugin to a version whose range includes the new major. If no such version exists yet, keep Cypress on its current major until one ships, and check the plugin’s repository for an issue that tracks support.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Cypress plugin works in Chrome but fails in Firefox
&lt;/h3&gt;

&lt;p&gt;Plugins built on CDP can’t run outside Chromium-based browsers. If your pipeline also runs Firefox or WebKit, limit the tests that use those plugins to Chromium with the &lt;code&gt;browser&lt;/code&gt; test configuration option, as shown in &lt;a href="https://on.cypress.io/cross-browser-testing?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=running%20specific%20tests%20by%20browser&amp;amp;utm_campaign=plugin-directory-blog#Running-Specific-Tests-by-Browser" rel="noopener noreferrer"&gt;running specific tests by browser&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'product card hover states'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'chromium'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'shows the quick-add button on hover'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/products'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'[data-cy=product-card]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;realHover&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'[data-cy=quick-add]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'be.visible'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cypress skips these tests in other browsers, so keep at least one Chromium-based browser in your CI matrix.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Cypress plugin slows down every spec in your suite
&lt;/h3&gt;

&lt;p&gt;Cypress bundles your support file before each spec, so everything it imports adds startup time to every spec in the run. A plugin imported there is paid for on every spec, even in specs that never call its commands. A plugin can also pull Node-only modules, such as a database driver, into the browser bundle, which adds polyfills or breaks the build. The &lt;a href="https://on.cypress.io/test-performance?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=test%20performance%20guide%20shows%20how%20to%20keep%20support%20files%20lean&amp;amp;utm_campaign=plugin-directory-blog#Keep-support-and-spec-imports-lean" rel="noopener noreferrer"&gt;test performance guide shows how to keep support files lean&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To find a slow plugin, comment out its registration in the support file and &lt;code&gt;setupNodeEvents&lt;/code&gt;, then compare the run’s duration with and without it. To fix one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Move Node-only work into &lt;code&gt;cy.task()&lt;/code&gt;, so it runs in &lt;code&gt;setupNodeEvents&lt;/code&gt; instead of in the browser bundle.&lt;/li&gt;
&lt;li&gt;Use the plugin’s own performance options. Without &lt;code&gt;grepFilterSpecs&lt;/code&gt;, &lt;code&gt;@cypress/grep&lt;/code&gt; compiles every spec before it filters, even specs with no matching tests.&lt;/li&gt;
&lt;li&gt;If a plugin only adds commands that a few specs use, import it in those specs instead of in the support file. Cypress bundles each spec separately, so specs that don’t import it skip its cost. Keep plugins that register global hooks, such as code coverage or test filtering, in the support file, because they need to run for every spec.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the slowdown comes from the plugin itself, open an issue on its repository so the maintainer can fix it for every team that uses it. Include your Cypress and plugin versions, run times with and without the plugin, and a minimal reproduction.&lt;/p&gt;

&lt;h3&gt;
  
  
  TypeScript can’t find a Cypress plugin’s commands
&lt;/h3&gt;

&lt;p&gt;Many plugins that add commands ship type definitions for them, but TypeScript uses those definitions only once your project includes them. Until then, the compiler reports an error like this one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error TS2339: Property 'realClick' does not exist on type 'Chainable&amp;lt;JQuery&amp;lt;HTMLElement&amp;gt;&amp;gt;'.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the package to the &lt;code&gt;types&lt;/code&gt; array in your Cypress &lt;code&gt;tsconfig.json&lt;/code&gt;, as in Step 5.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep Cypress plugins working through upgrades
&lt;/h2&gt;

&lt;p&gt;A Cypress upgrade is when a plugin’s declared range and your installed version are most likely to drift apart. Cypress 16 is a recent example: it removed &lt;code&gt;Cypress.env()&lt;/code&gt;, so plugins that still call it throw errors. The &lt;a href="https://on.cypress.io/migration-guide?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=migration%20guide%20lists%20the%20plugin%20versions%20that%20moved%20to%20the%20new%20APIs&amp;amp;utm_campaign=plugin-directory-blog#Migrate-plugins-that-use-Cypressenv" rel="noopener noreferrer"&gt;migration guide lists the plugin versions that moved to the new APIs&lt;/a&gt;, with the configuration change each one needs.&lt;/p&gt;

&lt;p&gt;Before each upgrade:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Compare each plugin’s declared range with the version you’re moving to, on its directory card or with &lt;code&gt;npm view &amp;lt;package&amp;gt; peerDependencies.cypress&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Read the migration guide and the &lt;a href="https://on.cypress.io/changelog?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=changelog&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;changelog&lt;/a&gt; for the new version. Search both for the plugins you use and for the APIs they call or overwrite. Cypress 16, for example, removed &lt;code&gt;cy.exec()&lt;/code&gt;, and &lt;code&gt;cy.getCookie()&lt;/code&gt; and the other cookie and storage getters no longer accept &lt;code&gt;Cypress.Commands.overwrite()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Update each plugin to a version that supports the Cypress version you’re moving to.&lt;/li&gt;
&lt;li&gt;Upgrade on a branch, and run the full suite in CI in every browser and testing type you use.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If a test fails after the upgrade, find out which side owns the problem before you report it. Comment out the plugin’s registration in &lt;code&gt;setupNodeEvents&lt;/code&gt; and the support file, then run the failing command or test again. If it still fails, the plugin isn’t the cause, so start with the &lt;a href="https://on.cypress.io/troubleshooting?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=troubleshooting%20guide&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;troubleshooting guide&lt;/a&gt;. If it passes, report the problem on the plugin’s repository with your Cypress version, the plugin version, and a minimal reproduction. A compatibility gap belongs to the plugin, even when a Cypress upgrade is what surfaced it. If the plugin uses a documented Cypress API that no longer behaves as documented, open a Cypress issue too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions about Cypress plugins
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Are Cypress plugins free, or do some cost money?
&lt;/h3&gt;

&lt;p&gt;The official npm packages from Cypress and most community plugins are free and open source. Vendor plugins connect to that vendor’s service, which usually needs an account and may have its own pricing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does Cypress review or support community plugins?
&lt;/h3&gt;

&lt;p&gt;No. We don’t officially review vendor or community plugins, and we can’t fix bugs in community plugins. If a problem happens only with a plugin registered, report it on that plugin’s repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I know whether a Cypress plugin supports my version?
&lt;/h3&gt;

&lt;p&gt;Run &lt;code&gt;npm view &amp;lt;package&amp;gt; peerDependencies.cypress&lt;/code&gt; to see the peer range on its own. A version that comes from &lt;code&gt;devDependencies&lt;/code&gt; is the one the plugin’s repository develops against, not a statement of which versions it supports.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do Cypress plugins work with component testing?
&lt;/h3&gt;

&lt;p&gt;Register them in &lt;code&gt;component.setupNodeEvents&lt;/code&gt; and &lt;code&gt;cypress/support/component.js&lt;/code&gt;, and check the README first, because some plugins document only end-to-end testing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do Cypress plugins work in Firefox and WebKit?
&lt;/h3&gt;

&lt;p&gt;Plugins built on the Chrome DevTools Protocol run only in Chromium-based browsers, such as Chrome, Chromium, and Edge. Check the README for a browser support section before you add a plugin to a cross-browser suite.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do Cypress plugins send test data to third parties?
&lt;/h3&gt;

&lt;p&gt;Plugins that connect to a hosted service do. A visual review plugin, for example, uploads screenshots or page snapshots to its service. Other plugins can, because code in &lt;code&gt;setupNodeEvents&lt;/code&gt; runs in Node with access to your file system, network, and environment variables, so read a plugin’s README and source before you give it credentials.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I write and list my own Cypress plugin?
&lt;/h3&gt;

&lt;p&gt;Start with the &lt;a href="https://on.cypress.io/plugins-api?utm_source=dev-to&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Node%20Events%20overview&amp;amp;utm_campaign=plugin-directory-blog" rel="noopener noreferrer"&gt;Node Events overview&lt;/a&gt;, which covers the events a plugin can register. To list your plugin, open a pull request that adds an entry to &lt;code&gt;src/data/plugins.json&lt;/code&gt; in the &lt;a href="https://github.com/cypress-io/cypress-documentation?ref=cypress-io.ghost.io" rel="noopener noreferrer"&gt;cypress-documentation repository&lt;/a&gt;. The &lt;a href="https://github.com/cypress-io/cypress-documentation/blob/main/CONTRIBUTING.md?ref=cypress-io.ghost.io#adding-plugins" rel="noopener noreferrer"&gt;contributing guide for plugins&lt;/a&gt; lists what a listed plugin should have, including integration tests with Cypress, clear documentation, and support for at least the latest Cypress major version.&lt;/p&gt;

&lt;p&gt;Spotted a card that’s out of date, or a plugin that belongs in the directory? &lt;a href="https://github.com/cypress-io/cypress-documentation/blob/main/CONTRIBUTING.md?ref=cypress-io.ghost.io#adding-plugins" rel="noopener noreferrer"&gt;Open a pull request or issue&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>plugins</category>
      <category>testing</category>
      <category>extension</category>
    </item>
    <item>
      <title>Why I Built Cypress Performance UI: A Simple Way to Measure Web Performance with Cypress</title>
      <dc:creator>Petros Plakogiannis</dc:creator>
      <pubDate>Wed, 28 Oct 2026 15:45:46 +0000</pubDate>
      <link>https://dev.to/cypress/why-i-built-cypress-performance-ui-a-simple-way-to-measure-web-performance-with-cypress-47h8</link>
      <guid>https://dev.to/cypress/why-i-built-cypress-performance-ui-a-simple-way-to-measure-web-performance-with-cypress-47h8</guid>
      <description>&lt;p&gt;I've been working with performance testing for many years, and one thing I've learned is that performance doesn't always have to be complicated.&lt;/p&gt;

&lt;p&gt;Sometimes, you just want to know how fast a page loads, how the browser behaves, and whether something has become slower after a change.&lt;/p&gt;

&lt;p&gt;That's what made me start working on cypress-performance-ui, an open-source Cypress plugin.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How It Started&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Over the years, I've used different tools and approaches for performance testing.&lt;/p&gt;

&lt;p&gt;Most of the time, the focus is on APIs, backend response times, or how a system behaves under load.&lt;/p&gt;

&lt;p&gt;But I also wanted something simple for the client side.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I wanted to answer questions like:&lt;/li&gt;
&lt;li&gt;How long does a page take to load?&lt;/li&gt;
&lt;li&gt;How quickly does the browser start receiving the response?&lt;/li&gt;
&lt;li&gt;When is the page content displayed?&lt;/li&gt;
&lt;li&gt;Is the page getting slower over time?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And most importantly, I wanted to check these things directly from my existing Cypress tests.&lt;/p&gt;

&lt;p&gt;I didn't want to set up a separate performance testing tool every time I needed a quick check.&lt;/p&gt;

&lt;p&gt;So I decided to build something myself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Meet Cypress Performance UI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;cypress-performance-ui&lt;/strong&gt; is a small, open-source plugin that lets you collect browser performance metrics directly inside Cypress.&lt;/p&gt;

&lt;p&gt;It uses the browser's native Performance API, so you don't need Lighthouse or another performance testing tool.&lt;/p&gt;

&lt;p&gt;You can measure things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Total page load time&lt;/li&gt;
&lt;li&gt;Time to First Byte (TTFB)&lt;/li&gt;
&lt;li&gt;First Contentful Paint (FCP)&lt;/li&gt;
&lt;li&gt;DOM Content Loaded&lt;/li&gt;
&lt;li&gt;Load Event timing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also save these measurements and view them in an HTML dashboard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting Started&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install the plugin:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install --save-dev cypress-performance-ui&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Register the plugin in your cypress.config.js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cypress&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;registerPerformancePlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cypress-performance-ui/plugin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;e2e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setupNodeEvents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nf"&gt;registerPerformancePlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then import the commands in cypress/support/e2e.js (or e2e.ts):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import "cypress-performance-ui";&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now you can collect performance data from your tests.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://www.google.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generatePerformanceReport&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cypress/performance/reports/performance-report.html&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Home page&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it!&lt;/p&gt;

&lt;p&gt;The plugin collects the page performance metrics, saves them in a JSON file, and generates an HTML report.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tracking Performance Over Time&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the things I wanted was to keep historical performance results.&lt;/p&gt;

&lt;p&gt;Measuring a page once is useful, but comparing it with previous runs is even more useful.&lt;/p&gt;

&lt;p&gt;For example, maybe your home page normally loads in around 400 ms.&lt;/p&gt;

&lt;p&gt;After a new release, it starts taking 700 ms.&lt;/p&gt;

&lt;p&gt;That's something you want to notice.&lt;/p&gt;

&lt;p&gt;With Cypress Performance UI, the measurements are saved in JSON, so you can track page load times across different test runs.&lt;/p&gt;

&lt;p&gt;The HTML dashboard also shows charts to help you understand how performance changes over time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzg4664shnl2gp73sljxr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzg4664shnl2gp73sljxr.png" alt=" " width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Historical Performance Baselines&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the latest version, I added a feature called &lt;strong&gt;Historical Performance Baselines.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The idea is simple: compare the current page load time with previous measurements.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://www.google.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assertPageLoadBaseline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Home page&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;percentile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;historyDays&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;minSamples&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;tolerance&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Cypress to:&lt;/p&gt;

&lt;p&gt;Look at the last 30 days of saved measurements for the Home page.&lt;/p&gt;

&lt;p&gt;Calculate the 75th percentile of the page load times.&lt;/p&gt;

&lt;p&gt;Allow an extra 10% as tolerance.&lt;/p&gt;

&lt;p&gt;Fail the test if the current page load time is above that limit.&lt;/p&gt;

&lt;p&gt;You need to collect enough historical measurements first. The baseline is calculated from saved results; it isn't created automatically by the assertion.&lt;/p&gt;

&lt;p&gt;I like this approach because I don't have to manually set a fixed limit for every page.&lt;/p&gt;

&lt;p&gt;The baseline can change as new measurements are added to the history.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PASS and FAIL Results in the Dashboard&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I also wanted to make the results easier to understand.&lt;/p&gt;

&lt;p&gt;So I added a table to the HTML dashboard showing the page name, historical baseline, actual page load time, date, and whether the test passed or failed.&lt;/p&gt;

&lt;p&gt;There's also a pie chart showing the PASS vs FAIL ratio.&lt;/p&gt;

&lt;p&gt;This makes it easier to see how the application is performing across different test runs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj5u0uacgvvhgurx4s90y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj5u0uacgvvhgurx4s90y.png" alt=" " width="799" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Network Requests: Going Beyond Page Load Time&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After working on page load metrics and historical baselines, I wanted to measure something else.&lt;/p&gt;

&lt;p&gt;What happens when a user clicks a button and the application makes an API request?&lt;/p&gt;

&lt;p&gt;A page might load quickly, but searching for data or loading a list of products could still be slow.&lt;/p&gt;

&lt;p&gt;That's why I added &lt;strong&gt;Network Requests tracking&lt;/strong&gt; in version 1.4.0.&lt;/p&gt;

&lt;p&gt;With a simple Cypress command, you can collect browser network requests and see how long they take.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://your-app.example&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;intercept&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;**/api/products*&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;as&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;products&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clearNetworkTimings&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#search-button&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;wait&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@products&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;collectNetworkMetrics&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Product Search&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;threshold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The HTML dashboard now includes a &lt;strong&gt;Network Requests&lt;/strong&gt; table showing the request URL, resource type, duration, and status.&lt;/p&gt;

&lt;p&gt;You can also filter requests by type:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;XHR, Fetch, Images, Scripts, CSS, Fonts, and Other.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This makes it easier to focus on API calls or find resources that are taking too long.&lt;/p&gt;

&lt;p&gt;Requests above the configured threshold are marked as &lt;strong&gt;SLOW&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I also added support for long URLs, so the table stays readable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flgrb2qevgmv43134fy0q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flgrb2qevgmv43134fy0q.png" alt=" " width="799" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For me, this is another useful step toward making client-side performance testing easier with Cypress.&lt;/p&gt;

&lt;p&gt;You can find the latest version, &lt;strong&gt;v1.4.1&lt;/strong&gt;, on GitHub and npm.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TypeScript Support&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The plugin also supports TypeScript.&lt;/p&gt;

&lt;p&gt;You can use the same Cypress commands in JavaScript or TypeScript projects, with autocomplete and type checking.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assertPageLoadBaseline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Home page&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;percentile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;tolerance&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No need to rewrite the plugin or use a different API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's Next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I still have ideas for improving the plugin.&lt;/p&gt;

&lt;p&gt;I'd like to keep improving the HTML dashboard, make the performance results easier to read, and explore more ways to use it in CI pipelines.&lt;/p&gt;

&lt;p&gt;The goal is not to replace tools like Lighthouse, JMeter, or other performance testing solutions.&lt;/p&gt;

&lt;p&gt;I just wanted something lightweight and easy to use when I need a quick look at client-side performance during my Cypress tests.&lt;/p&gt;

&lt;p&gt;And that's still the main idea behind this project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try It Out&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cypress Performance UI is open source, and I'd be happy to hear feedback, ideas, or suggestions from other QA engineers and developers.&lt;/p&gt;

&lt;p&gt;You can find it here:&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/pete2121/cypress-performance-ui" rel="noopener noreferrer"&gt;https://github.com/pete2121/cypress-performance-ui&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;npm: &lt;a href="https://www.npmjs.com/package/cypress-performance-ui" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/cypress-performance-ui&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's also listed in the official Cypress Plugin Directory as a community plugin.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

&lt;h1&gt;
  
  
  cypress #performance #testing #opensource
&lt;/h1&gt;

</description>
      <category>testing</category>
      <category>cypress</category>
      <category>performance</category>
    </item>
    <item>
      <title>CypressConf 2026: Answering the signal</title>
      <dc:creator>Melissa Milligan</dc:creator>
      <pubDate>Mon, 26 Oct 2026 16:25:16 +0000</pubDate>
      <link>https://dev.to/cypress/cypressconf-2026-answering-the-signal-41bg</link>
      <guid>https://dev.to/cypress/cypressconf-2026-answering-the-signal-41bg</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fivaz7i81crcwurbousbc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fivaz7i81crcwurbousbc.png" alt="Event Recap, CypressConf 2026 Answering the Signal" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CypressConf 2026 is a wrap! Thank you to everyone who joined us for three days of talks and hands-on workshops. This year’s theme, The Signal Is Up, asked a question every team knows well: how do you know a release is ready when the build is green? &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;From the founders: Quality in the era of the agentic SDLC&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In the founder session, Brian Mann, Founder of Cypress.io, and Jennifer Shehane, Co-founder and Head of Product, talked about using AI so teams spend more time building and less time cleaning up. Jennifer showed how recent releases like Cypress Tap, the Cloud CLI, Cloud MCP and Webhooks give agents the context to test and debug on their own.&lt;/p&gt;

&lt;p&gt;Brian looked at the road ahead. He estimated that most teams have handed only 5% to 20% of their work to agents so far, and that work needing judgment will be the hardest to hand off. For agents to do that work well they need access to your systems, an understanding of what your data means, and a way to tell whether they got it right. His closing point framed the whole conference. The job of software quality has always been deriving and validating intent: did we ship the thing we meant to ship? Agents change the form factor. They don't change the job. Brian has spent the past year exploring how teams can confirm that what they ship matches what they meant to build. Want to help shape it?&lt;a href="https://on.cypress.io/cyconf-dpp?ref=dev-to" rel="noopener noreferrer"&gt;&lt;u&gt;Join the design partner program&lt;/u&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Lessons from industry leaders&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Across the sessions, speakers kept coming back to the same idea: a signal is only useful if you can trust it. Here’s what we learned.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Green is not the goal&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A passing suite doesn’t always mean a release is safe, because coverage numbers and pass rates can hide shallow assertions and flaky tests. Judge your tests by whether they would catch a real bug and whether you’d trust them to make the release call, and keep checking critical paths after they ship.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Governing is the new writing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Agents can write tests in seconds, so more of the work now goes into reviewing what they produce. Give your agents clear written rules, keep each task small enough to review properly, and keep critical tests in version-controlled code that a person has checked.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Debugging at the speed of the signal&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most of the time spent on a failed run goes into working out whether it’s a real bug, a known flake or an environment problem. Give people and agents the full picture, including test history, Test Replay and error patterns, and rerun only the tests that failed.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Catch the sessions&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;All sessions will be published to the &lt;a href="https://www.youtube.com/playlist?list=PLPPb-bn9jZmI&amp;amp;utm_source=blog&amp;amp;utm_medium=cypress.io&amp;amp;utm_content=cypressconf2026" rel="noopener noreferrer"&gt;&lt;u&gt;Cypress YouTube channel&lt;/u&gt;&lt;/a&gt; in the coming weeks. In the meantime, put the Cypress AI features to work on your own runs and strengthen your signal. &lt;/p&gt;

&lt;p&gt;Thank you to our speakers and to everyone who kept the chat busy for three days. We can’t wait to see you next year!&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>codequality</category>
      <category>sdlc</category>
      <category>testing</category>
    </item>
    <item>
      <title>How to connect Claude Code to Cypress</title>
      <dc:creator>Jennifer Shehane</dc:creator>
      <pubDate>Thu, 15 Oct 2026 13:52:42 +0000</pubDate>
      <link>https://dev.to/cypress/how-to-connect-claude-code-to-cypress-1hll</link>
      <guid>https://dev.to/cypress/how-to-connect-claude-code-to-cypress-1hll</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5l52g3012hyitjctakip.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5l52g3012hyitjctakip.png" alt="Connect Claude to Cypress" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You ask Claude Code to fix a failing checkout test. It reads the spec, spots a likely timing issue, and suggests a reasonable fix. What it doesn’t know is that the same test has failed on and off in CI all week, or what the page looked like when it failed. A fix that looks right in the editor may not touch what’s really going on.&lt;/p&gt;

&lt;p&gt;Sound familiar? That gap usually isn’t about the model. It’s about context. Claude Code can read your spec files and pick up some of your patterns along the way. What it can’t see is your run history: which tests failed in CI, which ones are flaky, and what happened in your last recorded run.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, some terminology
&lt;/h2&gt;

&lt;p&gt;If you’re new to AI coding tools, the vocabulary piles up fast. Here’s what each term means in this post:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Context:&lt;/strong&gt; everything Claude Code has in front of it during a session, including your messages, the files it's read, its instructions, and the results of the tools it uses. Claude Code can only work with what’s in its context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token:&lt;/strong&gt; a small chunk of text, often part of a word. AI models measure context and usage in tokens, so a larger context uses more tokens on every turn.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CLI (command-line interface):&lt;/strong&gt; a tool you run by typing commands in a terminal, like &lt;code&gt;npx cypress run&lt;/code&gt;. Claude Code can run CLI commands too, such as the Cypress Cloud CLI, &lt;code&gt;cy-cloud&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skill:&lt;/strong&gt; a folder of instructions that teaches Claude Code how to handle a specific kind of task. Claude Code loads a skill only when a task calls for it. Cypress AI Skills cover writing, explaining, running, and debugging Cypress tests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP (Model Context Protocol):&lt;/strong&gt; an open standard that lets AI tools connect to other systems. An MCP server offers tools that Claude Code can call to get live data. Cloud MCP is our MCP server for Cypress Cloud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connector:&lt;/strong&gt; an MCP server you add to your Claude account at claude.ai, so Claude can use it across Claude apps. If you sign in to Claude Code with your claude.ai account, your connectors are available there automatically. Cypress Cloud is &lt;a href="https://claude.ai/directory/cypress-cloud?ref=cypress-io.ghost.io" rel="noopener noreferrer"&gt;available as a connector&lt;/a&gt; in the Claude connectors directory, which gives you a way to use Cloud MCP without running a setup command.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plugin:&lt;/strong&gt; a package that installs several pieces into Claude Code at once, such as skills and MCP server settings. You install a plugin from a marketplace, a catalog of plugins that anyone can publish. The Cypress plugin installs all five Cypress AI Skills and sets up Cloud MCP in one step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt; file:&lt;/strong&gt; a markdown file of instructions in your project, such as your team’s testing conventions, that Claude Code reads as context.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post sets up three pieces: Cypress AI Skills, which help Claude Code work the way your team does; Cloud MCP, which gives it your run history; and &lt;code&gt;cypress tap&lt;/code&gt;, which lets it check its work in your open Cypress session. You can use any of them on its own.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmh38a8mx3khggco58g0g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmh38a8mx3khggco58g0g.png" alt="How the pieces fit: Cypress AI Skills, CLAUDE.md files, and the Cypress app on your machine; recorded runs in Cypress Cloud, reached through Cloud MCP or the Cloud CLI" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Skills, &lt;code&gt;CLAUDE.md&lt;/code&gt; files, and &lt;code&gt;cypress tap&lt;/code&gt; all work with what’s on your machine. Only Cloud MCP and the Cloud CLI reach into Cypress Cloud for your recorded runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which setup do you need?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You want better tests from Claude Code, and you don’t use Cypress Cloud.&lt;/strong&gt; Install Cypress AI Skills. They’re free and need no account.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You write tests locally and want Claude Code to check its own work.&lt;/strong&gt; Install the skills and keep a &lt;code&gt;cypress open&lt;/code&gt; session running so Claude Code can use &lt;code&gt;cypress tap&lt;/code&gt;. This works without Cypress Cloud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You record runs to Cypress Cloud and spend time investigating flake and failures.&lt;/strong&gt; Install the skills and connect Cloud MCP or the Cloud CLI. This is where the two work best together.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You’re rolling this out to a team.&lt;/strong&gt; Commit the skills and your Cypress CLAUDE.md file to your repository, ask an admin to turn on Cloud MCP, and consider a &lt;code&gt;project&lt;/code&gt; scope OAuth configuration so everyone starts from the same setup.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick start: install the Cypress plugin
&lt;/h2&gt;

&lt;p&gt;The fastest way to set up the skills and &lt;a href="https://claudemarketplaces.com/mcp/io.cypress.mcp/cypress-cloud?ref=cypress-io.ghost.io" rel="noopener noreferrer"&gt;Cloud MCP&lt;/a&gt; together is the Cypress plugin for Claude Code. It installs all five Cypress AI Skills and configures Cloud MCP in one step. In a Claude Code session, add the Cypress marketplace and install the plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/plugin marketplace add cypress-io/ai-toolkit
/plugin &lt;span class="nb"&gt;install &lt;/span&gt;cypress@cypress

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Choose an install scope when Claude Code asks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;User scope&lt;/strong&gt; gives you the plugin in every project on your machine. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project scope&lt;/strong&gt; turns it on for everyone who works in the repository, and each person installs it once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An organization admin still needs to &lt;a href="https://on.cypress.io/cloud-mcp%20?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=connect-claude-to-cypress#Enable-for-Organization" rel="noopener noreferrer"&gt;turn on Cloud MCP in Cypress Cloud&lt;/a&gt;, and you sign in the first time Claude Code uses it.&lt;/p&gt;

&lt;p&gt;If you’d rather install the pieces one at a time, follow the steps below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Install Cypress AI Skills
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://on.cypress.io/ai-skills?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=connect-claude-to-cypress" rel="noopener noreferrer"&gt;Cypress AI Skills&lt;/a&gt; live in the open source &lt;a href="https://github.com/cypress-io/ai-toolkit?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=connect-claude-to-cypress" rel="noopener noreferrer"&gt;cypress-io/ai-toolkit repository on GitHub&lt;/a&gt;. They don’t require a Cypress Cloud account, a subscription, or have usage limits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There are five skills:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Skill&lt;/th&gt;
&lt;th&gt;What it helps Claude Code do&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cypress-author&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create, update, and fix end-to-end and component tests. It reads your config, custom commands, and fixtures first, so new tests match the patterns you already use.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cypress-explain&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Review and explain existing tests. It flags brittle selectors and missing assertions and uses accurate Cypress terminology.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cypress-tap&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Run and debug tests against a live &lt;code&gt;cypress open&lt;/code&gt; session from the command line. Claude Code can verify its own work by reading reporter output and inspecting the app where a test fails.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cypress-cloud-cli&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Investigate recorded runs through the Cypress Cloud CLI, including test attempts and failures reconstructed from Test Replay data.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cypress-docs&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Route Cypress questions to the official documentation, with awareness of the Cypress version you use.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Install all Cypress skills
&lt;/h3&gt;

&lt;p&gt;From the root of your project, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx skills add cypress-io/ai-toolkit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The skills install at the project level, so you can commit them and give everyone on your team the same Cypress context.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install one Cypress skill
&lt;/h3&gt;

&lt;p&gt;If you only want one skill, name it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx skills add https://github.com/cypress-io/ai-toolkit &lt;span class="nt"&gt;--skill&lt;/span&gt; cypress-author
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prefer the GitHub CLI? This works too:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh skill &lt;span class="nb"&gt;install &lt;/span&gt;cypress-io/ai-toolkit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also copy the skill folders into &lt;code&gt;.claude/skills&lt;/code&gt; in your project by hand.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use a skill
&lt;/h3&gt;

&lt;p&gt;Claude Code picks up the right skill when a task matches it. You can also call one directly with a slash command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/cypress-author Write an end-to-end test for the guest checkout flow. A guest should be able to add a product to the cart, enter a shipping address, and see the order confirmation page.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you installed the Cypress plugin, include its prefix: &lt;code&gt;/cypress:cypress-author&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Skills won’t turn a vague request into a precise one. The clearer your acceptance criteria, the closer the first draft will be to what you want.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Connect Claude Code to Cypress Cloud
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://on.cypress.io/cloud-mcp?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=connect-claude-to-cypress" rel="noopener noreferrer"&gt;Cloud MCP&lt;/a&gt; is free on every Cypress Cloud plan, including Starter. It reads recorded run data, so you need to record your runs to Cypress Cloud to use it.&lt;/p&gt;

&lt;p&gt;Claude Code can reach your recorded runs in three ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cypress Cloud connector&lt;/li&gt;
&lt;li&gt;Cloud MCP server&lt;/li&gt;
&lt;li&gt;Cypress Cloud CLI&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All three read recorded run data, so you need to record your runs to Cypress Cloud to use them. Cloud MCP and Cypress Cloud CLI are free on every Cypress Cloud plan, including Starter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ask an admin to turn on the Cloud MCP integration
&lt;/h3&gt;

&lt;p&gt;An organization admin turns on Cloud MCP from the &lt;strong&gt;Integrations&lt;/strong&gt; page in your Cypress Cloud organization settings. After that, each person connects their own Claude Code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyv2ymdxc0gfjh8t75xsc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyv2ymdxc0gfjh8t75xsc.png" alt="Cypress MCP enable toggle in Cypress Cloud organization setting" width="800" height="85"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 1: Add the Cypress Cloud connector
&lt;/h3&gt;

&lt;p&gt;If you sign in to Claude Code with your claude.ai account, the connector is the quickest route. You add it once, and it works in Claude Code and the Claude apps.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;a href="https://claude.ai/directory/cypress-cloud" rel="noopener noreferrer"&gt;Cypress Cloud connector&lt;/a&gt; in the Claude connectors directory.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Connect to Claude&lt;/strong&gt; , then sign in to Cypress Cloud when prompted.&lt;/li&gt;
&lt;li&gt;In Claude Code, run &lt;code&gt;/mcp&lt;/code&gt; to confirm the connector is listed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8rs8lcbfvaw0l2yj7op7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8rs8lcbfvaw0l2yj7op7.png" alt="Cypress Cloud connector in Claude directory shows 'Connect to Claude' button" width="799" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 2: Add the Cloud MCP server from your terminal
&lt;/h3&gt;

&lt;p&gt;Use this route if you sign in to Claude Code another way, such as with an API key, or if you want to control the scope more precisely. If you already added the connector, you can skip it. If you do both, Claude Code uses the server you added here and hides the connector as a duplicate.&lt;/p&gt;

&lt;p&gt;We recommend signing in with OAuth. Run this command in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add cypress-cloud &lt;span class="se"&gt;\&lt;/span&gt;
  https://mcp.cypress.io/mcp &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--transport&lt;/span&gt; http &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--scope&lt;/span&gt; user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then start Claude Code with &lt;code&gt;claude&lt;/code&gt; and ask it something about Cypress Cloud. Claude Code opens your browser so you can sign in to Cypress Cloud. Your session lasts 30 days, so you won’t need to rotate tokens, and you can revoke access at any time from your &lt;strong&gt;Manage Profile&lt;/strong&gt; page in Cypress Cloud. To check the connection, run &lt;code&gt;/mcp&lt;/code&gt; inside Claude Code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Choose a scope for the Cloud MCP
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;--scope&lt;/code&gt; flag decides where the connection is available:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;--scope user&lt;/code&gt; makes Cloud MCP available in every project on your machine. This is the setting we recommend.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--scope local&lt;/code&gt; limits it to the current project.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--scope project&lt;/code&gt; saves the configuration to a &lt;code&gt;.mcp.json&lt;/code&gt; file in your repository, so teammates who pull the repository get the same setup. Each person still signs in with their own Cypress Cloud account.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Use a personal access token instead of OAuth
&lt;/h3&gt;

&lt;p&gt;If OAuth doesn’t fit your environment, create an &lt;strong&gt;MCP personal access token&lt;/strong&gt; from your &lt;strong&gt;Manage Profile&lt;/strong&gt; page in Cypress Cloud.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjetphdjw3i9i138kh06i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjetphdjw3i9i138kh06i.png" alt="Personal access token UI to generate token for Cloud MCP server" width="798" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cypress Cloud shows the token once, so copy it right away. Then add it as a header:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add cypress-cloud &lt;span class="se"&gt;\&lt;/span&gt;
  https://mcp.cypress.io/mcp &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--transport&lt;/span&gt; http &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--scope&lt;/span&gt; user &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--header&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer YOUR_MCP_TOKEN"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep token-based setups at &lt;code&gt;user&lt;/code&gt; or &lt;code&gt;local&lt;/code&gt; scope. The &lt;code&gt;project&lt;/code&gt; scope writes the configuration to a file in your repository, and a token doesn’t belong there.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 3: Use the Cypress Cloud CLI
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://on.cypress.io/cloud-cli?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=connect-claude-to-cypress" rel="noopener noreferrer"&gt;Cypress Cloud CLI&lt;/a&gt;, &lt;code&gt;cy-cloud&lt;/code&gt;, reads the same recorded runs as Cloud MCP, from your terminal. The &lt;code&gt;cypress-cloud-cli&lt;/code&gt; skill from Step 1 teaches Claude Code how to use it. The CLI can also download Test Replay data, so Claude Code can step through a test’s timeline and inspect the page at the moment it failed.&lt;/p&gt;

&lt;p&gt;Before you start, an organization admin needs to turn on the Cloud CLI integration in Cypress Cloud.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqkujewtegk1p54n3qgba.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqkujewtegk1p54n3qgba.png" alt="Cloud CLI toggle to enable for organization" width="797" height="86"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install the CLI and sign in:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--global&lt;/span&gt; @cypress/cloud
cy-cloud login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;cy-cloud login&lt;/code&gt; opens your browser to sign in. In CI or a Claude Code web session, set &lt;code&gt;CYPRESS_CLOUD_TOKEN&lt;/code&gt; to a personal access token instead. It signs you in without writing credentials to disk.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cloud MCP or the Cloud CLI?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cloud MCP&lt;/strong&gt; is the quickest to set up. It works in the Claude apps and any MCP client, and it has tools for Cypress Accessibility and UI Coverage reports.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud CLI&lt;/strong&gt; adds nothing to Claude Code’s context until it runs, and it can dig into Test Replay data in great detail.&lt;/li&gt;
&lt;li&gt;You can use both.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Prompts to try with Cypress Cloud MCP
&lt;/h3&gt;

&lt;p&gt;Here are a few prompts to start with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Find the latest passing run on main in Cypress Cloud and get the duration of every spec, paging through all results. Then suggest how to balance our specs across parallel CI machines.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;For latest run on this branch in Cypress Cloud, pull spec durations and tell me which specs are the slowest. Then break the slowest one down by test so I know whether to split it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;List every skipped and pending test in the last run on this branch in Cypress Cloud, grouped by spec.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run, spec, test, and failure data are available on every plan.&lt;/p&gt;

&lt;p&gt;Flaky test data, Cypress Accessibility results, and UI Coverage reports are available for plans that have access to those features, so those tools return data when your plan includes them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;List all flaky tests from the last five runs in Cypress Cloud. Do the error messages share any patterns?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Pull the Cypress Accessibility report for the latest run on this branch. List any critical or serious violations, grouped by rule.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Using Cypress Cloud, pull the UI Coverage report for the latest run on this branch. What is the overall score, and which untested elements are in the riskiest view?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cloud MCP limits how many tool requests you can make per hour. The &lt;a href="https://on.cypress.io/cloud-mcp?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=connect-claude-to-cypress" rel="noopener noreferrer"&gt;Cloud MCP documentation&lt;/a&gt; lists the current limit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Let Claude Code check its work with &lt;code&gt;cypress tap&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Writing a test is only half the job. The other half is watching it run and seeing what went wrong. &lt;a href="https://on.cypress.io/cypress-tap?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=connect-claude-to-cypress" rel="noopener noreferrer"&gt;&lt;code&gt;cypress tap&lt;/code&gt;&lt;/a&gt; is a command-line interface (CLI) built into the Cypress App that lets Claude Code work with the Cypress App you already have open. It can run a spec, read the results and the Command Log, go back to the snapshot at any command, and inspect the page’s DOM and accessibility tree. That’s the same context you use when you debug a test yourself.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;cypress-tap&lt;/code&gt; skill you installed in Step 1 teaches Claude Code how to use these commands well. For example, it makes sure Claude reads the result of the run it just started, not the previous one.&lt;/p&gt;

&lt;h3&gt;
  
  
  How it differs from &lt;code&gt;cypress run&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;cypress run&lt;/code&gt; runs your specs headlessly and exits, which is what you want in CI. &lt;code&gt;cypress tap&lt;/code&gt; attaches to a running &lt;code&gt;cypress open&lt;/code&gt; session instead, so Claude Code can rerun a spec, look at the app at the moment a test failed, and try again without starting over.&lt;/p&gt;

&lt;h3&gt;
  
  
  Start a &lt;code&gt;cypress tap&lt;/code&gt; session
&lt;/h3&gt;

&lt;p&gt;Open Cypress the way you normally would, and leave it running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx cypress open &lt;span class="nt"&gt;--e2e&lt;/span&gt; &lt;span class="nt"&gt;--browser&lt;/span&gt; electron

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then start Claude Code from the same project folder. Claude Code finds the open session automatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ask Claude Code to verify a test
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Run cypress/e2e/checkout/guest-checkout.cy.ts in my open Cypress session. If a test fails, look at the page at the failing command and fix the selector or assertion.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here’s what that looks like in practice. Say Claude Code wrote the checkout test with a guessed selector, &lt;code&gt;.submit-btn&lt;/code&gt;, and the test fails. Claude Code reads the failing test from the reporter, goes back to the snapshot at the failing command, and inspects the page. It finds that the button is actually &lt;code&gt;[data-cy="checkout-submit"]&lt;/code&gt;, updates the spec, and runs it again. No guessing, and no copying error messages out of the Cypress app.&lt;/p&gt;

&lt;p&gt;You can run the same commands yourself, which is useful when you want to see what Claude Code sees:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx cypress tap status
npx cypress tap run cypress/e2e/checkout/guest-checkout.cy.ts
npx cypress tap dom &lt;span class="nt"&gt;--selector&lt;/span&gt; &lt;span class="s2"&gt;"[data-cy=checkout-submit]"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: give your Cypress tests their own CLAUDE.md
&lt;/h2&gt;

&lt;p&gt;Skills teach Claude Code how Cypress works. A &lt;code&gt;CLAUDE.md&lt;/code&gt; file teaches it how your team works. It’s a plain markdown file of instructions that Claude Code reads as context, and you can put one right in your &lt;code&gt;cypress&lt;/code&gt; folder so your testing conventions live next to your tests.&lt;/p&gt;

&lt;p&gt;Why a separate file? Your root &lt;code&gt;CLAUDE.md&lt;/code&gt; probably covers how to build and run the app. Cypress conventions, like which selectors to use or which custom commands exist, matter only when Claude Code works on tests. A separate file keeps the root file short and gives the people who own your test suite a file they can maintain.&lt;/p&gt;

&lt;p&gt;The skills already read your config and custom commands. &lt;code&gt;CLAUDE.md&lt;/code&gt; is where you put the decisions that aren’t visible in the code, like which of two similar commands your team prefers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a CLAUDE.md file in your &lt;code&gt;cypress&lt;/code&gt; folder
&lt;/h3&gt;

&lt;p&gt;Add a &lt;code&gt;CLAUDE.md&lt;/code&gt; file to your &lt;code&gt;cypress&lt;/code&gt; folder. Here’s an example; swap in your own commands, paths, and rules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Cypress tests&lt;/span&gt;

&lt;span class="gu"&gt;## Selectors&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Select elements with &lt;span class="sb"&gt;`data-cy`&lt;/span&gt; attributes, for example &lt;span class="sb"&gt;`cy.get('[data-cy="checkout-submit"]')`&lt;/span&gt;.
&lt;span class="p"&gt;-&lt;/span&gt; Don't select elements by CSS class or position.

&lt;span class="gu"&gt;## Custom commands&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Use &lt;span class="sb"&gt;`cy.login(role)`&lt;/span&gt; to sign in. Only tests in &lt;span class="sb"&gt;`cypress/e2e/auth/`&lt;/span&gt; drive the login form directly.
&lt;span class="p"&gt;-&lt;/span&gt; Use &lt;span class="sb"&gt;`cy.seedCart(products)`&lt;/span&gt; to set up cart state through the API.

&lt;span class="gu"&gt;## Running tests&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Run one spec with &lt;span class="sb"&gt;`npx cypress run --spec cypress/e2e/checkout/guest-checkout.cy.ts`&lt;/span&gt;.
&lt;span class="p"&gt;-&lt;/span&gt; Reuse fixtures in &lt;span class="sb"&gt;`cypress/fixtures`&lt;/span&gt; before creating new ones.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep it short and specific. Anthropic recommends staying under 200 lines per file, because longer files use more context and Claude Code follows them less consistently.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Claude Code scopes a CLAUDE.md file to the folder
&lt;/h3&gt;

&lt;p&gt;You don’t need any configuration. Claude Code loads a &lt;code&gt;CLAUDE.md&lt;/code&gt; file in a subfolder on demand: when it reads, writes, or edits a file inside &lt;code&gt;cypress/&lt;/code&gt;, it adds &lt;code&gt;cypress/CLAUDE.md&lt;/code&gt; to its context. In a session where you only work on application code, the file doesn’t load.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scope Cypress rules by file pattern instead
&lt;/h3&gt;

&lt;p&gt;A folder file only covers files inside that folder. If some of your specs live elsewhere, like component tests next to the components they cover, use a path-scoped rule instead. Create &lt;code&gt;.claude/rules/cypress.md&lt;/code&gt; at the root of your project and list the paths it applies to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cypress/**/*"&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;src/**/*.cy.{js,ts,jsx,tsx}"&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="c1"&gt;# Cypress tests&lt;/span&gt;

&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Select elements with `data-cy` attributes.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude Code loads the rule only when it reads, writes, or edits a file that matches one of the patterns.&lt;/p&gt;

&lt;h3&gt;
  
  
  Share it with your team
&lt;/h3&gt;

&lt;p&gt;Commit &lt;code&gt;cypress/CLAUDE.md&lt;/code&gt; or your rule file so everyone gets the same conventions. For personal notes that shouldn’t be shared, like the port your local server runs on, use a &lt;code&gt;CLAUDE.local.md&lt;/code&gt; file at the project root and add it to your &lt;code&gt;.gitignore&lt;/code&gt; file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Put them together: from a CI failure to a verified fix
&lt;/h2&gt;

&lt;p&gt;Say a spec fails on your branch in CI. Instead of opening Cypress Cloud, finding the run, copying the error, and pasting it into a chat, you ask:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The checkout spec failed in Cypress Cloud on my branch in CI. Find out why and fix it.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here’s what Claude Code can do with all the Cypress connections in place:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Find the failure.&lt;/strong&gt; Through Cloud MCP, it pulls the failed test, the error message, the stack trace, and a Test Replay link for the run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Understand the test.&lt;/strong&gt; With &lt;code&gt;cypress-explain&lt;/code&gt;, it reads the spec and identifies the likely cause, such as an assertion that runs before an API response arrives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write the fix.&lt;/strong&gt; With &lt;code&gt;cypress-author&lt;/code&gt;, it updates the test using your existing custom commands and selector conventions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify the fix.&lt;/strong&gt; With &lt;code&gt;cypress-tap&lt;/code&gt;, it runs the spec against your open Cypress session and reads the results.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You stay in the loop the whole way. Claude Code proposes changes to your local files, and you review them like you’d review a teammate’s pull request. What changes is how much time you spend gathering context before you can make a decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Cypress data Claude Code can and can’t see
&lt;/h2&gt;

&lt;p&gt;Giving an AI assistant access to your test data is a reasonable thing to be careful about, so here’s exactly how Cloud MCP works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It’s read-only.&lt;/strong&gt; Cloud MCP can’t change your tests or delete runs in Cypress Cloud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It follows your permissions.&lt;/strong&gt; Claude Code sees only the projects your Cypress Cloud account can see, based on your existing role in your organization and team.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;We don’t see your conversation.&lt;/strong&gt; Cypress has no access to your chat history or Claude Code’s context. We receive only the inputs to each tool call, such as a project ID.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Your test data isn’t used for model training.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You control the connection.&lt;/strong&gt; Cloud MCP works only where you configure it, and you can revoke OAuth access at any time from your &lt;strong&gt;Manage Profile&lt;/strong&gt; page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI Skills run locally in your project and don’t send data to Cypress Cloud on their own. The &lt;code&gt;cypress-cloud-cli&lt;/code&gt; skill reads Cloud data only through the Cloud CLI you authenticate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;The setup takes a few minutes: one command for the skills and one for Cloud MCP or the Cloud CLI. The &lt;a href="https://docs.cypress.io/app/tooling/ai-skills?utm_source=blog&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Cypress%20AI%20Skills%20documentation&amp;amp;utm_campaign=claude-code-cypress-oct-2026&amp;amp;utm_term=individual-contributor" rel="noopener noreferrer"&gt;Cypress AI Skills documentation&lt;/a&gt;, the &lt;a href="https://docs.cypress.io/cloud/integrations/cloud-mcp?utm_source=blog&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Cloud%20MCP%20documentation&amp;amp;utm_campaign=claude-code-cypress-oct-2026&amp;amp;utm_term=individual-contributor" rel="noopener noreferrer"&gt;Cloud MCP documentation&lt;/a&gt;, and the &lt;a href="https://docs.cypress.io/cloud/integrations/cloud-cli?utm_source=blog&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Cloud%20CLI%20documentation&amp;amp;utm_campaign=claude-code-cypress-oct-2026&amp;amp;utm_term=individual-contributor" rel="noopener noreferrer"&gt;Cloud CLI documentation&lt;/a&gt; cover every option in detail, and the &lt;a href="https://code.claude.com/docs/en/mcp?ref=cypress-io.ghost.io" rel="noopener noreferrer"&gt;Claude Code MCP documentation&lt;/a&gt; explains how Claude Code manages servers.&lt;/p&gt;

&lt;p&gt;To go deeper on &lt;code&gt;CLAUDE.md&lt;/code&gt; files and path-scoped rules, see &lt;a href="https://code.claude.com/docs/en/memory?ref=cypress-io.ghost.io" rel="noopener noreferrer"&gt;how Claude Code remembers your project&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Do I need Cypress Cloud to use Claude Code with Cypress?
&lt;/h3&gt;

&lt;p&gt;No. Cypress AI Skills and &lt;code&gt;cypress tap&lt;/code&gt; work with your local project and your open Cypress session. You need Cypress Cloud only for Cloud MCP and the Cloud CLI, which read your recorded runs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is Cloud MCP free?
&lt;/h3&gt;

&lt;p&gt;Yes. Cloud MCP is included on every Cypress Cloud plan, including Starter. Some tools return data only when your plan includes the related feature, such as flaky test detection, Cypress Accessibility, or UI Coverage. Usage limits are subject to change.&lt;/p&gt;

&lt;h3&gt;
  
  
  Are Cypress AI Skills free?
&lt;/h3&gt;

&lt;p&gt;Yes. They’re open source, and they don’t require a Cypress Cloud account or subscription.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can Cypress see my Claude Code conversations?
&lt;/h3&gt;

&lt;p&gt;No. Cypress receives only the inputs to each Cloud MCP tool call, such as a project ID. We have no access to your conversation or Claude Code’s context, and your test data isn’t used for model training. Prompts sent directly to the &lt;code&gt;submit_mcp_feedback&lt;/code&gt; tool call are sent to our team, so only call this when you have feedback to share with us.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does this work with Cursor or GitHub Copilot?
&lt;/h3&gt;

&lt;p&gt;Yes. Cypress AI Skills work with AI coding tools that support skills, including Cursor and GitHub Copilot, and Cloud MCP works with any MCP-compatible client. The setup steps differ by tool. Check the &lt;a href="https://on.cypress.io/cloud-mcp?ref=cypress-io.ghost.io#Configure-AI-Assistant?utm_source=blog&amp;amp;utm_medium=inline-link&amp;amp;utm_content=Cloud%20MCP%20documentation&amp;amp;utm_campaign=claude-code-cypress-oct-2026&amp;amp;utm_term=individual-contributor" rel="noopener noreferrer"&gt;setup steps in our documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>claude</category>
      <category>testing</category>
      <category>cypress</category>
      <category>ai</category>
    </item>
    <item>
      <title>Find elements the way your users do with cy.getByRole()</title>
      <dc:creator>Jennifer Shehane</dc:creator>
      <pubDate>Wed, 14 Oct 2026 17:54:38 +0000</pubDate>
      <link>https://dev.to/cypress/find-elements-the-way-your-users-do-with-cygetbyrole-2l43</link>
      <guid>https://dev.to/cypress/find-elements-the-way-your-users-do-with-cygetbyrole-2l43</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsgtaem08drjexpvsr7px.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsgtaem08drjexpvsr7px.png" alt=" " width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Starting in Cypress 16.2.0, &lt;code&gt;cy.getByRole()&lt;/code&gt; is a built-in query that finds elements by their role and accessible name. The role is what a screen reader announces an element as, such as a button or a link, and the accessible name is the text it announces for it.&lt;/p&gt;

&lt;p&gt;This offers a built-in alternative to the &lt;code&gt;.findByRole()&lt;/code&gt; selector from the popular &lt;a href="https://github.com/testing-library/cypress-testing-library" rel="noopener noreferrer"&gt;Cypress Testing Library&lt;/a&gt; plugin. That package no longer has an active maintainer and the previous maintainer suggested Cypress build these queries into Cypress directly.&lt;/p&gt;

&lt;p&gt;We agree with that direction. Role-based queries are a core way to write resilient, accessible tests, and they belong in Cypress itself. &lt;code&gt;cy.getByRole()&lt;/code&gt; is the first of these built-in queries. We plan to bring more of the Testing Library queries teams depend on into Cypress.&lt;/p&gt;

&lt;h2&gt;
  
  
  What &lt;code&gt;cy.getByRole()&lt;/code&gt; does
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;cy.getByRole()&lt;/code&gt; finds every element with a given role, such as &lt;code&gt;button&lt;/code&gt;, &lt;code&gt;link&lt;/code&gt;, &lt;code&gt;heading&lt;/code&gt;, or &lt;code&gt;tab&lt;/code&gt;, and can narrow the results to elements whose accessible name matches. Because those are what assistive technology announces, a test written this way finds elements the way assistive technology does. If a control’s role or label changes, the test fails.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;account settings&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;saves profile changes&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/settings&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;textbox&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Display name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Jane Doe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Save changes&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;alert&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;have.text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Changes saved&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few behaviors on how &lt;code&gt;cy.getByRole()&lt;/code&gt; works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It yields every match.&lt;/strong&gt; Like &lt;a href="https://on.cypress.io/get?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_content=cy.get%28%29&amp;amp;utm_campaign=getbyrole-launch-oct-2026" rel="noopener noreferrer"&gt;&lt;code&gt;cy.get()&lt;/code&gt;&lt;/a&gt;, &lt;code&gt;cy.getByRole()&lt;/code&gt; yields all matching elements in document order. Narrow the &lt;code&gt;name&lt;/code&gt;, or chain &lt;code&gt;.first()&lt;/code&gt; or &lt;code&gt;.eq()&lt;/code&gt;, to act on one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A string name matches the whole name, case-sensitively.&lt;/strong&gt; Pass a regular expression to match part of a name or ignore case, or a function for custom logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It skips elements hidden from the accessibility tree&lt;/strong&gt; by default, such as elements with &lt;code&gt;aria-hidden="true"&lt;/code&gt; or &lt;code&gt;display: none&lt;/code&gt;. Pass &lt;code&gt;hidden: true&lt;/code&gt; to include them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It retries&lt;/strong&gt; like any Cypress query, so it waits for an element to appear and for chained assertions to pass.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It prefers built-in HTML elements.&lt;/strong&gt; If a native HTML element exists for a given role, &lt;code&gt;cy.getByRole()&lt;/code&gt; matches that element only, unless &lt;code&gt;native: false&lt;/code&gt; is passed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To narrow by state, such as checked, selected, expanded, or heading level, chain &lt;code&gt;.filter()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// The tab that is currently selected&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tab&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[aria-selected="true"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// Level 2 headings&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;heading&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[aria-level="2"], h2:not([aria-level])&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// A checked native checkbox&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;checkbox&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;:checked&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// A checked checkbox that gets its role from a role attribute&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;checkbox&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;native&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[aria-checked="true"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// The menu button whose menu is open&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[aria-expanded="true"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// A toggle button that is switched on&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[aria-pressed="true"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// The link to the page the reader is on&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;link&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[aria-current="page"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// Every button except disabled ones&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;not&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;:disabled, [aria-disabled="true"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://on.cypress.io/api/commands/getbyrole?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_content=cy.getByRole%28%29%20API%20reference&amp;amp;utm_campaign=getbyrole-launch-oct-2026" rel="noopener noreferrer"&gt;&lt;code&gt;cy.getByRole()&lt;/code&gt; API reference&lt;/a&gt; covers every option, including shadow DOM, TypeScript, and scoping with &lt;code&gt;.within()&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why native elements are the default in &lt;code&gt;cy.getByRole()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;For any role that HTML has a native element for, such as &lt;code&gt;button&lt;/code&gt;, &lt;code&gt;link&lt;/code&gt;, &lt;code&gt;heading&lt;/code&gt;, &lt;code&gt;dialog&lt;/code&gt;, or &lt;code&gt;checkbox&lt;/code&gt;, &lt;code&gt;cy.getByRole()&lt;/code&gt; matches only elements whose tag gives them that role. A &lt;code&gt;&amp;lt;div role="button"&amp;gt;&lt;/code&gt; does not match &lt;code&gt;cy.getByRole('button')&lt;/code&gt; unless you pass &lt;code&gt;native: false&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Save&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;button&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;tabindex&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Cancel&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="c1"&gt;// Yields and clicks the native &amp;lt;button&amp;gt;&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Save&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;// The &amp;lt;div&amp;gt; has the role only through its role attribute, so it's skipped&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Cancel&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;not.exist&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why make more strict behavior the default? Because a role-based locator that accepts both elements can cover up accessibility issues that could be easily discovered by your tests. Native controls are the most likely to work well for keyboard-only users, including many people with motor disabilities, or for screen reader users, because the browser handles the behavior automatically and consistently.&lt;/p&gt;

&lt;p&gt;On the other hand, custom controls may implement a &lt;code&gt;role&lt;/code&gt; attribute in order to satisfy a byRole selector, and often skip the rest of the required behavior. This creates a false impression that something is accessible.&lt;/p&gt;

&lt;h3&gt;
  
  
  What a &lt;code&gt;role&lt;/code&gt; attribute does not support natively
&lt;/h3&gt;

&lt;p&gt;Adding &lt;code&gt;role="button"&lt;/code&gt; to a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; changes one thing: assistive technology announces the element as a button. As &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/button_role" rel="noopener noreferrer"&gt;MDN’s documentation of the button role&lt;/a&gt; explains, the role does not add keyboard handling or other button behavior. The application code has to account for all of it.&lt;/p&gt;

&lt;p&gt;A native &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; gives you these behaviors built in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatically joins the keyboard tab order.&lt;/li&gt;
&lt;li&gt;Activates with both the Enter and Space keys.&lt;/li&gt;
&lt;li&gt;Fires a &lt;code&gt;click&lt;/code&gt; event for keyboard activation, not only for mouse clicks.&lt;/li&gt;
&lt;li&gt;Supports the &lt;code&gt;disabled&lt;/code&gt; attribute, which removes the button from the tab order and blocks activation.&lt;/li&gt;
&lt;li&gt;Submits the surrounding form.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A &lt;code&gt;&amp;lt;div role="button"&amp;gt;&lt;/code&gt; gets none of these. To match a native button, a developer has to add &lt;code&gt;tabindex="0"&lt;/code&gt;, a &lt;code&gt;keydown&lt;/code&gt; handler for both keys, logic to stop Space from scrolling the page, and their own disabled state handling. Each of those is a place for a bug to hide, and a mouse-driven test won’t notice any of them, so if the accessibility-friendly byRole locator is passing, it can be easy to miss the risk.&lt;/p&gt;

&lt;h3&gt;
  
  
  What people experience when the native element doesn’t match the role
&lt;/h3&gt;

&lt;p&gt;Here’s what that gap looks like for real users of a partially-implemented button, for example a &lt;code&gt;&amp;lt;div role="button"&amp;gt;&lt;/code&gt; that only has a click handler:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keyboard-only users&lt;/strong&gt; press Tab and skip right past the control. Without &lt;code&gt;tabindex&lt;/code&gt;, the browser never puts it in the tab order, so there’s no way to reach it. People who can’t use a mouse, including many people with motor disabilities, are stuck.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Screen reader users&lt;/strong&gt; may reach the content and hear “Save, button” and do what anyone would: press Enter or Space. Depending on their screen reader and how they’re navigating, nothing may happen, because the page only listens for mouse clicks. They will not know if they successfully operated the button.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anyone using Space to activate it&lt;/strong&gt; may watch the page scroll down instead, because Space scrolls the page unless the developer prevents it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Users who encounter a “disabled” state&lt;/strong&gt; may still be able to activate it. Setting &lt;code&gt;aria-disabled="true"&lt;/code&gt; describes a state to screen readers, but doesn’t block clicks or key presses the way the native &lt;code&gt;disabled&lt;/code&gt; attribute does, allowing for unintentional activation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this shows up in a test that clicks the element with a simulated mouse event. That’s exactly why we made native matching the default. If someone replaces a &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; with a &lt;code&gt;&amp;lt;div role="button"&amp;gt;&lt;/code&gt;, your existing &lt;code&gt;cy.getByRole('button', ...)&lt;/code&gt; test fails and points you at the change, and you can decide whether it was intentional and if more tests are needed.&lt;/p&gt;

&lt;p&gt;The broader principle comes from web accessibility: The &lt;a href="https://www.w3.org/TR/using-aria/#rule1" rel="noopener noreferrer"&gt;first rule of ARIA&lt;/a&gt; advises using a native HTML element whenever one already has the semantics and behavior you need, instead of rebuilding it with an ARIA &lt;code&gt;role&lt;/code&gt; attribute. The &lt;a href="https://www.w3.org/WAI/ARIA/apg/patterns/button/" rel="noopener noreferrer"&gt;W3C ARIA Authoring Practices Guide button pattern&lt;/a&gt; shows how much work a custom button takes to get right.&lt;/p&gt;

&lt;h3&gt;
  
  
  When to pass &lt;code&gt;native: false&lt;/code&gt; to &lt;code&gt;cy.getByRole()&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;In some cases a &lt;code&gt;role&lt;/code&gt; attribute is the right call, or at least not yours to change. Pass &lt;code&gt;native: false&lt;/code&gt; to also match elements that get their role from a &lt;code&gt;role&lt;/code&gt; attribute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// A dialog rendered by a component library you don't control&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dialog&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Delete project&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;native&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;be.visible&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few common patterns need &lt;code&gt;native: false&lt;/code&gt; even when they follow the ARIA authoring practices, because HTML has a different native element for the role:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An autocomplete &lt;code&gt;&amp;lt;input role="combobox"&amp;gt;&lt;/code&gt;. The native combobox is a &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; or an &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; with a &lt;code&gt;list&lt;/code&gt; attribute.&lt;/li&gt;
&lt;li&gt;An icon &lt;code&gt;&amp;lt;svg role="img"&amp;gt;&lt;/code&gt;. The native image is an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For widget roles that HTML has no element for, such as &lt;code&gt;tab&lt;/code&gt;, &lt;code&gt;menuitem&lt;/code&gt;, or &lt;code&gt;switch&lt;/code&gt;, a &lt;code&gt;role&lt;/code&gt; attribute is the only option, so &lt;code&gt;cy.getByRole()&lt;/code&gt; always matches it. You don’t need &lt;code&gt;native: false&lt;/code&gt; for those.&lt;/p&gt;

&lt;p&gt;If your app is built on a component library that re-implements native elements with &lt;code&gt;role&lt;/code&gt; attributes, you don’t have to pass &lt;code&gt;native: false&lt;/code&gt; on every call. You can &lt;a href="https://on.cypress.io/getbyrole?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_content=overwrite%20the%20query&amp;amp;utm_campaign=getbyrole-launch-oct-2026#Change-the-native-default-for-your-project" rel="noopener noreferrer"&gt;overwrite the query&lt;/a&gt; in your support file to make &lt;code&gt;native: false&lt;/code&gt; your project’s default. A test can still pass &lt;code&gt;native: true&lt;/code&gt; to require a native element.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// cypress/support/commands.js&lt;/span&gt;
&lt;span class="nx"&gt;Cypress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Commands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;overwriteQuery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;getByRole&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;originalFn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;role&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;originalFn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;role&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;native&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Moving off of Cypress Testing Library
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Do you need to migrate &lt;code&gt;cy.findByRole()&lt;/code&gt; to &lt;code&gt;cy.getByRole()&lt;/code&gt; right now?
&lt;/h3&gt;

&lt;p&gt;No. Cypress Testing Library still works with Cypress 16.2.0. It registers only &lt;code&gt;findBy*&lt;/code&gt; queries, so it doesn’t conflict with &lt;code&gt;cy.getByRole()&lt;/code&gt;, and you can migrate one spec at a time.&lt;/p&gt;

&lt;p&gt;Most calls translate by renaming the query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Before: Cypress Testing Library&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Place order&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findAllByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;listitem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;have.length&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tab&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;selected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;have.text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Shipping&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// After: cy.getByRole()&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Place order&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;listitem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;have.length&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tab&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[aria-selected="true"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;have.text&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Shipping&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are a few differences that could cause a one-to-one replacement to fail:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Native elements by default.&lt;/strong&gt; A test that found a &lt;code&gt;&amp;lt;div role="button"&amp;gt;&lt;/code&gt; with &lt;code&gt;findByRole()&lt;/code&gt; fails after migrating. Decide for each one whether the app should use the native element, or the test should pass &lt;code&gt;native: false&lt;/code&gt;. I’d encourage you to treat this list as an accessibility review, not a chore. To keep your current behavior while you migrate, overwrite the query to default to &lt;code&gt;native: false&lt;/code&gt;, as shown earlier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every match, not one.&lt;/strong&gt; &lt;code&gt;cy.getByRole()&lt;/code&gt; yields every match instead of failing when more than one element matches. Narrow the &lt;code&gt;name&lt;/code&gt; or chain &lt;code&gt;.first()&lt;/code&gt; to act on one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State options become &lt;code&gt;.filter()&lt;/code&gt;.&lt;/strong&gt; The &lt;code&gt;checked&lt;/code&gt;, &lt;code&gt;selected&lt;/code&gt;, &lt;code&gt;pressed&lt;/code&gt;, &lt;code&gt;expanded&lt;/code&gt;, &lt;code&gt;current&lt;/code&gt;, &lt;code&gt;busy&lt;/code&gt;, &lt;code&gt;level&lt;/code&gt;, and &lt;code&gt;value&lt;/code&gt; options move to a chained &lt;code&gt;.filter()&lt;/code&gt;. If you pass one of these options, the error tells you which filter to use.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;a href="https://on.cypress.io/getbyrole?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_content=migration%20guide&amp;amp;utm_campaign=getbyrole-launch-oct-2026#How-to-migrate-from-Testing-Library-findByRole-to-cygetByRole" rel="noopener noreferrer"&gt;migration guide in the &lt;code&gt;cy.getByRole()&lt;/code&gt; docs&lt;/a&gt; has before-and-after examples and a copyable prompt you can give an AI agent to do the migration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Custom command failing with &lt;code&gt;cy.getByRole()&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;If your project already defines its own &lt;code&gt;getByRole&lt;/code&gt; with &lt;code&gt;Cypress.Commands.add()&lt;/code&gt; or &lt;code&gt;Cypress.Commands.addQuery()&lt;/code&gt;, that call throws an error in Cypress 16.2.0, because &lt;code&gt;getByRole&lt;/code&gt; is now a built-in query. Rename your command, or remove it and use the built-in one.&lt;/p&gt;

&lt;h2&gt;
  
  
  How &lt;code&gt;cy.getByRole()&lt;/code&gt; and Cypress Accessibility fit together
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;cy.getByRole()&lt;/code&gt; only checks the elements you locate in a test. &lt;a href="https://www.cypress.io/accessibility?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_content=Cypress%20Accessibility&amp;amp;utm_campaign=getbyrole-launch-oct-2026" rel="noopener noreferrer"&gt;Cypress Accessibility&lt;/a&gt; widens the view. It runs axe-core checks against every unique page state your recorded tests reach, with no changes to your test code, and reports the results in Cypress Cloud. That catches problems like missing labels, low color contrast, and invalid ARIA on parts of the page no test explicitly asserts.&lt;/p&gt;

&lt;p&gt;Put together, it looks like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;cy.getByRole()&lt;/code&gt;&lt;/strong&gt; helps ensure the elements your tests use or assert about have a clear accessibility purpose and name.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cypress Accessibility&lt;/strong&gt; audits every state your tests reach, including everything they don’t interact with or make assertions about.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;cy.getByRole()&lt;/code&gt; is built into the Cypress app and works without Cypress Cloud. Cypress Accessibility runs with Cypress Cloud. You can adopt either one on its own, and each makes the other more useful, because you will get a more detailed axe-core report if your elements have recognizable roles with associated accessibility expectations, and don’t appear to be generic content.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to do next
&lt;/h2&gt;

&lt;p&gt;If you’re starting a new test, reach for &lt;code&gt;cy.getByRole()&lt;/code&gt; first. If you already use Cypress Testing Library, there’s no rush, but migrating gives you a supported query and an accessibility check on every control your tests touch. And if a migrated test fails because of the native default, take that seriously. It may be the first time your test suite noticed something a keyboard user has been running into all along.&lt;/p&gt;

&lt;p&gt;Upgrade to Cypress 16.2.0, then read the &lt;a href="https://on.cypress.io/getbyrole?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_content=cy.getByRole%28%29%20documentation&amp;amp;utm_campaign=getbyrole-launch-oct-2026" rel="noopener noreferrer"&gt;&lt;code&gt;cy.getByRole()&lt;/code&gt; documentation&lt;/a&gt; to get started. We’d love to hear how it goes, and which Testing Library queries you’d like to see built in next.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is &lt;code&gt;cy.getByRole()&lt;/code&gt; in Cypress?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;cy.getByRole()&lt;/code&gt; is a built-in Cypress query that finds DOM elements by their role and, optionally, their accessible name. The role is what a screen reader announces an element as, such as a button or a link. It yields every matching element and retries until the elements exist and chained assertions pass.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which version of Cypress includes &lt;code&gt;cy.getByRole()&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;Cypress 16.2.0 and later.&lt;/p&gt;

&lt;h3&gt;
  
  
  What about test IDs?
&lt;/h3&gt;

&lt;p&gt;Test IDs like &lt;code&gt;data-cy&lt;/code&gt; and &lt;code&gt;data-test&lt;/code&gt; specifically avoid depending on anything about the element, which means they have no opinion about accessibility, HTML, or content. They are useful for maximum stability where those things don’t matter, or for separating different instances of otherwise-similar elements.&lt;/p&gt;

&lt;p&gt;When working with &lt;code&gt;cy.getByRole()&lt;/code&gt;, you may want to chain &lt;code&gt;.filter('[data-cy="your-test-id"]')&lt;/code&gt; to ensure a specific element is matched if there is a chance that more than one might be on the same page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I still need &lt;code&gt;@testing-library/cypress&lt;/code&gt; to find elements by role?
&lt;/h3&gt;

&lt;p&gt;No. &lt;code&gt;cy.getByRole()&lt;/code&gt; replaces &lt;code&gt;findByRole()&lt;/code&gt; and &lt;code&gt;findAllByRole()&lt;/code&gt; without a plugin. If you use other Testing Library queries, such as &lt;code&gt;findByLabelText()&lt;/code&gt;, keep the package for now. The two can run side by side.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why doesn’t &lt;code&gt;cy.getByRole()&lt;/code&gt; find my &lt;code&gt;&amp;lt;div role="button"&amp;gt;&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;For roles that have a native HTML element, &lt;code&gt;cy.getByRole()&lt;/code&gt; matches only the native element by default. Pass &lt;code&gt;{ native: false }&lt;/code&gt; to also match elements that get their role from a &lt;code&gt;role&lt;/code&gt; attribute, or switch the element to a native &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;, which means keyboard and screen reader users get built-in button behavior and you will not need to pass an option. To make &lt;code&gt;native: false&lt;/code&gt; your project’s default, overwrite the query with &lt;code&gt;Cypress.Commands.overwriteQuery()&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why is a native &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; more accessible than &lt;code&gt;role="button"&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;role="button"&lt;/code&gt; only changes how assistive technology announces the element. A native &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; is also in the keyboard tab order, activates with Enter and Space, supports the &lt;code&gt;disabled&lt;/code&gt; attribute, and submits forms. A custom button has to rebuild each of these by hand, and missing any of them can block keyboard and screen reader users.&lt;/p&gt;

&lt;h3&gt;
  
  
  How is &lt;code&gt;cy.getByRole()&lt;/code&gt; different from Testing Library’s &lt;code&gt;findByRole()&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;cy.getByRole()&lt;/code&gt; matches native elements by default, yields every match instead of failing on multiple matches, and uses a chained &lt;code&gt;.filter()&lt;/code&gt; for states such as &lt;code&gt;checked&lt;/code&gt; and &lt;code&gt;selected&lt;/code&gt; instead of options.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I find a checked checkbox or a level 2 heading with &lt;code&gt;cy.getByRole()&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;Chain &lt;code&gt;.filter()&lt;/code&gt;. For example, &lt;code&gt;cy.getByRole('checkbox').filter(':checked')&lt;/code&gt; or &lt;code&gt;cy.getByRole('heading').filter('[aria-level="2"], h2:not([aria-level])')&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does &lt;code&gt;cy.getByRole()&lt;/code&gt; work inside shadow DOM?
&lt;/h3&gt;

&lt;p&gt;Yes. Pass &lt;code&gt;includeShadowDom: true&lt;/code&gt;, set the &lt;code&gt;includeShadowDom&lt;/code&gt; configuration option, or chain &lt;code&gt;cy.getByRole()&lt;/code&gt; off &lt;code&gt;.shadow()&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I use &lt;code&gt;cy.getByRole()&lt;/code&gt; or &lt;code&gt;cy.prompt&lt;/code&gt; self-healing to keep tests stable?
&lt;/h3&gt;

&lt;p&gt;They work well together. &lt;code&gt;cy.getByRole()&lt;/code&gt; ties a test to roles and accessible names, which rarely change by accident, and fails when a control loses native behavior. &lt;code&gt;cy.prompt&lt;/code&gt; heals steps when an element changes and marks each heal so you can review it. Preferring &lt;code&gt;role&lt;/code&gt; and &lt;code&gt;aria-label&lt;/code&gt; in your &lt;code&gt;ElementSelector&lt;/code&gt; priority helps &lt;code&gt;cy.prompt&lt;/code&gt; heal less often.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does Cypress Accessibility replace &lt;code&gt;cy.getByRole()&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;No. Cypress Accessibility audits every page state your recorded tests reach, including elements no test touches. &lt;code&gt;cy.getByRole()&lt;/code&gt; is an explicit technique to conveniently locate elements by their accessible role and get a built-in preference for native browser implementations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Will Cypress add other Testing Library queries?
&lt;/h3&gt;

&lt;p&gt;Yes, that’s our plan. &lt;code&gt;cy.getByRole()&lt;/code&gt; is the first, and we’ll announce others as they’re ready.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>a11y</category>
      <category>cypress</category>
      <category>testinglibrary</category>
    </item>
    <item>
      <title>Skip tests that pass on the current build: Re-run optimization in Cypress Cloud</title>
      <dc:creator>Mark Noonan</dc:creator>
      <pubDate>Thu, 01 Oct 2026 16:35:34 +0000</pubDate>
      <link>https://dev.to/cypress/skip-tests-that-pass-on-the-current-build-re-run-optimization-in-cypress-cloud-4ef2</link>
      <guid>https://dev.to/cypress/skip-tests-that-pass-on-the-current-build-re-run-optimization-in-cypress-cloud-4ef2</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flhq8o8mz99p2c3d15ojn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flhq8o8mz99p2c3d15ojn.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When Cypress detects a CI rerun, it can now skip the work that already passed and run only what failed, so you get to green faster, burn fewer CI minutes, and record fewer billable test results. Re-runs with few failures can &lt;strong&gt;skip 99% or more&lt;/strong&gt; of the tests that would have re-executed. It works out-of-the-box with common CI providers, and ships with overrides to customize the re-run behavior to your specific needs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://on.cypress.io/rerun-optimization?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=rerun-optimization&amp;amp;utm_content=rerun-optimization" rel="noopener noreferrer"&gt;&lt;u&gt;Re-run Optimization&lt;/u&gt;&lt;/a&gt; is available for all Business plans and higher, and in &lt;a href="https://on.cypress.io/free-trial?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=rerun-optimization&amp;amp;utm_content=free%20trials" rel="noopener noreferrer"&gt;&lt;u&gt;free trials&lt;/u&gt;&lt;/a&gt;, as a part of Smart Orchestration. &lt;/p&gt;

&lt;p&gt;This post will walk through  the highlights for saving time and getting a green build faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why do teams re-execute failed Cypress runs?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We interviewed current Cypress Cloud customers to get this feature right. Most told us they already use tools like &lt;strong&gt;flake detection&lt;/strong&gt; to stay on top of things they can control from the testing side. Generally their &lt;strong&gt;test design&lt;/strong&gt; is not causing flakiness, and in-run, often flake represents real race-condition bugs in the application logic.&lt;/p&gt;

&lt;p&gt;Re-runs address instability that’s &lt;strong&gt;not&lt;/strong&gt; at the application layer or the test design layer. A re-run &lt;strong&gt;adds information&lt;/strong&gt; to help you understand the full end-to-end picture, especially if your testing environment itself is not fully stable, which means a single failure could have multiple causes. The re-run helps rule some of those causes out cheaply, before you or your AI systems work on debugging.&lt;/p&gt;

&lt;p&gt;For busy teams with large test suites on complicated applications, keeping the test environment stable isn’t always practical, or even necessarily desired. When systems integrate with live devices or depend on third parties, stability itself is part of what a full end-to-end test run is measuring. &lt;/p&gt;

&lt;p&gt;Whatever the underlying reason for a failure, if something is blocking a release or an important merge, your priority in that moment is to understand the issue and get unblocked as fast as possible. At those times, re-run optimization makes your re-executions cheaper, faster, and less painful. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How much time is saved with Re-run optimization in Cypress Cloud?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The most time savings come from test-level re-runs, which allows Cypress to cherry-pick individual tests that need to re-run. Based on real production runs from customers who have adopted this technique, the median re-run skips &lt;strong&gt;92%&lt;/strong&gt; of the original run’s tests, and finishes &lt;strong&gt;9.3 minutes faster&lt;/strong&gt; than the original run. &lt;/p&gt;

&lt;p&gt;The maximum savings we have seen on re-runs are when there are large test suites with small numbers of failures, where &lt;strong&gt;99.8% of the tests that would have re-executed were skipped&lt;/strong&gt; , and &lt;strong&gt;36 minutes were saved&lt;/strong&gt; for the test run. This is the pattern you may see if you run long nightly test suites or pre-release tests of live environments that might have deployments or other disruptions during the test execution.&lt;/p&gt;

&lt;p&gt;Re-run optimization makes it much faster and more practical to get that extra confidence and confirmation of what’s going on when a build has failed, and avoids the risk of instability leading to the original failures passing on the new run, only for something else to start failing.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Choose spec-level or test-level reruns in Cypress Cloud&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You set the granularity once in the Smart Orchestration section of your organization or project settings, and projects can inherit the org default or override it.&lt;/p&gt;

&lt;p&gt;When set to run only failed &lt;strong&gt;specs&lt;/strong&gt; , Cypress re-runs every spec that contained a failure on the last run, including the tests in that spec that passed, which is the safer choice if your tests share state inside a spec.&lt;/p&gt;

&lt;p&gt;When set to run only failed &lt;strong&gt;tests&lt;/strong&gt; , Cypress re-runs only the tests that didn't pass, plus any that are new or changed since the last run. It requires Cypress 15.21.0 or later (older versions fall back to failed specs). If a test would pass on its own with .only, it will work in a re-run. If not, prefer spec-based retries for your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Controlling the re-run behavior in Cypress Cloud&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you re-run before Cloud marks the previous run complete, Cypress plays it safe and runs everything. Keeping your &lt;a href="https://on.cypress.io/parallelization?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=rerun-optimization&amp;amp;utm_content=run-completion-delay" rel="noopener noreferrer"&gt;run completion delay&lt;/a&gt; short can reduce the window where your CI is ready to rerun a job but Cypress Cloud is still open. But in many cases, you may want to manage the previous run’s status explicitly. Our recently released &lt;a href="https://docs.cypress.io/cloud/features/smart-orchestration/run-cancellation-api?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=rerun-optimization&amp;amp;utm_content=run-cancellation-api" rel="noopener noreferrer"&gt;&lt;u&gt;Run Cancellation API&lt;/u&gt;&lt;/a&gt;, and &lt;a href="https://on.cypress.io/parallelization?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=rerun-optimization&amp;amp;utm_content=run-completion-api" rel="noopener noreferrer"&gt;&lt;u&gt;Run Completion API&lt;/u&gt;&lt;/a&gt; give you programmatic control over the run state. Combined with Spec Prioritization and &lt;a href="https://on.cypress.io/run-cancellation?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=rerun-optimization&amp;amp;utm_content=rerun-optimization" rel="noopener noreferrer"&gt;&lt;u&gt;Auto Cancellation&lt;/u&gt;&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Turn it on&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Re-run optimization is part of Smart Orchestration on Business and Enterprise plans, and it's available during a free trial. Owners and Admins can enable it in organization or project settings. The &lt;a href="https://on.cypress.io/rerun-optimization?utm_source=devto&amp;amp;utm_medium=syndication&amp;amp;utm_campaign=rerun-optimization&amp;amp;utm_content=rerun-optimization-docs" rel="noopener noreferrer"&gt;Re-run optimization docs&lt;/a&gt; cover setup for each CI provider.&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>testing</category>
      <category>ci</category>
      <category>rerun</category>
    </item>
    <item>
      <title>Build custom workflows with Cypress Cloud Webhooks</title>
      <dc:creator>Mark Noonan</dc:creator>
      <pubDate>Tue, 08 Sep 2026 17:17:31 +0000</pubDate>
      <link>https://dev.to/cypress/build-custom-workflows-with-cypress-cloud-webhooks-4p6i</link>
      <guid>https://dev.to/cypress/build-custom-workflows-with-cypress-cloud-webhooks-4p6i</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb504ghmymlrvastsr6gp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb504ghmymlrvastsr6gp.png" alt="Push Results with Webhooks" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://on.cypress.io/webhooks?utm_source=devto" rel="noopener noreferrer"&gt;Webhooks&lt;/a&gt; are a new addition to Cypress Cloud, supporting more flexible automation workflows beyond what is built into the platform itself.&lt;/p&gt;

&lt;p&gt;Learn why we've added them and how to get started using them in your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration support in Cypress Cloud
&lt;/h2&gt;

&lt;p&gt;Cypress Cloud supports a wide range of integrations out of the box. If you need a &lt;a href="https://on.cypress.io/github?utm_source=devto&amp;amp;utm_medium=cypress-org&amp;amp;utm_content=cypress-cloud-webhooks#Status-checks" rel="noopener noreferrer"&gt;GitHub status check&lt;/a&gt; for every group of tests in your test run, we've got you covered. &lt;a href="https://docs.cypress.io/cloud/integrations/slack?utm_source=devto&amp;amp;utm_medium=cypress-org&amp;amp;utm_content=cypress-cloud-webhooks" rel="noopener noreferrer"&gt;Slack&lt;/a&gt; and &lt;a href="https://on.cypress.io/microsoft-teams?utm_source=devto&amp;amp;utm_medium=cypress.io&amp;amp;utm_content=cypress-cloud-webhooks" rel="noopener noreferrer"&gt;Teams&lt;/a&gt; messages when a run fails? That's there, along with &lt;a href="https://on.cypress.io/recorded-runs?utm_source=devto&amp;amp;utm_medium=cypress-org&amp;amp;utm_content=cypress-cloud-webhooks#Notifications" rel="noopener noreferrer"&gt;desktop notifications&lt;/a&gt;, &lt;a href="https://on.cypress.io/jira?utm_source=devto&amp;amp;utm_medium=cypress-org&amp;amp;utm_content=cypress-cloud-webhooks" rel="noopener noreferrer"&gt;Jira ticket creation&lt;/a&gt;, &lt;a href="https://on.cypress.io/enterprise-reporting?utm_source=devto&amp;amp;utm_medium=cypress-org&amp;amp;utm_content=cypress-cloud-webhooks" rel="noopener noreferrer"&gt;high-level trend reporting APIs&lt;/a&gt;, and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why webhooks?
&lt;/h2&gt;

&lt;p&gt;Using webhooks is a great solution for &lt;strong&gt;custom integrations&lt;/strong&gt; where you want Cypress Cloud to &lt;strong&gt;push&lt;/strong&gt; run results and other data into another system.&lt;/p&gt;

&lt;p&gt;A webhook can be the starting point to kick off workflows based on inspecting the outcome of a run, or a way to customize the details you will include in a Slack or Teams message, or send messages to destinations Cypress doesn't support, such as Google Chat.&lt;/p&gt;

&lt;p&gt;Webhooks also help you leverage our other recently-released Cypress App and Cypress Cloud updates in ways that work for you. Rather than invoke the Cypress &lt;a href="https://on.cypress.io/cloud-cli?utm_source=devto&amp;amp;utm_medium=cypress-org&amp;amp;utm_content=cypress-cloud-webhooks" rel="noopener noreferrer"&gt;Cloud CLI&lt;/a&gt; or &lt;a href="https://on.cypress.io/cloud-mcp?utm_source=devto&amp;amp;utm_medium=cypress-org&amp;amp;utm_content=cypress-cloud-webhooks" rel="noopener noreferrer"&gt;MCP&lt;/a&gt; at the end of every run, you can set up a URL for Cypress to deliver run results, along with the tags, branch, and commit info that helps you decided if further action is needed.&lt;/p&gt;

&lt;p&gt;This lets you be more efficient with AI token usage and reduce rate-limited request you make for routine run analysis. Filter to just the runs you are most interested in based on the webhook payload, then you can dive deeper with scripts using the Cloud AI tools to get Test Replay snapshot data and command logs, or hand off to your LLM using the live Cypress App running locally with &lt;a href="https://on.cypress.io/cypress-tap?utm_source=devto&amp;amp;utm_medium=cypress-org&amp;amp;utm_content=cypress-cloud-webhooks" rel="noopener noreferrer"&gt;&lt;code&gt;cypress tap&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to use a webhook
&lt;/h2&gt;

&lt;p&gt;In some cases, existing APIs may fully meet your needs, particularly if your runs are small and the existing integrations are well-suited to the content you already want in your messaging platforms.&lt;/p&gt;

&lt;p&gt;In other cases, webhooks remove multiple layers of handoffs from your CI environment to other services, removing glue code or even opening up new possibilities, like optionally triggering re-runs of your failed tests in CI based on the tags or commit message you send to Cypress Cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started
&lt;/h2&gt;

&lt;p&gt;Available on all paid Cypress Cloud plans, today webhooks can be attached to a &lt;code&gt;run.completed&lt;/code&gt; event, which fires when a run has resolved to a finalized state after all results have been recorded.&lt;/p&gt;

&lt;p&gt;Admins and owners can add webhooks in your project settings page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyvglgxe25qczotxevke6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyvglgxe25qczotxevke6.png" alt="webhook creation area of the settings page" width="800" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; the recently-released &lt;a href="https://on.cypress.io/parallelization?utm_source=devto&amp;amp;utm_medium=cypress-org&amp;amp;utm_content=cypress-cloud-webhooks#Run-Completion-API" rel="noopener noreferrer"&gt;Run Completion API&lt;/a&gt; may be useful if you have parallel or grouped runs, and you want your webhooks to fire as soon as all expected groups have finished recording.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;We'd love to know how you are using this and what types of events or payloads would be useful for your specific goals. We will continue developing and expanding in this area based on your feedback.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://on.cypress.iowebhooks?utm_source=devto&amp;amp;utm_medium=cypress-org&amp;amp;utm_content=cypress-cloud-webhooks" rel="noopener noreferrer"&gt;Read the webhooks docs&lt;/a&gt; to get your first webhook configured. Don't have a Cypress Cloud account yet? &lt;a href="https://cloud.cypress.io/signup?utm_source=devto&amp;amp;utm_medium=cypress-org&amp;amp;utm_content=cypress-cloud-webhooks" rel="noopener noreferrer"&gt;Start your free trial&lt;/a&gt; and try it on your own project.&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>webhooks</category>
      <category>slack</category>
      <category>jira</category>
    </item>
    <item>
      <title>cypress tap: Closing the Loop Between Your Agent and Your Suite</title>
      <dc:creator>David Ingraham</dc:creator>
      <pubDate>Fri, 28 Aug 2026 19:03:12 +0000</pubDate>
      <link>https://dev.to/cypress/cypress-tap-closing-the-loop-between-your-agent-and-your-suite-2m1e</link>
      <guid>https://dev.to/cypress/cypress-tap-closing-the-loop-between-your-agent-and-your-suite-2m1e</guid>
      <description>&lt;p&gt;&lt;em&gt;Your agent can write the test and run the test. Until now, it couldn't see the page.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Test failures will happen. Flake will happen. Writing new tests against a product deadline will happen. We've all been there and will be there again in the future.&lt;/p&gt;

&lt;p&gt;Software development is predictable that way, and completely fluid at the same time, which is what makes every day a slightly different problem than the one before it.&lt;/p&gt;

&lt;p&gt;As we've all started folding AI into that work, we've learned it's extremely good at producing a lot of code, fast. And one rule has held up better than any other: the better your inputs and the more context the tool has, the better the output. That's the whole reason we encode conventions as Skills, point agents at tickets through MCP, and hand them our patterns instead of hoping they guess right.&lt;/p&gt;

&lt;p&gt;But there's a ceiling, and it shows up the moment the agent has to work against a running app.&lt;/p&gt;

&lt;p&gt;When it's debugging a broken test or writing a new one, it can't see the DOM. It sees whatever I paste in. No matter how good the Skills are or how well-structured the repo is, the agent is reasoning about a page it has never actually looked at.&lt;/p&gt;

&lt;p&gt;That's the gap, and it sits in the middle of a loop we all run every day:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The agent writes the test.&lt;/li&gt;
&lt;li&gt;The suite runs it.&lt;/li&gt;
&lt;li&gt;Somebody reads what happened.&lt;/li&gt;
&lt;li&gt;The agent revises.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Steps 1, 2, and 4 have been handled for a while now.&lt;/p&gt;

&lt;p&gt;Step 3 was me, until now.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Read Interface, Not a Writer
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://docs.cypress.io/app/references/command-line#cypress-tap" rel="noopener noreferrer"&gt;cypress tap&lt;/a&gt; is a set of CLI commands that read and drive an open-mode Cypress session from your terminal.&lt;/p&gt;

&lt;p&gt;Setup is two terminals. &lt;code&gt;cypress open&lt;/code&gt; in one, &lt;code&gt;cypress tap&lt;/code&gt; from the same project root in the other. No config, no server, no MCP.&lt;/p&gt;

&lt;p&gt;The subcommands split into three jobs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Find and run:&lt;/strong&gt; &lt;code&gt;sessions&lt;/code&gt;, &lt;code&gt;specs&lt;/code&gt;, &lt;code&gt;status&lt;/code&gt;, &lt;code&gt;run&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read results:&lt;/strong&gt; &lt;code&gt;reporter&lt;/code&gt;, &lt;code&gt;command&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interrogate the page:&lt;/strong&gt; &lt;code&gt;pin&lt;/code&gt;, &lt;code&gt;dom&lt;/code&gt;, &lt;code&gt;aria&lt;/code&gt;, &lt;code&gt;inspect&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything prints readable output by default and machine-readable JSON with &lt;code&gt;--json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The thing worth noticing is what isn't in that list.&lt;/p&gt;

&lt;p&gt;There's no &lt;code&gt;tap write&lt;/code&gt;. No &lt;code&gt;tap fix&lt;/code&gt;. No &lt;code&gt;tap generate&lt;/code&gt;. It takes the context the Cypress app was already showing you on screen and puts it somewhere a terminal, or an agent working in one, can actually reach.&lt;/p&gt;

&lt;h2&gt;
  
  
  Breaking a Test Purposefully
&lt;/h2&gt;

&lt;p&gt;I have a fake pet adoption site I use for testing out new automation features and for creating workshops against. This exciting new feature was one I hooked up to that repo.&lt;/p&gt;

&lt;p&gt;To demo what &lt;code&gt;tap&lt;/code&gt; actually does, I needed something red to point at, so I broke it deliberately: I renamed an app-side &lt;code&gt;data-testid&lt;/code&gt; from &lt;code&gt;favorite-button-*&lt;/code&gt; to &lt;code&gt;favorite-toggle-*&lt;/code&gt; and left the spec untouched.&lt;/p&gt;

&lt;p&gt;Deliberately simple, too. The point here isn't the puzzle in the break, it's how the agent utilizes &lt;code&gt;cypress tap&lt;/code&gt; to get to the solution and how this new approach can be scaled to more complicated, real-life scenarios.&lt;/p&gt;

&lt;p&gt;Here's the whole diagnosis, terminal only.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Is there a session I can reach?&lt;/strong&gt; &lt;code&gt;cypress tap&lt;/code&gt; drives an already-open Cypress, so first prove one exists using &lt;code&gt;tap sessions&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx cypress tap sessions
SESSIONS &lt;span class="o"&gt;(&lt;/span&gt;1&lt;span class="o"&gt;)&lt;/span&gt;
  PID    PROJECT                                         TYPE  BROWSER
  29426  /Users/davidingraham/repos/pet-adoption-portal  e2e   Chrome
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. What can it run?&lt;/strong&gt; Using &lt;code&gt;tap specs&lt;/code&gt; it identifies the open spec from the runner.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx cypress tap specs
SPECS &lt;span class="o"&gt;(&lt;/span&gt;1&lt;span class="o"&gt;)&lt;/span&gt;
  cypress/e2e/favorites.cy.js  9 minutes ago
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Trigger the failure.&lt;/strong&gt; Next it runs the open spec so it can capture the current output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx cypress tap run cypress/e2e/favorites.cy.js
▶ cypress/e2e/favorites.cy.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. The failure as text.&lt;/strong&gt; The bare &lt;code&gt;reporter&lt;/code&gt; command returns the suite summary. As you can see, I only ran one test and I knew it was going to fail. I imagine when you are actively working on building multiple tests at once, the &lt;code&gt;reporter&lt;/code&gt; command will be a great translator between what is happening in the runner and what the agent knows as changes are made.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx cypress tap reporter
cypress/e2e/favorites.cy.js  &lt;span class="o"&gt;(&lt;/span&gt;started at 7:21:21 PM&lt;span class="o"&gt;)&lt;/span&gt;
✓ &lt;span class="nt"&gt;--&lt;/span&gt;  ✖ 1  ○ &lt;span class="nt"&gt;--&lt;/span&gt;  00:04

Favorites Feature
   r3  ✖ adds a pet to favorites  4.2s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Expand the failing test.&lt;/strong&gt; The agent can pass in additional flags to expand on what happened at each step, all the way up until the captured failure. Note the test id, &lt;code&gt;r3&lt;/code&gt;, which every command from here on scopes to.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx cypress tap reporter &lt;span class="nt"&gt;--test-id&lt;/span&gt; r3
✖ Favorites Feature &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; adds a pet to favorites  failed

ROUTES &lt;span class="o"&gt;(&lt;/span&gt;1&lt;span class="o"&gt;)&lt;/span&gt;
  METHOD  MATCHER             STUBBED  ALIAS        &lt;span class="c"&gt;#&lt;/span&gt;
  POST    &lt;span class="k"&gt;**&lt;/span&gt;/api/favorites/&lt;span class="k"&gt;*&lt;/span&gt;  no       addFavorite  -

BEFORE EACH · h1
   1  request  ● POST 200 http://localhost:3000/api/auth/login
   2  request  ● GET 200 http://localhost:3000/api/favorites
   3  visit    /pets

TEST BODY · r3
   1  get      &lt;span class="o"&gt;[&lt;/span&gt;data-testid&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"pets-grid"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
  e1    &lt;span class="o"&gt;(&lt;/span&gt;xhr&lt;span class="o"&gt;)&lt;/span&gt; ● GET 200 http://localhost:3000/api/auth/me
  e2    &lt;span class="o"&gt;(&lt;/span&gt;xhr&lt;span class="o"&gt;)&lt;/span&gt; ● GET 200 http://localhost:3000/api/auth/me
  e3    &lt;span class="o"&gt;(&lt;/span&gt;xhr&lt;span class="o"&gt;)&lt;/span&gt; ● GET 200 http://localhost:3000/api/pets?species&lt;span class="o"&gt;=&lt;/span&gt;&amp;amp;age&lt;span class="o"&gt;=&lt;/span&gt;&amp;amp;size&lt;span class="o"&gt;=&lt;/span&gt;&amp;amp;gender&lt;span class="o"&gt;=&lt;/span&gt;&amp;amp;search&lt;span class="o"&gt;=&lt;/span&gt;&amp;amp;sortBy&lt;span class="o"&gt;=&lt;/span&gt;dateAdded&amp;amp;sortOrder&lt;span class="o"&gt;=&lt;/span&gt;desc&amp;amp;page&lt;span class="o"&gt;=&lt;/span&gt;1
  e4    &lt;span class="o"&gt;(&lt;/span&gt;xhr&lt;span class="o"&gt;)&lt;/span&gt; ● GET 200 http://localhost:3000/api/favorites
   2  &lt;span class="nt"&gt;-assert&lt;/span&gt;  expected &amp;lt;div.grid.md:grid-cols-2.gap-6&amp;gt; to be visible
   3  get      &lt;span class="o"&gt;[&lt;/span&gt;data-testid^&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"favorite-button-"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; ✖

✖ AssertionError
  Timed out retrying after 4000ms: Expected to find element: &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;data-testid^&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"favorite-button-"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;, but never found it.

cypress/e2e/favorites.cy.js:29:8
    27 |
    28 |     cy.intercept&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'POST'&lt;/span&gt;, &lt;span class="s1"&gt;'**/api/favorites/*'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.as&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'addFavorite'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 29 |     cy.get&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'[data-testid^="favorite-button-"]'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.first&lt;span class="o"&gt;()&lt;/span&gt;.as&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'favoriteButton'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.click&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
       |        ^
    30 |     cy.wait&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@addFavorite'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.its&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'response.statusCode'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.should&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'eq'&lt;/span&gt;, 201&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    31 |
    32 |     cy.get&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@favoriteButton'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.should&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'contain'&lt;/span&gt;, &lt;span class="s1"&gt;'❤️'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. Pull the failing command as data.&lt;/strong&gt; Command 3 is the one that failed, so the agent asks for it directly. This is the Command Log row as structured output rather than something you hover in the UI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx cypress tap &lt;span class="nb"&gt;command&lt;/span&gt; &lt;span class="nt"&gt;--test-id&lt;/span&gt; r3 &lt;span class="nt"&gt;--command-id&lt;/span&gt; 3
TEST BODY · r3
✖  3  get  &lt;span class="o"&gt;[&lt;/span&gt;data-testid^&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"favorite-button-"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;  failed

CONSOLE PROPS
  Selector  &lt;span class="o"&gt;[&lt;/span&gt;data-testid^&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"favorite-button-"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
  Elements  0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;7. Put the at-failure DOM back on screen.&lt;/strong&gt; &lt;code&gt;pin&lt;/code&gt; pushes that command's snapshot into the live browser frame, so everything that follows is querying the page exactly as it looked when the test broke.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx cypress tap pin &lt;span class="nt"&gt;--test-id&lt;/span&gt; r3 &lt;span class="nt"&gt;--command-id&lt;/span&gt; 3
⚲ PINNED - &lt;span class="o"&gt;(&lt;/span&gt;1/1&lt;span class="o"&gt;)&lt;/span&gt;
TEST BODY · r3
   3  get  &lt;span class="o"&gt;[&lt;/span&gt;data-testid^&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"favorite-button-"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; ✖
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;8. Ask the page what's actually there.&lt;/strong&gt; Next it can read the real ARIA tree from the DOM, which shows twelve favorite buttons rendered and healthy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx cypress tap aria
navigation
  &lt;span class="nb"&gt;link&lt;/span&gt;  🐾 PawMatch
  ...
main
  heading  Adopt a Pet
  ...
  image  Scout
  button  🤍
  heading  Scout
  button  View Details →
  &lt;span class="o"&gt;[&lt;/span&gt;...eleven more pet cards...]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;9. Inspect the element itself.&lt;/strong&gt; Finally, &lt;code&gt;tap inspect&lt;/code&gt; returns the actual attributes on that button, which is where the answer is sitting.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx cypress tap inspect &lt;span class="nt"&gt;--selector&lt;/span&gt; &lt;span class="s1"&gt;'.grid button[data-testid]'&lt;/span&gt; &lt;span class="nt"&gt;--at&lt;/span&gt; 0
ATTRIBUTES &lt;span class="o"&gt;(&lt;/span&gt;2&lt;span class="o"&gt;)&lt;/span&gt;
  data-testid  favorite-toggle-18
  class        absolute top-3 right-3 w-10 h-10 bg-white/90 ...

ACCESSIBILITY
  role  button
  name  🤍

BOX
  x 189   y 564   width 40   height 40
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two lines carry the whole diagnosis.&lt;/p&gt;

&lt;p&gt;Step 6 says &lt;code&gt;Elements 0&lt;/code&gt;. Step 9 says &lt;code&gt;favorite-toggle-18&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The button was there the entire time. Visible, clickable, exactly where it should be. What changed was its contract with the test.&lt;/p&gt;

&lt;p&gt;That's a diagnosis I'd previously have assembled by clicking the red row in the Command Log, hovering the snapshot, opening DevTools on the runner, and squinting at the Elements panel to compare attribute names. Here it's text I can paste straight into the fix commit.&lt;/p&gt;

&lt;p&gt;The fix is a one-line selector update, and &lt;code&gt;tap run&lt;/code&gt; plus &lt;code&gt;tap reporter&lt;/code&gt; confirm it green, without ever touching the GUI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx cypress tap reporter
cypress/e2e/favorites.cy.js  &lt;span class="o"&gt;(&lt;/span&gt;started at 7:22:21 PM&lt;span class="o"&gt;)&lt;/span&gt;
✓ 1  ✖ &lt;span class="nt"&gt;--&lt;/span&gt;  ○ &lt;span class="nt"&gt;--&lt;/span&gt;  310ms

Favorites Feature
   r3  ✓ adds a pet to favorites  302ms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Scale This Up
&lt;/h2&gt;

&lt;p&gt;The demo above was a single renamed attribute. Sure I could have solved it by eye, but think about the front ends most of us are actually testing. Virtualized tables that only render what's in view. Nested modals and portals. Shadow DOM. Component libraries that regenerate class names on every build. Accessibility trees that don't match the visual order. Conditional rendering three states deep, where the element exists in one branch and not the other.&lt;/p&gt;

&lt;p&gt;When one of those fails, the hard question is almost never what the error was. The error is right there in the stack trace. The hard question is what was on the page at the moment it broke, and that has always meant a human clicking into the runner and looking.&lt;/p&gt;

&lt;p&gt;That's the context that's been missing. Not smarter models, not better prompts. Just a way to ask the page what it looked like and get an answer back as text. &lt;code&gt;tap aria&lt;/code&gt; and &lt;code&gt;tap inspect&lt;/code&gt; produce that on demand now, which is incredibly powerful and exciting.&lt;/p&gt;

&lt;p&gt;On a real application, it's the difference between an agent that can help with triage and one that can only guess at it. I'm looking forward to seeing how many wasted agent cycles disappear now that it has the product context it always needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  What It Needs to Run
&lt;/h2&gt;

&lt;p&gt;It's a local development tool. &lt;code&gt;tap&lt;/code&gt; reads an open-mode session, and &lt;code&gt;cypress open&lt;/code&gt; has to be running on the same machine. Sessions register themselves in a shared cache, which is how &lt;code&gt;tap sessions&lt;/code&gt; finds them.&lt;/p&gt;

&lt;p&gt;There's no headless story, so you can't drop tap into a CI job or a nightly run. This isn't a knock on tap, it's just not how it is designed. CI has no open-mode session in a pipeline for it to read. If you were hoping to hand failure context to an agent triaging a 2am CI failure, that isn't this. At least not yet.&lt;/p&gt;

&lt;p&gt;It also means someone has to keep the runner open. Close the session and the agent goes blind mid-task. That's a non-issue when you're sitting there working, but worth knowing if you're multi-tasking or handing work off.&lt;/p&gt;

&lt;p&gt;Here's the flip side of that though: because &lt;code&gt;cypress open&lt;/code&gt; is up, you're watching. The browser is right there. The agent kicks off the spec and you see the run happen while the terminal narrates it. That's a very different experience from an agent working headless and reporting back a summary. You get the machine-readable context and your own eyes on the same run, at the same time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Back to the loop.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The agent writes the test.&lt;/li&gt;
&lt;li&gt;The suite runs it.&lt;/li&gt;
&lt;li&gt;Somebody reads what happened.&lt;/li&gt;
&lt;li&gt;The agent revises.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Steps 1, 2, and 4 were never the hard part and those solutions have been around for a while. &lt;code&gt;cypress tap&lt;/code&gt; hands step 3 over. The Command Log as text. The failing command as data. The DOM and the accessibility tree, on demand, exactly as they were when things broke.&lt;/p&gt;

&lt;p&gt;Failures are still going to happen. Flake is still going to happen. The deadlines are definitely not moving. What changes is how fast you find out why, and how much of that you have to type out yourself in the age of AI.&lt;/p&gt;

&lt;p&gt;Point your agent at it on the next red test and see if your triage gets shorter.&lt;/p&gt;

&lt;p&gt;I'm pretty excited about this one and can't wait to fully implement it.&lt;/p&gt;

&lt;p&gt;As always, happy testing.&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>automation</category>
      <category>ai</category>
    </item>
    <item>
      <title>Building Mocks-First Automated Testing with Cypress and AWS DynamoDB</title>
      <dc:creator>Sehani Chathurangi</dc:creator>
      <pubDate>Fri, 14 Aug 2026 10:10:37 +0000</pubDate>
      <link>https://dev.to/cypress/building-mocks-first-automated-testing-with-cypress-and-aws-dynamodb-3ngh</link>
      <guid>https://dev.to/cypress/building-mocks-first-automated-testing-with-cypress-and-aws-dynamodb-3ngh</guid>
      <description>&lt;p&gt;When testing applications that depend on cloud services, manually preparing database records for every test can quickly become time-consuming, repetitive, and error-prone.&lt;/p&gt;

&lt;p&gt;A better approach is to automate test-data creation using reusable fixtures, custom Cypress tasks, and the AWS SDK.&lt;/p&gt;

&lt;p&gt;In this article, I'll walk through how I built a &lt;strong&gt;mocks-first testing approach using Cypress and AWS DynamoDB&lt;/strong&gt;, where each test can create the data it needs, execute independently, and verify the resulting database state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Mocks-First Testing?
&lt;/h2&gt;

&lt;p&gt;A mocks-first approach allows tests to control their required data and dependencies instead of relying on manually prepared records.&lt;/p&gt;

&lt;p&gt;Rather than creating database records before running a test, the test itself prepares the required state during execution.&lt;/p&gt;

&lt;p&gt;This provides several benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Faster test execution&lt;/li&gt;
&lt;li&gt;Repeatable test scenarios&lt;/li&gt;
&lt;li&gt;Reusable test data&lt;/li&gt;
&lt;li&gt;Less manual setup&lt;/li&gt;
&lt;li&gt;Better test isolation&lt;/li&gt;
&lt;li&gt;Easier maintenance&lt;/li&gt;
&lt;li&gt;More reliable CI/CD execution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not to mock every AWS service. Instead, the approach focuses on &lt;strong&gt;controlling test data and external dependencies so that tests remain predictable and repeatable&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Overall Approach
&lt;/h2&gt;

&lt;p&gt;The architecture can be summarized as:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cypress Test → &lt;code&gt;cy.task()&lt;/code&gt; → Node.js → AWS SDK → DynamoDB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Cypress test is responsible for describing the scenario and assertions, while the Node.js layer handles AWS-specific operations.&lt;/p&gt;

&lt;p&gt;This separation keeps the test code clean and prevents AWS database logic from being duplicated across test cases.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1: Create Reusable Mock Data
&lt;/h2&gt;

&lt;p&gt;The first step is to create reusable JSON fixtures.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cypress/
└── fixtures/
    └── test-data.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fixture contains the information required to create the database record.&lt;/p&gt;

&lt;p&gt;Instead of hardcoding database values inside every test, the fixture becomes the base payload that can be reused across multiple scenarios.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"test-12345"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Sample Test Data"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"TEST"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ACTIVE"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Different fixtures can also be created for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Positive scenarios&lt;/li&gt;
&lt;li&gt;Negative scenarios&lt;/li&gt;
&lt;li&gt;Boundary conditions&lt;/li&gt;
&lt;li&gt;Error scenarios&lt;/li&gt;
&lt;li&gt;Different transaction states&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This keeps test data separate from test logic.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Separate Database Logic
&lt;/h2&gt;

&lt;p&gt;The next step is to keep DynamoDB operations outside the Cypress test itself.&lt;/p&gt;

&lt;p&gt;A dedicated helper can be responsible for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating the DynamoDB client&lt;/li&gt;
&lt;li&gt;Converting fixture data into database records&lt;/li&gt;
&lt;li&gt;Generating partition keys and sort keys&lt;/li&gt;
&lt;li&gt;Calculating TTL values&lt;/li&gt;
&lt;li&gt;Inserting records&lt;/li&gt;
&lt;li&gt;Retrieving records&lt;/li&gt;
&lt;li&gt;Deleting test data when required&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, a helper might expose operations such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;insertMockData()
getMockData()
deleteMockData()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important principle is &lt;strong&gt;separation of concerns&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The test should describe &lt;em&gt;what data it needs&lt;/em&gt;, while the helper handles &lt;em&gt;how that data is stored in DynamoDB&lt;/em&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Expose Database Operations Through Cypress Tasks
&lt;/h2&gt;

&lt;p&gt;Cypress provides &lt;code&gt;cy.task()&lt;/code&gt; as a bridge between the Cypress test environment and Node.js.&lt;/p&gt;

&lt;p&gt;Instead of putting AWS SDK operations directly inside the browser-side test, the test can call a custom task:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;insertMockData&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;mockData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The flow becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cypress Test
     │
     ▼
 cy.task()
     │
     ▼
 Node.js
     │
     ▼
 AWS SDK
     │
     ▼
 DynamoDB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Typical Cypress tasks can include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;insertMockData&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;getMockData&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;deleteMockData&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach centralizes AWS operations and makes them reusable across the entire test suite.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4: Configure Environment Variables
&lt;/h2&gt;

&lt;p&gt;Cloud configuration should never be hardcoded inside test files.&lt;/p&gt;

&lt;p&gt;Environment-specific values can be provided through configuration such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Region&lt;/li&gt;
&lt;li&gt;AWS credentials&lt;/li&gt;
&lt;li&gt;DynamoDB table name&lt;/li&gt;
&lt;li&gt;Local DynamoDB endpoint&lt;/li&gt;
&lt;li&gt;Other environment-specific settings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows the same test suite to run against different environments.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Local
  ↓
Development
  ↓
QA
  ↓
CI/CD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The test logic remains unchanged while the configuration changes according to the execution environment.&lt;/p&gt;

&lt;p&gt;Credentials and secrets should always be managed securely and should never be committed to the repository.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5: Build Flexible Test Data
&lt;/h2&gt;

&lt;p&gt;Creating a separate fixture for every test scenario can eventually lead to duplicated test data.&lt;/p&gt;

&lt;p&gt;Instead, a base fixture can be loaded and overridden only where necessary.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;testData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;baseFixture&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`test-&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;INACTIVE&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The base fixture provides the common structure, while the test customizes only the values relevant to the scenario.&lt;/p&gt;

&lt;p&gt;This approach makes it easier to generate unique test records while keeping the fixture maintainable.&lt;/p&gt;

&lt;p&gt;It is especially useful when testing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiple transactions&lt;/li&gt;
&lt;li&gt;Different statuses&lt;/li&gt;
&lt;li&gt;Different merchants&lt;/li&gt;
&lt;li&gt;Edge cases&lt;/li&gt;
&lt;li&gt;Concurrent processing&lt;/li&gt;
&lt;li&gt;Large datasets&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 6: Verify the Database State
&lt;/h2&gt;

&lt;p&gt;Creating test data is only part of the process.&lt;/p&gt;

&lt;p&gt;After the application processes the data, the test should retrieve the relevant DynamoDB record and validate the resulting state.&lt;/p&gt;

&lt;p&gt;Typical validations include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Record exists&lt;/li&gt;
&lt;li&gt;Partition key is correct&lt;/li&gt;
&lt;li&gt;Sort key is correct&lt;/li&gt;
&lt;li&gt;Required attributes are stored&lt;/li&gt;
&lt;li&gt;Status is updated correctly&lt;/li&gt;
&lt;li&gt;Configuration values match expectations&lt;/li&gt;
&lt;li&gt;TTL is generated correctly&lt;/li&gt;
&lt;li&gt;Expected processing results are persisted&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Insert test data
       ↓
Application processes data
       ↓
Retrieve DynamoDB record
       ↓
Validate final state
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows the test to validate not only that data can be written, but also that the application's workflow produces the expected result.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why This Structure Works
&lt;/h2&gt;

&lt;p&gt;The approach separates the test suite into three main responsibilities:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fixtures
   ↓
Test Data

Database Helpers
   ↓
AWS / DynamoDB Operations

Cypress Tests
   ↓
Business Scenarios + Assertions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This separation provides a cleaner architecture and makes individual components easier to maintain.&lt;/p&gt;

&lt;p&gt;If the DynamoDB implementation changes, the test cases do not necessarily need to change.&lt;/p&gt;

&lt;p&gt;If the test scenario changes, the AWS helper does not need to change.&lt;/p&gt;




&lt;h2&gt;
  
  
  Moving Toward Event-Driven Testing
&lt;/h2&gt;

&lt;p&gt;Directly inserting records into DynamoDB is useful for preparing controlled test states, but it can also bypass parts of the application's normal workflow.&lt;/p&gt;

&lt;p&gt;This approach can therefore become the foundation for a more complete &lt;strong&gt;event-driven testing strategy&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The current approach might look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fixture
   ↓
Cypress Task
   ↓
DynamoDB
   ↓
Application / Verification
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next evolution could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fixture
   ↓
Event / SNS
   ↓
Application
   ↓
DynamoDB
   ↓
Cypress Verification
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of directly creating the database record, the same mock payload can be published as an event.&lt;/p&gt;

&lt;p&gt;The application then processes the event through its normal workflow, and Cypress verifies the final database state.&lt;/p&gt;

&lt;p&gt;The biggest advantage is that the &lt;strong&gt;test-data model can remain reusable&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The injection point changes, but the underlying fixture structure can remain largely the same.&lt;/p&gt;




&lt;h2&gt;
  
  
  When This Approach Is Useful
&lt;/h2&gt;

&lt;p&gt;This pattern works particularly well for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integration testing&lt;/li&gt;
&lt;li&gt;Event-driven applications&lt;/li&gt;
&lt;li&gt;DynamoDB-backed services&lt;/li&gt;
&lt;li&gt;CI/CD pipelines&lt;/li&gt;
&lt;li&gt;Repeatable test scenarios&lt;/li&gt;
&lt;li&gt;Large-scale automated test suites&lt;/li&gt;
&lt;li&gt;Tests requiring controlled database state&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, direct database seeding should be used carefully for end-to-end testing because it can bypass application logic that you may actually want to validate.&lt;/p&gt;

&lt;p&gt;A good testing strategy can use both approaches:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Database seeding&lt;/strong&gt; for controlled setup and targeted integration tests.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event/API-driven setup&lt;/strong&gt; for validating the application's complete workflow.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Benefits
&lt;/h2&gt;

&lt;p&gt;Using reusable fixtures together with Cypress tasks provides several advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cleaner test code&lt;/strong&gt; — AWS logic stays outside the test cases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reusable mock data&lt;/strong&gt; — Fixtures can support many scenarios.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reduced duplication&lt;/strong&gt; — Base data can be overridden when needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faster execution&lt;/strong&gt; — Tests do not depend on manual database preparation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Better test isolation&lt;/strong&gt; — Each test can create its own required state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Centralized AWS logic&lt;/strong&gt; — DynamoDB operations are maintained in one place.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI/CD friendly&lt;/strong&gt; — Test data can be generated automatically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easy evolution&lt;/strong&gt; — The same data model can support future event-driven testing.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Automating database setup with reusable fixtures, Cypress tasks, and the AWS SDK can remove a significant amount of repetitive manual work from integration testing.&lt;/p&gt;

&lt;p&gt;The key is to keep &lt;strong&gt;test data, database operations, and test scenarios separate&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of manually preparing DynamoDB records before every test, the test suite becomes responsible for creating the state it needs and validating the resulting behavior.&lt;/p&gt;

&lt;p&gt;More importantly, this approach creates a foundation for moving toward event-driven testing. As the application architecture evolves, the same reusable test data can be injected through events and processed through the application's normal workflow.&lt;/p&gt;

&lt;p&gt;The result is a testing architecture that is &lt;strong&gt;repeatable, maintainable, scalable, and easier to integrate into CI/CD pipelines&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>aws</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>Teaching an Agent to Triage Flaky Tests — and to Know When Not To</title>
      <dc:creator>Lyle Smart</dc:creator>
      <pubDate>Thu, 06 Aug 2026 18:32:22 +0000</pubDate>
      <link>https://dev.to/cypress/teaching-an-agent-to-triage-flaky-tests-and-to-know-when-not-to-jnh</link>
      <guid>https://dev.to/cypress/teaching-an-agent-to-triage-flaky-tests-and-to-know-when-not-to-jnh</guid>
      <description>&lt;p&gt;&lt;strong&gt;Teaching an Agent to Triage Flaky Tests — and to Know When Not To&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every team with a mature Cypress suite eventually meets the same quiet adversary: the flaky test. Not the broken test—the flaky one. It fails, then passes on retry, so nobody files it, so it lingers. Over time, "just re-run it" stops being a workaround and becomes a habit, and that habit costs you the one thing an end-to-end suite is supposed to give you: confidence.&lt;/p&gt;

&lt;p&gt;We decided to stop treating flake as background noise and start treating it as a signal worth acting on every single morning. So we built an autonomous agent to do the triage a human never quite finds time for. What we learned building it had less to do with automation than we expected, and a lot to do with judgment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Turning a Number Nobody Reads into a Decision&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The data was already there. Cypress Cloud records a flaky_test_count on every CI run and can tell you precisely which tests flaked—the error name, the message, the failing line of the stack, attempt by attempt. That is a rich signal. It was also, for us, a number that scrolled past unread.&lt;/p&gt;

&lt;p&gt;So we gave the agent a way to read it directly. We use the Cypress MCP server to dial into Cypress Cloud. It is the pipe through which the agent pulls recent runs and, for any run that flaked, the per-attempt failure detail behind each one. No scraping dashboards. No exporting CSVs. The agent simply asks Cypress Cloud what happened and gets back structured data, which is exactly what makes the rest of the loop possible.&lt;/p&gt;

&lt;p&gt;Each weekday it scans the last fifty completed CI runs, tallies flakiness per test, and applies a deliberately blunt rule: a test is only a candidate if it flaked in three or more distinct runs. One bad night is not a pattern. A test that wobbles across three separate runs is telling you something. That threshold is the difference between a useful beacon and an alarm everyone learns to mute.&lt;/p&gt;

&lt;p&gt;From there the loop is end to end, and this is where the second tool earns its place. We use Claude to review and fix the tests. It reads the failure detail surfaced through the Cypress MCP server, opens the actual spec file, groups failures into distinct modes, and writes a concrete, code-level diagnosis. Where a spec change is genuinely the right answer, it proposes the fix itself.&lt;/p&gt;

&lt;p&gt;The agent then deduplicates against Jira so the same flake is never filed twice, creates one ticket per flaky test on our QE board, @mentions the appropriate team, posts a summary to Slack, and updates a running tally in Confluence so the trend is visible to anyone who cares to look.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Most Important Thing It Does Is Refuse&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is where the project stopped being about automation.&lt;/p&gt;

&lt;p&gt;The obvious way to build a test-fixing agent is to let it fix everything. Point it at a red test and let it turn the test green. But a flaky test is often not a test problem at all—it is a product telling you the truth in an inconvenient way.&lt;/p&gt;

&lt;p&gt;A backend might return a 500 during a read-after-write race. A page might render late because grading happens server-side. Increase the Cypress timeout and the test goes green, but you have not removed the flake. You have hidden a real bug and taught your suite to lie.&lt;/p&gt;

&lt;p&gt;So the single most important rule in the agent is one of restraint.&lt;/p&gt;

&lt;p&gt;It proposes a fix only when a spec change genuinely stabilizes the test. When the root cause is application-side or infrastructure-related, it files the ticket, classifies it clearly, and opens no pull request at all.&lt;/p&gt;

&lt;p&gt;It is not there to make tests pass.&lt;/p&gt;

&lt;p&gt;It is there to tell you why they don't.&lt;/p&gt;

&lt;p&gt;When it does propose a fix, that fix stays inside a narrow lane:&lt;/p&gt;

&lt;p&gt;Draft pull requests only&lt;br&gt;
Cypress spec files only&lt;br&gt;
Never application source code&lt;br&gt;
Clearly labeled as auto-generated and unverified&lt;/p&gt;

&lt;p&gt;The pull request's own CI run is the real verification. The agent's confidence is never mistaken for correctness.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Giving It a Memory—and a Rule About That Memory&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Diagnosis is the part of this an agent is most likely to get wrong, so we gave it something to lean on: a committed file of confirmed root-cause patterns.&lt;/p&gt;

&lt;p&gt;Each entry pairs a spec family and an error signature with:&lt;/p&gt;

&lt;p&gt;The confirmed root cause&lt;br&gt;
The correct classification&lt;br&gt;
The band-aid fix to avoid&lt;/p&gt;

&lt;p&gt;Before diagnosing anything, the agent reads this file and reuses what a human has already worked out rather than re-deriving a cause it has gotten wrong before.&lt;/p&gt;

&lt;p&gt;The rule governing that file matters just as much as the file itself.&lt;/p&gt;

&lt;p&gt;Confirmed causes only.&lt;/p&gt;

&lt;p&gt;Never a fresh guess.&lt;/p&gt;

&lt;p&gt;Codifying an unverified diagnosis would teach the agent to repeat exactly the mistake the file exists to prevent. A provisional hunch stays in the Jira ticket, where a human can weigh it. It never graduates to institutional memory until someone confirms it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Actually Changed&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Flaky tests now get triaged within minutes instead of never.&lt;/p&gt;

&lt;p&gt;The team wakes up to a Slack summary and a short stack of tickets, many with a draft fix already attached and the rest clearly marked as something a person needs to investigate.&lt;/p&gt;

&lt;p&gt;We can finally see, month over month, whether the suite is getting healthier.&lt;/p&gt;

&lt;p&gt;The outcome we did not anticipate is that a meaningful share of what we had lazily filed under "flaky" turned out to be genuine product race conditions—bugs that now receive a bug's attention instead of a timeout bump.&lt;/p&gt;

&lt;p&gt;If I could leave other Cypress teams with one reflection, it is this:&lt;/p&gt;

&lt;p&gt;The agent's most valuable trait is not how much it automates. It is that it knows the difference between a test problem and a product bug, and refuses to paper over the second.&lt;/p&gt;

&lt;p&gt;AI can accelerate the triage none of us had time for. But the judgment about what deserves a fix—and what deserves the truth—still has to be built in on purpose.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>automation</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
