I am writing some tests for mobile and tablet devices. I should use user-agent header while writing this tests. When i adding user-agent to cy.visit path with this method it works fine;
cy.visit("/mypath", {
headers: { "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",
},
});
But after changing page with click or similar methods (Click methods requests another page), my user-agent have lost. I tried to add userAgent to cypress.json file but that is not working for my test pages. I can only used it on cy.visit method. How can i add this header to all my test suites pages ? Thanks for your helping.