Skip to content

Commit d405893

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 b860a6f commit d405893

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
@@ -272,6 +272,18 @@ context('WAYF behaviour not tied to mouse / keyboard navigation', () => {
272272
cy.get('@formSubmit').should('have.been.calledOnce');
273273
cy.get(idpSelector).first().find('input[name="rememberChoice"]').should('have.value', '0');
274274
});
275+
276+
it('Sets the legacy rememberchoice cookie when the checkbox is checked for the global variant', () => {
277+
cy.clearCookie('rememberchoice');
278+
cy.visit('https://engine.dev.openconext.local/functional-testing/wayf?connectedIdps=1&addDiscoveries=0&rememberChoiceFeature=true&rememberChoicePerIdp=false');
279+
cy.window().then((win) => {
280+
cy.stub(win.HTMLFormElement.prototype, 'submit').as('formSubmit');
281+
});
282+
cy.get(`#${rememberChoiceId}`).check();
283+
cy.get(idpSelector).first().click({force: true});
284+
cy.get('@formSubmit').should('have.been.calledOnce');
285+
cy.getCookie('rememberchoice').should('exist');
286+
});
275287
});
276288

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

0 commit comments

Comments
 (0)