title: How do I wait for an element to disappear in Cypress?
body: <p>I'd like to preface this by saying that I really tried looking here and anywhere else for an answer but without a succes.</p>
  <p>Here is the problem:
  I'm trying to automate a test for a web application that is loading a bigger amount of data and therefore has to be loading for a while. I have to wait for the page to load to do the next step and I'm trying to figure how to wait for the loading gif to be complete so that my tests can continue. The gif is a basic spinning thingy.</p>
  <p>I would like to avoid using implicit wait time (cy.wait()) that is really only the last resort if noone is able to solve this.</p>
  <p>What I found o far are these two functions:</p>
  <ol>
  <li><p><a href="https://www.npmjs.com/package/cypress-waitfor" rel="nofollow noreferrer">cy.waitFor</a> - this seems to be used mostly in situations, where you are waiting for an element to apper - I've tried this in different scenarios and works perfcetly but I havent been able to apply it here.</p>
  </li>
  <li><p><a href="https://www.npmjs.com/package/cypress-wait-until" rel="nofollow noreferrer">cy.waitUntil</a> - this seems to be the thing I'm looking for but there is one huge problem. This function seems to have a timeout and I haven't been able to change it any other way than by changing timeouts globally for all the functions. If I set the global timeout to some longer period (minute +), then it works exactly how I would want it to work but obviously I dont really want to have such a long timeout for everything.</p>
  </li>
  </ol>
  <p>The way I see it, there are two possible solutions to this problem&gt;</p>
  <ol>
  <li>to change/turn off the timeout for the waitUntil function.</li>
  </ol>
  <p>2)Or to somehow make it work with waitFor, because there seems to be no implicit timeout there and it just kind of waits forever for something to happen.
  here is the code snippet of the situation:</p>
  <pre><code>cy.get('#load-data-button').click() // this clicks the button that stars the loading proces     
  cy.waitUntil(() =&gt; cy.get('body &gt; div &gt; my-app &gt; billing &gt; div &gt; div &gt; div.text-center &gt; img').should('not.be.visible',) ) // this is the function that waits until the loading gif is invisible
  </code></pre>
  <p>I would be eternaly grateful for a solution, because unfortunatelly no one at my company is really a Cypress expert so they are not able to help.</p>