I have the following:
describe('Page not authenticated', () => {
it('Page has authentication', () => {
cy.visit('https://myauthsite.com/logout');
cy.visit('/', { failOnStatusCode: true });
cy.url().should('include', 'https://myauthsite.com/');
});
})
For internal reasons, the package is set up so that it always has a persistent session, so I need a test to visit a specific URL that would explicitly logout and "kill" the session and then visit the main page that I'm trying to test to ensure that it does redirect me to the right page. However, I'm running into this error
You may only `cy.visit()` same-origin URLs within a single test.
The previous URL you visited was:
> 'https://myauthsite.com'
You're attempting to visit this URL:
> 'https://myactualsite.com'
You may need to restructure some of your test code to avoid this problem.
https://on.cypress.io/cannot-visit-different-origin-domain
A lot of the workarounds that's listed mostly addresses checking for the attribute instead of visiting the url, or splitting the visits into two different test case, but in my case I really need it to be in its own encapsulated test, is that not possible?