I'm new to Cypress and facing an issue while trying to login to my application from the UI(Application uses Paladin Authentication). After entering the username and clicked next button to enter the Password the web page shows an error as: "Something went wrong. Cookies may be disabled: Check your browser settings to ensure that cookies are enabled. System clock may be misconfigured: Be sure that your system clock is correct. Session may be expired: Close this window and try again."
When trying to manually login to the application from the same browser there are no issues. i have tried some code to preserve the cookies in case the cookies are cleared in cypress ,not sure whether they are working.
Code im using to Login:
HPCustomerLogin()
{
const gmailid="gmail"
const password="password"
Cypress.Cookies.debug(true)
cy.visit('https://dcmcportalstg3.corp.hpicloud.net/#/MgtSMCHome')
cy.wait(3000)
//Cypress.Cookies.debug(true, { verbose: false })
cy.get('#app-login').shadow().contains('Use this login if you are HP Customer').next('button').click()
cy.wait(20000)
Cypress.Cookies.defaults({
preserve: (cookie) => {
return true;
}
})
Cypress.Cookies.defaults(
{
preserve: ['ASP.NET_SessionId', '__cypress.initial','CSRF-TOKEN','connect.sid','aka_client_code','autoredirect','SST-staging']
})
cy.get('#username').type(gmailid+'{Enter}');
cy.wait(3000)
cy.get('#password').type(password+'{Enter}');
cy.wait(15000)
}