title: Cypress e2e test without using wait function
body: <p>I'm new in e2e testing with Cypress and I have a question.</p>
  
  <p>I wrote a test and I want not to use Cypress wait() command in it.</p>
  
  <pre><code>it('Should modify checkbox state', () =&gt; {
          login();
          cy.visit(TabsSettings.SIZE_FORMATS).then(() =&gt; {
              cy.xpath('(//div[@data-qa="sizeFormats"]//*[4]//*//*[1]//*//*//*)[1]', { timeout: 10000 }).click().then(() =&gt; {
                  expect(
                      cy.xpath('(//input[@type="checkbox"])[1]')
                          .then(checkbox =&gt; checkbox).should('be.checked')
                  );
              });
              cy.get('span').contains('Change').click().then(() =&gt; {
                  cy.get('li').contains('Disable').click().then({ timeout: 5000 }, () =&gt; {
                      cy.wait(500);
                      cy.xpath('(//div[@data-qa="sizeFormats"]//*[4]//*//*[1]//*//*//*)[1]').click().then(() =&gt; {
                          expect(
                              cy.xpath('(//input[@type="checkbox"])[1]')
                                  .then(checkbox =&gt; checkbox[0]).should('be.checked')
                          );
                      });
                      cy.xpath('(//div[@data-qa="sizeFormats"]//*[4]//*//*[1]//*//*//*)[18]').click().then(() =&gt; {
                          expect(
                              cy.xpath('(//input[@type="checkbox"])[2]')
                                  .then(checkbox =&gt; checkbox[3]).should('not.checked')
                          );
                      });
                  });
                  cy.xpath('//span[contains(text(), "Disable Selected")]').click().then(() =&gt; {
                      cy.get('li').contains('Enable').click().then(() =&gt; {
                          expect(
                              cy.get('input[type=checkbox]')
                                  .then(checkbox =&gt; checkbox).should('not.checked')
                          );
                      });
                  });
                  cy.get('input[type=checkbox]').then(el =&gt; el[0].click()).then(() =&gt; {
                      expect(
                          cy.get('input[type=checkbox]')
                              .then(checkbox =&gt; checkbox).should('be.checked')
                      );
                  }).then(() =&gt; {
                      cy.xpath('//i').then(x =&gt; x[1].click());
                      cy.get('input[type=checkbox]').should('not.checked');
                  });
                  cy.get('div[data-main-select=true]').then(list =&gt; list[1].click()).then(() =&gt; {
                      cy.xpath('(//li[contains(text(), "50")])[1]').click().then(() =&gt; {
                          cy.get('input[type=checkbox]').should(checkboxes =&gt; {
                              expect(checkboxes).to.have.length(51);
                          });
                      });
                  });
                  cy.xpath('(//div[@data-qa="sizeFormats"]//*[4]//*//*[1]//*//*//*)[1]').click().then(() =&gt; {
                      cy.wait(150);
                      expect(
                          cy.get('input[type=checkbox]')
                              .then(checkbox =&gt; checkbox).should('be.checked')
                      );
                  });
              });
          });
      });
  </code></pre>
  
  <p>My problem is that if I not use that cy.wait(500) command, the test fails.
  I googled a lot but I cannot find an answer for my problem.
  The project is an React project, using Hooks. What may be caused the problem is that my component renders multiple times after that click() event. The page does not reload, but the main component rerenders several times. If this is the problem, how can I wait for finishing all renderings, and just after that continue the test, without using the wait function ?</p>