Im writing a test for the payment section on Cypress after clicking on the payment button page goes to the external URL. e.g. from http://localhost:64574/ to "https://3ds2-sandbox.ckotech.co/interceptor/3ds_ibgzskqjjfqevj4w3gwmdptp4m/device-information"
after completing the 3ds check the page to redirect back and went to the login page. I'm wrapping my code in cy.session you can see below.
beforeEach(() => {
cy.fixture('example.json').then(function(data)
{
configdata=data
})
cy.fixture('3dsCard.json').then(function(data)
{
configdata3DS=data
})
cy.session('session', () => {
cy.visit(Cypress.env('localURL'))
cy.get('#onetrust-accept-btn-handler').click();
cy.get('#VoucherNo').type('myvoucher-no')
cy.get('#PinCode').type('my-pin')
cy.get('.btn').click()
cy.getCookie('ASP.NET_SessionId')
.should('exist'),
{
cacheAcrossSpecs: true
}
})
})
I don't know what's going on in the cypress test environment locally I'm testing this with a card it's working fine I can see the confirmation page but in the test goes back to login.
Asp session is stored in the cookies you can see the image above. I noticed it changed while redirecting in cypress test environment not changing in localhost.