title: cypress get not querying the new dom after rerender
body: <p>I want to use <code>cy.get</code> to query the new DOM after the re-render. But the DOM is updated but cypress seems to cached the DOM on the initial load. The <code>cy.get</code> still returning the element in the first load not the update element after the re-render. </p>
  
  <p>Is there away to force <code>cy.get</code> to query the new DOM. <code>cy.get</code> only picked up the correct value after <code>cy.reload(true);</code> But this is not what the user would do. Since the user don't need to reload the page to seem the change.</p>
  
  <p>Here is an example</p>
  
  <pre><code>// first load
  &lt;div id='first-name'&gt;
   John Smith
  &lt;/div&gt;
  </code></pre>
  
  <pre><code>// after 10 seconds
  &lt;div id='first-name'&gt;
   Grace Smith
  &lt;/div&gt;
  </code></pre>
  
  <p>So <code>cy.get('#first-name')</code> should have the text <code>John Smith</code> after 10 seconds <code>cy.get('#first-name')</code> should have the text <code>Grace Smith</code></p>
  
  <pre><code>        cy.get('[data-testid=slot1-text] &gt; tspan').then(text =&gt; {
              expect(text.text()).equal('PARKINGFRESERVED');
          });
          cy.get('[data-testid=slot1-text] &gt; tspan:last-child').then(text =&gt; {
              cy.wrap(text).should('have.class', 'parking-status-reserved');
              expect(text.text()).equal('RESERVED');
          });
  
          cy.server();
          cy.route('GET', '/mocks/parkingLotConfigs.json', parkingLotConfigsMock).as(
              'parkingLotConfigs'
          );
  
          // @TODO remove reload, when there is a better way.
          // Without using reload the page is updated because of pooling. But cypress does not
          // pick up the change in the re-rendered DOM. reload is used as work around only.
          // https://stackoverflow.com/questions/62205766/cypress-get-not-querying-the-new-dom-after-rerender
          cy.reload(true);
          cy.wait('@parkingLotConfigs');
  
          cy.get('[data-testid=slot1-text] &gt; tspan').then(text =&gt; {
              expect(text.text()).equal('PARKINGFRESERVED');
          });
          cy.get('[data-testid=slot1-text] &gt; tspan:last-child').then(text =&gt; {
              cy.wrap(text).should('have.class', 'parking-status-reserved');
              expect(text.text()).equal('RESERVED');
          });
  </code></pre>