Просмотр исходного кода

Group SSO - Adding success banner messages (#15143)

GitOrigin-RevId: bbad3419b6780dcf08dad690658cea19112a8522
Davinder Singh 2 лет назад
Родитель
Сommit
3a3ec856c2

+ 4 - 0
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": "",

+ 4 - 0
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</0> way group members can log in to Overleaf. <1>Learn more about how we support SAML 2.0 IdPs.</1>",
   "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</0> 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",

+ 44 - 2
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(<GroupSettingsSSOComponent />)
+
+      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')
       })
     })
   })