From 3a3ec856c2ca254aac0a0c6bbdc6399b691bb1f3 Mon Sep 17 00:00:00 2001 From: Davinder Singh Date: Thu, 12 Oct 2023 11:30:14 +0100 Subject: [PATCH] Group SSO - Adding success banner messages (#15143) GitOrigin-RevId: bbad3419b6780dcf08dad690658cea19112a8522 --- .../web/frontend/extracted-translations.json | 4 ++ services/web/locales/en.json | 4 ++ .../sso/group-settings-sso.spec.tsx | 46 ++++++++++++++++++- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index d577dcff87..f0d93682a5 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -1061,9 +1061,13 @@ "sso_config_prop_help_user_entry_point": "", "sso_config_prop_help_user_id": "", "sso_configuration": "", + "sso_configuration_created": "", + "sso_configuration_updated": "", "sso_explanation": "", + "sso_is_disabled": "", "sso_is_disabled_explanation_1": "", "sso_is_disabled_explanation_2": "", + "sso_is_enabled": "", "sso_is_enabled_explanation_1": "", "sso_is_enabled_explanation_2": "", "sso_link_error": "", diff --git a/services/web/locales/en.json b/services/web/locales/en.json index 0e143042ae..65ca3acc6f 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -1643,11 +1643,15 @@ "sso_config_prop_help_user_entry_point": "URL for SAML SSO redirect flow", "sso_config_prop_help_user_id": "Property in SAML assertion to use for unique id", "sso_configuration": "SSO configuration", + "sso_configuration_created": "SSO configuration has been saved", + "sso_configuration_updated": "SSO configuration was updated successfully", "sso_explanation": "You can enforce single sign-on for members of this group. When SSO is enabled it will be the <0>only way group members can log in to Overleaf. <1>Learn more about how we support SAML 2.0 IdPs.", "sso_integration": "SSO integration", "sso_integration_info": "Overleaf offers a standard SAML-based Single Sign On integration.", + "sso_is_disabled": "SSO is disabled", "sso_is_disabled_explanation_1": "Group members won’t be able to log in via SSO", "sso_is_disabled_explanation_2": "All members of the group will need a username and password to log in to __appName__", + "sso_is_enabled": "SSO is enabled", "sso_is_enabled_explanation_1": "Group members will <0>only be able to sign in via SSO", "sso_is_enabled_explanation_2": "If there are any problems with the configuration, only you (as the group administrator) will be able to disable SSO.", "sso_link_error": "Error linking account", diff --git a/services/web/test/frontend/features/group-management/components/sso/group-settings-sso.spec.tsx b/services/web/test/frontend/features/group-management/components/sso/group-settings-sso.spec.tsx index 848418658d..4c4cc13ec4 100644 --- a/services/web/test/frontend/features/group-management/components/sso/group-settings-sso.spec.tsx +++ b/services/web/test/frontend/features/group-management/components/sso/group-settings-sso.spec.tsx @@ -66,6 +66,46 @@ describe('GroupSettingsSSO', function () { }) }) }) + it('updates the configuration, and checks the success message', function () { + cy.intercept('GET', `/manage/groups/${GROUP_ID}/settings/sso`, { + statusCode: 200, + body: { + entryPoint: 'entrypoint', + certificate: 'cert', + signatureAlgorithm: 'sha1', + userIdAttribute: 'email', + enabled: true, + }, + }).as('sso') + + cy.intercept('POST', `/manage/groups/${GROUP_ID}/settings/sso`, { + statusCode: 200, + body: { + entryPoint: 'entrypoint', + certificate: 'certi', + signatureAlgorithm: 'sha1', + userIdAttribute: 'email', + enabled: false, + }, + }).as('ssoUpdated') + + cy.mount() + + cy.wait('@sso') + + cy.get('.group-settings-sso-enable').within(() => { + cy.get('.switch-input').within(() => { + cy.get('.invisible-input').should('be.checked') + cy.get('.invisible-input').should('not.be.disabled') + }) + }) + + cy.findByRole('button', { name: 'View configuration' }).click() + cy.findByRole('button', { name: 'Edit configuration' }).click() + cy.findByRole('button', { name: 'Save' }).click() + cy.wait('@ssoUpdated') + cy.findByText('SSO configuration was updated successfully') + }) describe('sso enable modal', function () { beforeEach(function () { @@ -107,7 +147,7 @@ describe('GroupSettingsSSO', function () { cy.get('.modal-dialog').should('not.exist') }) - it('enables SSO if Enable SSO button is clicked', function () { + it('enables SSO if Enable SSO button is clicked and shows success banner', function () { cy.intercept('POST', `/manage/groups/${GROUP_ID}/settings/enableSSO`, { statusCode: 200, }).as('enableSSO') @@ -133,6 +173,7 @@ describe('GroupSettingsSSO', function () { cy.get('.invisible-input').should('not.be.disabled') }) }) + cy.findByText('SSO is enabled') }) }) describe('SSO disable modal', function () { @@ -177,7 +218,7 @@ describe('GroupSettingsSSO', function () { cy.get('.modal-dialog').should('not.exist') }) - it('disables SSO if Disable SSO button is clicked', function () { + it('disables SSO if Disable SSO button is clicked and shows success banner', function () { cy.intercept('POST', `/manage/groups/${GROUP_ID}/settings/disableSSO`, { statusCode: 200, }).as('disableSSO') @@ -202,6 +243,7 @@ describe('GroupSettingsSSO', function () { cy.get('.invisible-input').should('not.be.checked') }) }) + cy.findByText('SSO is disabled') }) }) })