https://cypress.io logo
App url redirects
# i-need-help
e
Hello guys i'am having a problem with my E2E Automation. I login on a login component from a different team, then i'm redirected to my app i do some stuff and on the mid of the flow i am redirect to another component from another team that re-uses the same data on the browser. The problem is during test execution it fails the authentication. But i am able to do it manually and i am able to open a new tab in cypress and reuse the same url and also perform it manually. Thanks in advance , hope someone can give me some insights.
c
What step is it failing in your test? This makes me think you are trying to open a new tab in Cypress and have it test on that new tab - "But i am able to do it manually and i am able to open a new tab in cypress". If so, Cypress can only test on a single tab right now . Also, are all these tests and logins and redirects on the same origin?
e
Yeah i know, some requests as same-site other have same-origin.
g
if you have the same origin , maybe you can do something like .invoke('removeAttr', 'target') that will open the new url in the same tab. if you have different origin, (e.g. your app url "my_app.com" -> login within another app "the_other_app.com) you can try to use cy.origin that is available from cypress v12:). (for the login with google, i've tried tryied to use the cy origin, but google blocked me:) )
e
Ok i understanded the problem so i've import both request to the postman, the manual and the on executed on the cypress
And on the request that fails the request headers are not populated correclty
so the value is this for this user always, I00000D6Z2. this is just a reference for that user that the system does for the redirect and in the cypres the value that is placed on the request is XYZ
so i have to override it somehow before the redirect, maybe with intercept on request or with origin
4 Views