Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cy.session does not work consistently between creation and restoration of sessions #29896

Closed
shastrisubramaniam opened this issue Jul 19, 2024 · 2 comments
Labels
stage: needs investigating Someone from Cypress needs to look at this stale no activity on this issue for a long period topic: session Issues when using session command

Comments

@shastrisubramaniam
Copy link

shastrisubramaniam commented Jul 19, 2024

Current behavior

We are currently using Cypress with BDD. For login we use a SSO on a different domain. When we create a session which creates sessions on the SSO provider as well as the Customer facing site, the behavior when creating the session is not the same as restoring the session. Currently there is no way to use the same session consistently. Is this how it is supposed to be ? Currently the validation on the session is based on the location of the Customer facing site which is on origin. I really don't see how this can work consistenly. Is there a workaround for this ?

Desired behavior

Cypress behavior should be the same in creation as well as restoration of session.

Test code to reproduce

commands.js

Cypress.Commands.add("PPLogin", (username,password,pploginsteps,baseurl,apexdomain) => {
  cy.session({username,password},() => {
    cy.intercept(' /sso/v1/user/secure/login').as('loginResponse');
      cy.log("username ", username);
      cy.log("password ", password);
      cy.log("pp_login_page_steps ", pploginsteps);
      cy.visit(baseurl, { failOnStatusCode: false });
      if (pploginsteps && pploginsteps == "single") {
          cy.get("#idcs-signin-basic-signin-form-username").type(username);
          cy.get("#idcs-signin-basic-signin-form-password").type(password);
          cy.get("#idcs-signin-basic-signin-form-submit").click();
      } else {
          cy.get("#idcs-signin-basic-signin-form-username").type(username);
          cy.get("#idcs-signin-basic-signin-form-submit").click();
          cy.get("#idcs-mfa-mfa-auth-user-password-text-input").type(password);
          cy.get("#idcs-mfa-mfa-auth-user-password-submit-button").click();
        }
        cy.wait('@loginResponse').its('response.statusCode').should('eq', 200);
          cy.origin("https://org-1.eod1.dev.ohpp.oracle.com", () => {
            cy.on("uncaught:exception", () => {
              return false;
            });
            cy.getCookie('PPCOOKIE',{timeout:10000}).should('exist');
            cy.getCookie('ORA_WWV_RAC_INSTANCE',{timeout:10000}).should('exist');
        })
    })
      },{
        validate(){
          cy.location('pathname').contains(current_env.getApexDomain());
      }, 
        cacheAcrossSpecs:true,
      }
    )

Patient_Select_Profile.js

Before(function() {
  cy.on('uncaught:exception', () => {
    return false
  })
  cy.PPLogin(current_env.getPPUser(),current_env.getPPPassword(),current_env.getLoginPageSteps(),current_env.getPPUrl(),current_env.getApexDomain());
})
    
Given('I logged in as a Proxy who also has Permissions to view my Childrens Patient Portal Account',function() {   
    cy.visit(current_env.getPPUrl());
  cy.isProfileLoadedOrigin();
})

Cypress Version

13.13.1

Node version

v20.11.0

Operating System

macOS Sonoma v 14.3

Debug Logs

No response

Other

No response

@shastrisubramaniam shastrisubramaniam changed the title cy.session does not work consistently between creation and resoration of sessions cy.session does not work consistently between creation and restoration of sessions Jul 19, 2024
@jennifer-shehane jennifer-shehane added topic: session Issues when using session command stage: needs investigating Someone from Cypress needs to look at this labels Aug 23, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Feb 20, 2025
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: needs investigating Someone from Cypress needs to look at this stale no activity on this issue for a long period topic: session Issues when using session command
Projects
None yet
Development

No branches or pull requests

3 participants