title: Cypress - How to redirect without opening a new window
body: <p>I have a cypress test that on clicking a button the system redirects to a new window.
  I've tried some solutions (invoke,stub) without success.</p>
  <p>I need to do some testing but I need it to always be redirected on the same screen as cypress doesn't support multiple windows.</p>
  <p>My button code:</p>
  <pre><code>&lt;button id=&quot;cmdEnviar&quot; name=&quot;cmdEnviar&quot; type=&quot;button&quot; onclick=&quot;TrPage._autoSubmit('_id5','cmdEnviar',event,1);return false;&quot; class=&quot;x7j&quot;&gt;Enviar&lt;/button&gt;
  </code></pre>
  <p>My code:</p>
  <pre><code>it('register new user', function() {
          cy.visit('/')  
          cy.get('#txtLogin').type(Cypress.env('login'))
          cy.get('#txtSenha').type(Cypress.env('pass'))
          cy.get('#btnEnviar').click()
          cy.get('#cmbSistemas').select(11)
          cy.get('#cmdEnviar').click() //here is the button
      
          //here is redirected to another window 
          cy.contains('Colaborador').click()
          cy.contains('Cadastro').click()
         
      })
  </code></pre>
  <p>Could anyone help me, if there is any solution?</p>