title: Visit new url Cypress
body: <p>I'm new to Cypress. My app as a "routing system" manually changes <code>window.location.hash</code>.
  At some point, I click on a button that changes the hash and consequently should change the page during the test. I can see a "new url" entry appearing during the execution, but how can I make cypress visit that url?</p>
  
  <p><a href="https://i.stack.imgur.com/qoWzn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qoWzn.png" alt="enter image description here"></a></p>
  
  <p><strong>In few words, what the problem is:</strong> you can see I type the password and then <code>{enter}</code>. Running the test I can see the hash change in the address bar, but the page doesn't change in accord to the hash change.</p>
  
  <p>This is the testing code</p>
  
  <pre><code>context("Workflow", () =&gt; {
  
      it("login", () =&gt; {
  
          cy.visit("http://localhost:3000/src/#login")
          cy.get("#username").type("demo").should("have.value", "demouser")
          cy.get("#password").type("demo{enter}").should("have.value", "demo") // this should redirect to "/#home"
          //cy.wait(10000)
          cy.get(".subtitle").should("have.value", "Welcome") //this line fails as ".subtitle" is an element of "/#home"
      })
  })
  </code></pre>
  
  <p><strong>EDIT:</strong> Following tons of failed attempts, I came up with a partially working, clunky and hacky solution. I think I shouldn't need to use <code>reload()</code> to solve that (there must be a better solution..), but to make it works I have to wait for all the remote requests to be done (otherwise <code>reload()</code> cancels them). I say partially working because you can see from the comments in the code if I try to visit <code>#login</code> first, then follow the redirect in <code>#home</code> and then change the page to <code>#browser</code>, the last one doesn't work (I can see the hash changing to <code>#browser</code>, but the page is still <code>#home</code>).</p>
  
  <pre><code>import 'cypress-wait-until';
  
  let i = 0;
  
  context("Workflow", () =&gt; {
      it("login", () =&gt; {
          cy.server( {
              onRequest: () =&gt; {
                  i++;
              },
              onResponse: () =&gt; {
                  i--;
              }
          });
  
          cy.visit("http://localhost:3000/src/#login")
          cy.get("#username").type("demouser").should("have.value", "demouser")
          cy.get("#password").type("demouser").should("have.value", "demouser")
          cy.get("form#formLogin").submit()
  
          cy.waitUntil(() =&gt; i &gt; 0)
          cy.waitUntil(() =&gt; i === 0)
          cy.reload(); // it correctly change the hash AND the page to #home!
  
          cy.url().should("include", "#home") 
          cy.get(".version").contains( "v2.0.0-beta") // it works!!
  
          cy.get("a[data-id=browser]").click({force: true}) // it correctly changes the hash to #browser
          cy.waitUntil(() =&gt; i &gt; 0)
          cy.waitUntil(() =&gt; i === 0)
          cy.reload();
  
          // the hash in the address bar is #browser, but the web page is #home
      })
  })
  </code></pre>