Skip to content

Commit 9311e4e

Browse files
committed
Cover the legacy remember-choice cookie branch
# If applied, this commit will add Cypress coverage for the non-per-SP remember-choice flow by checking that selecting an IdP with the checkbox set creates the rememberchoice cookie. # Why is this change needed? Prior to this change, only the per-SP hidden-field branch had Cypress coverage, so the legacy cookie-writing branch could regress without a test failure. # How does it address the issue? This change adds a global remember-choice test that clears the cookie, stubs form submission, selects an IdP, and asserts that the rememberchoice cookie is created. # Provide links to any relevant tickets, articles or other resources Found during review of PR #2112.
1 parent 8a5747f commit 9311e4e

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎tests/e2e/cypress/integration/skeune/wayf/wayf.general.spec.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,18 @@ context('WAYF behaviour not tied to mouse / keyboard navigation', () => {
257257
cy.get('@formSubmit').should('have.been.calledOnce');
258258
cy.get(idpSelector).first().find('input[name="rememberChoice"]').should('have.value', '0');
259259
});
260+
261+
it('Sets the legacy rememberchoice cookie when the checkbox is checked for the global variant', () => {
262+
cy.clearCookie('rememberchoice');
263+
cy.visit('https://engine.dev.openconext.local/functional-testing/wayf?connectedIdps=1&addDiscoveries=0&rememberChoiceFeature=true&rememberChoicePerIdp=false');
264+
cy.window().then((win) => {
265+
cy.stub(win.HTMLFormElement.prototype, 'submit').as('formSubmit');
266+
});
267+
cy.get(`#${rememberChoiceId}`).check();
268+
cy.get(idpSelector).first().click({force: true});
269+
cy.get('@formSubmit').should('have.been.calledOnce');
270+
cy.getCookie('rememberchoice').should('exist');
271+
});
260272
});
261273

262274
describe('Preferred IdPs section heading', () => {

0 commit comments

Comments
 (0)