From 0979d48ff37cfedc48c560c913b47e3911272b55 Mon Sep 17 00:00:00 2001 From: Marlon Keating Date: Wed, 30 Aug 2023 19:59:50 +0000 Subject: [PATCH] feat: Add feature flag AUTH0_SELF_SERVICE_INTEGRATION chore: clean up comments --- .../SettingsSSOTab/NewSSOConfigForm.jsx | 5 ++++- .../settings/SettingsSSOTab/NewSSOStepper.jsx | 3 +++ .../tests/NewSSOConfigForm.test.jsx | 21 +++++++++++++++++++ src/config/index.js | 1 + 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/components/settings/SettingsSSOTab/NewSSOStepper.jsx diff --git a/src/components/settings/SettingsSSOTab/NewSSOConfigForm.jsx b/src/components/settings/SettingsSSOTab/NewSSOConfigForm.jsx index cac4e0ee98..6cbcab4c14 100644 --- a/src/components/settings/SettingsSSOTab/NewSSOConfigForm.jsx +++ b/src/components/settings/SettingsSSOTab/NewSSOConfigForm.jsx @@ -4,16 +4,19 @@ import { WarningFilled } from '@edx/paragon/icons'; import { SSOConfigContext } from './SSOConfigContext'; import SSOStepper from './SSOStepper'; import { HELP_CENTER_SAML_LINK } from '../data/constants'; +import { features } from '../../../config'; +import NewSSOStepper from './NewSSOStepper'; const NewSSOConfigForm = () => { const { ssoState: { currentError } } = useContext(SSOConfigContext); + const { AUTH0_SELF_SERVICE_INTEGRATION } = features; return (
Connect to a SAML identity provider for single sign-on to allow quick access to your organization's learning catalog. - + {AUTH0_SELF_SERVICE_INTEGRATION ? : } {currentError && ( null; + +export default NewSSOStepper; diff --git a/src/components/settings/SettingsSSOTab/tests/NewSSOConfigForm.test.jsx b/src/components/settings/SettingsSSOTab/tests/NewSSOConfigForm.test.jsx index 891c102f0d..03372c4fd5 100644 --- a/src/components/settings/SettingsSSOTab/tests/NewSSOConfigForm.test.jsx +++ b/src/components/settings/SettingsSSOTab/tests/NewSSOConfigForm.test.jsx @@ -12,6 +12,7 @@ import handleErrors from '../../utils'; import { INVALID_ODATA_API_TIMEOUT_INTERVAL, INVALID_SAPSF_OAUTH_ROOT_URL, INVALID_API_ROOT_URL, } from '../../data/constants'; +import { features } from '../../../../config'; jest.mock('../data/actions'); jest.mock('../../utils'); @@ -70,6 +71,7 @@ const contextValue = { describe('SAML Config Tab', () => { afterEach(() => { + features.AUTH0_SELF_SERVICE_INTEGRATION = false; jest.clearAllMocks(); }); test('canceling connect step', async () => { @@ -307,6 +309,25 @@ describe('SAML Config Tab', () => { expect(screen.getByText('Next')).not.toBeDisabled(); }, []); }); + test('show new SSO stepper placeholder when feature flag enabled', async () => { + // Setup + features.AUTH0_SELF_SERVICE_INTEGRATION = true; + contextValue.ssoState.currentStep = 'idp'; + render( + + + , + ); + await waitFor(() => { + expect( + screen.queryByText( + 'Connect to a SAML identity provider for single sign-on' + + ' to allow quick access to your organization\'s learning catalog.', + ), + ).toBeInTheDocument(); + expect(screen.queryByText('Next')).not.toBeInTheDocument(); + }, []); + }); test('idp step fetches and displays existing idp data fields', async () => { // Setup const mockGetProviderData = jest.spyOn(LmsApiService, 'getProviderData'); diff --git a/src/config/index.js b/src/config/index.js index 4fe281804e..663f190723 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -53,6 +53,7 @@ const features = { FEATURE_SSO_SETTINGS_TAB: process.env.FEATURE_SSO_SETTINGS_TAB || hasFeatureFlagEnabled('SSO_SETTINGS_TAB'), FEATURE_INTEGRATION_REPORTING: process.env.FEATURE_INTEGRATION_REPORTING || hasFeatureFlagEnabled('FEATURE_INTEGRATION_REPORTING'), SUBSCRIPTION_LPR: process.env.SUBSCRIPTION_LPR || hasFeatureFlagEnabled('SUBSCRIPTION_LPR'), + AUTH0_SELF_SERVICE_INTEGRATION: process.env.AUTH0_SELF_SERVICE_INTEGRATION || hasFeatureFlagEnabled('AUTH0_SELF_SERVICE_INTEGRATION'), }; export { configuration, features };