{"action":"opened","issue":{"url":"https://api.github.com/repos/cypress-io/cypress/issues/177","repository_url":"https://api.github.com/repos/cypress-io/cypress","labels_url":"https://api.github.com/repos/cypress-io/cypress/issues/177/labels{/name}","comments_url":"https://api.github.com/repos/cypress-io/cypress/issues/177/comments","events_url":"https://api.github.com/repos/cypress-io/cypress/issues/177/events","html_url":"https://github.com/cypress-io/cypress/issues/177","id":162009617,"number":177,"title":"Cypress Server Routes Are Lost After Page Load If Not Using cy.visit()","user":{"login":"pihish","id":2464164,"avatar_url":"https://avatars.githubusercontent.com/u/2464164?v=3","gravatar_id":"","url":"https://api.github.com/users/pihish","html_url":"https://github.com/pihish","followers_url":"https://api.github.com/users/pihish/followers","following_url":"https://api.github.com/users/pihish/following{/other_user}","gists_url":"https://api.github.com/users/pihish/gists{/gist_id}","starred_url":"https://api.github.com/users/pihish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pihish/subscriptions","organizations_url":"https://api.github.com/users/pihish/orgs","repos_url":"https://api.github.com/users/pihish/repos","events_url":"https://api.github.com/users/pihish/events{/privacy}","received_events_url":"https://api.github.com/users/pihish/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-23T19:57:50Z","updated_at":"2016-06-23T19:57:50Z","closed_at":null,"body":"When I have XHR requests go out on initial page load and need to have Cypress watch for those requests, I have to use `cy.visit()` to get to the page I want to test.  I cannot get directed to that page or else the routes I tell Cypress about are lost.\r\n\r\nExample:\r\n\r\n```javascript\r\ncy.visit('https://mydomain.com');\r\n// I am looking for these two XHR requests that are immediately started after my page loads\r\ncy.server().route('GET', /getUsers/).as('getUsers')\r\n                 .route('GET', /getApples/).as('getApples');\r\n// By clicking on an element with href value of \"/apples\", I get directed to a new page\r\n// Cypress will lose the routes I've defined just before this because I've loaded a whole new page\r\ncy.get('#links [href=\"/apples\"]').click().wait(['@getUsers', '@getApples']);\r\n```\r\n\r\nWe need a feature where even if a new page loads, the routes you define are not lost.  This gives testing a more \"natural\" flow.  `cy.visit()` is the equivalent of typing in a browser URL.  We should be testing how users actually get from page to page, which is usually clicking on a button, or an image, etc..."}}
{"actor":{"display_login":"pihish"}}