title: How to loop through requests using cypress?
body: <pre><code>  function AssertResponseCode200(request) {
      cy.wait(request).then(response =&gt; {
        expect(response.status).to.eq(200);
      });
    }
  
    function CheckDictionaries() {
      var requestUrls = [
        "requestUrl1",
        "requestUrl2",
        "..."
      ];
  
      for (let i = 0; i &lt; requestUrls.length; i++) {
        cy.route("GET", requestUrls[i]).as(`request${i}`);
        AssertResponseCode200(`@request${i}`);
      }
    }
  
    it("Assert dictionaries", () =&gt; {
      cy.server();
      CheckDictionaries();
  });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/4Y35p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Y35p.png" alt="enter image description here"></a></p>
  
  <p><code>CypressError: Timed out retrying: cy.wait() timed out waiting 5000ms for the 1st request to the route: 'request1'. No request ever occurred.</code></p>
  
  <p>I want to cycle through requests and check that everything works fine and response code is 200. But I'm stuck, because the only url that gets aliased is the first one in my array, but I need all elements of my <code>requestUrls</code> array to be aliased with <code>request${i}</code>. Is there anything wrong with my code, or routes in cypress can not work with for loops?</p>