title: cypress.io: contains() not waiting for element
body: <p>We are writing UI tests with cypress, which is usually quite simple to use. But again and again I stumble over a tedious waiting problem.</p>
  
  <p>The scenario is pretty simple. The user clicks on the search button. Then he selects one of the elements with a certain text. Here's the code:</p>
  
  <pre><code>cy.get('#search-button').click();
  cy.contains('Test item 1').click();
  cy.get('#cheapest-offer-button').click();
  </code></pre>
  
  <p>The third click event fails, because already <code>cy.contains('Test item 1')</code> doesn't wait for the page and the element to be rendered. From what I can see in the test steps, it simply clicks in the middle of the page, which does essentially nothing. So all subsequent steps fail of course.</p>
  
  <p>However if I add a <code>wait()</code> between the calls like this:</p>
  
  <pre><code>cy.get('#search-button').click();
  cy.wait(2000);
  cy.contains('Test item 1').click();
  cy.get('#cheapest-offer-button').click();    
  </code></pre>
  
  <p>The page is rendered correctly, <code>Test item 1</code> appears, is clicked and all subsequent steps succeed. </p>
  
  <p>According the <a href="https://docs.cypress.io/guides/references/best-practices.html#Unnecessary-Waiting" rel="noreferrer">best practices</a> the <code>wait()</code> call should not be necessary and therefore should be avoided. What am I doing wrong here?</p>