Skip to content

Commit

Permalink
Merge pull request #1024 from openedx/mkeating/ENT-7580
Browse files Browse the repository at this point in the history
feat: Add feature flag AUTH0_SELF_SERVICE_INTEGRATION
  • Loading branch information
marlonkeating committed Sep 1, 2023
2 parents 5a629a5 + b9e97b1 commit 31f4dc8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/settings/SettingsSSOTab/NewSSOConfigForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="sso-create-form mt-4.5">
<span>
Connect to a SAML identity provider for single sign-on
to allow quick access to your organization&apos;s learning catalog.
</span>
<SSOStepper />
{AUTH0_SELF_SERVICE_INTEGRATION ? <NewSSOStepper /> : <SSOStepper />}
{currentError && (
<Alert
variant="warning"
Expand Down
3 changes: 3 additions & 0 deletions src/components/settings/SettingsSSOTab/NewSSOStepper.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const NewSSOStepper = () => null;

export default NewSSOStepper;
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -70,6 +71,7 @@ const contextValue = {

describe('SAML Config Tab', () => {
afterEach(() => {
features.AUTH0_SELF_SERVICE_INTEGRATION = false;
jest.clearAllMocks();
});
test('canceling connect step', async () => {
Expand Down Expand Up @@ -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(
<SSOConfigContext.Provider value={contextValue}>
<Provider store={store}><NewSSOConfigForm enterpriseId={enterpriseId} /></Provider>
</SSOConfigContext.Provider>,
);
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');
Expand Down
1 change: 1 addition & 0 deletions src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

0 comments on commit 31f4dc8

Please sign in to comment.