title: Avoiding .wait() in Cypress for loading all elements
body: <p>I have been searching for a solution to the .wait() problems I have been having in Cypress. Our application does not load all the data at the same time. The most common answer given to requests like this is as follows:</p>
  
  <pre><code>cy.server();
  cy.route('**/api/getData').as('getData');
  cy.visit('/home');
  cy.wait('@getData');
  </code></pre>
  
  <p>This simply does not work. You will arrive at /customer/12345 and yet it may be several more seconds before the entirety of the data has loaded, even some UI elements. So, checking for the route doesn't help at all. I tried to create an alias but when I do something like this:</p>
  
  <pre><code>cy.get('#submitButton').as('submit')
  </code></pre>
  
  <p>And then do:</p>
  
  <pre><code>cy.wait('@submit')
  </code></pre>
  
  <p>It fails the alias check because the button is not present yet.</p>
  
  <p>I need to wait until all the resources are loaded before I can start testing the elements. A developer on my team who does not have any understanding of Cypress asked if I could use the Window load event or the GlobalEventHandler.onload, but I couldn't find any documentation on using these in Cypress.</p>
  
  <p>One thing I would like any answerers to understand, I am a total newbie. I have experience with Java, Selenium, Unirest, and Junit. I am having to completely change my mindset with Cypress and I do not know Javascript, so I'm still in the learning phase on this. In Selenium I would have </p>
  
  <pre><code>wait.until(ExpectedConditions.elementToBeClickable(By.id&lt;submitButton&gt;));
  </code></pre>
  
  <p>So, is there a way for me to make sure the entirety of the resources are loaded before it starts running the tests?</p>