title: How to force fail a test in Cypress.io
body: <p>In Cypress.io is there a way that I can force a test to fail if a certain condition is met?</p>
  <p>For example, on my webpage, if the string &quot;Sorry, something went wrong.&quot; is present on the page I want the test to fail. Currently here is what I am doing.</p>
  <pre class="lang-js prettyprint-override"><code>/// &lt;reference types=&quot;Cypress&quot; /&gt;
  
  describe(&quot;These tests are designed to fail if certain criteria are met.&quot;, () =&gt; {
    beforeEach(() =&gt; {
      cy.visit(&quot;&quot;);
    });
  
    specify(&quot;If 'Sorry, something went wrong.' is present on page, FAIL &quot;, () =&gt; {
      cy.contains(&quot;Sorry, something went wrong.&quot;);
    });
  });
  </code></pre>
  <p>Right now, if &quot;Sorry, something went wrong.&quot; is found, the test succeeds. How do I fail the test if this condition is met?</p>