2023-11-20 04:25:38 -05:00
|
|
|
|
import GroupSettingsSSORoot from '../../../../../../modules/group-settings/frontend/js/components/sso/group-settings-sso-root'
|
2023-10-02 03:26:33 -04:00
|
|
|
|
|
|
|
|
|
function GroupSettingsSSOComponent() {
|
|
|
|
|
return (
|
|
|
|
|
<div style={{ padding: '25px', width: '600px' }}>
|
2023-10-02 03:38:50 -04:00
|
|
|
|
<GroupSettingsSSORoot managedUsersEnabled />
|
2023-10-02 03:26:33 -04:00
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const GROUP_ID = '123abc'
|
|
|
|
|
|
|
|
|
|
describe('GroupSettingsSSO', function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
cy.window().then(win => {
|
|
|
|
|
win.metaAttributesCache = new Map()
|
|
|
|
|
win.metaAttributesCache.set('ol-groupId', GROUP_ID)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('renders sso settings in group management', function () {
|
|
|
|
|
cy.mount(<GroupSettingsSSOComponent />)
|
|
|
|
|
|
|
|
|
|
cy.get('.group-settings-sso').within(() => {
|
|
|
|
|
cy.contains('Single Sign-On (SSO)')
|
|
|
|
|
cy.contains('Enable SSO')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('GroupSettingsSSOEnable', function () {
|
|
|
|
|
it('renders without sso configuration', function () {
|
|
|
|
|
cy.mount(<GroupSettingsSSOComponent />)
|
|
|
|
|
|
|
|
|
|
cy.get('.group-settings-sso-enable').within(() => {
|
|
|
|
|
cy.contains('Enable SSO')
|
|
|
|
|
cy.contains(
|
|
|
|
|
'Enabling SSO will make this the only sign-in option for members.'
|
|
|
|
|
)
|
|
|
|
|
cy.get('.switch-input').within(() => {
|
|
|
|
|
cy.get('.invisible-input').should('not.be.checked')
|
|
|
|
|
cy.get('.invisible-input').should('be.disabled')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('renders with sso configuration', function () {
|
|
|
|
|
cy.intercept('GET', `/manage/groups/${GROUP_ID}/settings/sso`, {
|
|
|
|
|
statusCode: 200,
|
|
|
|
|
body: {
|
|
|
|
|
entryPoint: 'entrypoint',
|
2023-10-27 09:11:25 -04:00
|
|
|
|
certificates: ['cert1', 'cert2'],
|
2023-10-02 03:26:33 -04:00
|
|
|
|
signatureAlgorithm: 'sha1',
|
|
|
|
|
userIdAttribute: 'email',
|
|
|
|
|
enabled: true,
|
|
|
|
|
},
|
|
|
|
|
}).as('sso')
|
|
|
|
|
|
|
|
|
|
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')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
2023-10-27 09:11:25 -04:00
|
|
|
|
|
2023-10-12 06:30:14 -04:00
|
|
|
|
it('updates the configuration, and checks the success message', function () {
|
|
|
|
|
cy.intercept('GET', `/manage/groups/${GROUP_ID}/settings/sso`, {
|
|
|
|
|
statusCode: 200,
|
|
|
|
|
body: {
|
|
|
|
|
entryPoint: 'entrypoint',
|
2023-10-27 09:11:25 -04:00
|
|
|
|
certificates: ['cert'],
|
2023-10-12 06:30:14 -04:00
|
|
|
|
signatureAlgorithm: 'sha1',
|
|
|
|
|
userIdAttribute: 'email',
|
|
|
|
|
enabled: true,
|
|
|
|
|
},
|
|
|
|
|
}).as('sso')
|
|
|
|
|
|
|
|
|
|
cy.intercept('POST', `/manage/groups/${GROUP_ID}/settings/sso`, {
|
|
|
|
|
statusCode: 200,
|
|
|
|
|
body: {
|
|
|
|
|
entryPoint: 'entrypoint',
|
2023-10-27 09:11:25 -04:00
|
|
|
|
certificates: ['certi'],
|
2023-10-12 06:30:14 -04:00
|
|
|
|
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')
|
|
|
|
|
})
|
2023-10-02 03:26:33 -04:00
|
|
|
|
|
|
|
|
|
describe('sso enable modal', function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
cy.intercept('GET', `/manage/groups/${GROUP_ID}/settings/sso`, {
|
|
|
|
|
statusCode: 200,
|
|
|
|
|
body: {
|
|
|
|
|
entryPoint: 'entrypoint',
|
2023-10-27 09:11:25 -04:00
|
|
|
|
certificates: ['cert'],
|
2023-10-02 03:26:33 -04:00
|
|
|
|
signatureAlgorithm: 'sha1',
|
|
|
|
|
userIdAttribute: 'email',
|
|
|
|
|
enabled: false,
|
|
|
|
|
},
|
|
|
|
|
}).as('sso')
|
|
|
|
|
|
|
|
|
|
cy.mount(<GroupSettingsSSOComponent />)
|
|
|
|
|
|
|
|
|
|
cy.wait('@sso')
|
|
|
|
|
|
|
|
|
|
cy.get('.group-settings-sso-enable').within(() => {
|
|
|
|
|
cy.get('.switch-input').within(() => {
|
|
|
|
|
cy.get('.invisible-input').click({ force: true })
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('render enable modal correctly', function () {
|
|
|
|
|
// enable modal
|
|
|
|
|
cy.get('.modal-dialog').within(() => {
|
|
|
|
|
cy.contains('Enable single sign-on')
|
|
|
|
|
cy.contains('What happens when SSO is enabled?')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('close enable modal if Cancel button is clicked', function () {
|
|
|
|
|
cy.get('.modal-dialog').within(() => {
|
|
|
|
|
cy.findByRole('button', { name: 'Cancel' }).click()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
cy.get('.modal-dialog').should('not.exist')
|
|
|
|
|
})
|
|
|
|
|
|
2023-10-12 06:30:14 -04:00
|
|
|
|
it('enables SSO if Enable SSO button is clicked and shows success banner', function () {
|
2023-10-02 03:26:33 -04:00
|
|
|
|
cy.intercept('POST', `/manage/groups/${GROUP_ID}/settings/enableSSO`, {
|
|
|
|
|
statusCode: 200,
|
|
|
|
|
}).as('enableSSO')
|
|
|
|
|
|
2023-10-02 03:38:50 -04:00
|
|
|
|
cy.intercept('GET', `/manage/groups/${GROUP_ID}/settings/sso`, {
|
|
|
|
|
statusCode: 200,
|
|
|
|
|
body: {
|
|
|
|
|
entryPoint: 'entrypoint',
|
2023-10-27 09:11:25 -04:00
|
|
|
|
certificates: ['cert'],
|
2023-10-02 03:38:50 -04:00
|
|
|
|
signatureAlgorithm: 'sha1',
|
|
|
|
|
userIdAttribute: 'email',
|
|
|
|
|
enabled: true,
|
|
|
|
|
},
|
|
|
|
|
}).as('sso')
|
|
|
|
|
|
2023-10-02 03:26:33 -04:00
|
|
|
|
cy.get('.modal-dialog').within(() => {
|
|
|
|
|
cy.findByRole('button', { name: 'Enable SSO' }).click()
|
|
|
|
|
})
|
|
|
|
|
cy.get('.modal-dialog').should('not.exist')
|
|
|
|
|
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')
|
|
|
|
|
})
|
|
|
|
|
})
|
2023-10-12 06:30:14 -04:00
|
|
|
|
cy.findByText('SSO is enabled')
|
2023-10-02 03:26:33 -04:00
|
|
|
|
})
|
|
|
|
|
})
|
2023-10-27 09:11:25 -04:00
|
|
|
|
|
2023-10-09 06:19:25 -04:00
|
|
|
|
describe('SSO disable modal', function () {
|
|
|
|
|
beforeEach(function () {
|
|
|
|
|
cy.intercept('GET', `/manage/groups/${GROUP_ID}/settings/sso`, {
|
|
|
|
|
statusCode: 200,
|
|
|
|
|
body: {
|
|
|
|
|
entryPoint: 'entrypoint',
|
2023-10-27 09:11:25 -04:00
|
|
|
|
certificates: ['cert'],
|
2023-10-09 06:19:25 -04:00
|
|
|
|
signatureAlgorithm: 'sha1',
|
|
|
|
|
userIdAttribute: 'email',
|
|
|
|
|
enabled: true,
|
|
|
|
|
},
|
|
|
|
|
}).as('sso')
|
|
|
|
|
|
|
|
|
|
cy.mount(<GroupSettingsSSOComponent />)
|
|
|
|
|
|
|
|
|
|
cy.wait('@sso')
|
|
|
|
|
|
|
|
|
|
cy.get('.group-settings-sso-enable').within(() => {
|
|
|
|
|
cy.get('.switch-input').within(() => {
|
|
|
|
|
cy.get('.invisible-input').click({ force: true })
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('render disable modal correctly', function () {
|
|
|
|
|
// disable modal
|
|
|
|
|
cy.get('.modal-dialog').within(() => {
|
|
|
|
|
cy.contains('Disable single sign-on')
|
|
|
|
|
cy.contains(
|
|
|
|
|
'You’re about to disable single sign-on for all group members.'
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('close disable modal if Cancel button is clicked', function () {
|
|
|
|
|
cy.get('.modal-dialog').within(() => {
|
|
|
|
|
cy.findByRole('button', { name: 'Cancel' }).click()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
cy.get('.modal-dialog').should('not.exist')
|
|
|
|
|
})
|
|
|
|
|
|
2023-10-12 06:30:14 -04:00
|
|
|
|
it('disables SSO if Disable SSO button is clicked and shows success banner', function () {
|
2023-10-09 06:19:25 -04:00
|
|
|
|
cy.intercept('POST', `/manage/groups/${GROUP_ID}/settings/disableSSO`, {
|
|
|
|
|
statusCode: 200,
|
|
|
|
|
}).as('disableSSO')
|
|
|
|
|
|
|
|
|
|
cy.intercept('GET', `/manage/groups/${GROUP_ID}/settings/sso`, {
|
|
|
|
|
statusCode: 200,
|
|
|
|
|
body: {
|
|
|
|
|
entryPoint: 'entrypoint',
|
2023-10-27 09:11:25 -04:00
|
|
|
|
certificates: ['cert'],
|
2023-10-09 06:19:25 -04:00
|
|
|
|
signatureAlgorithm: 'sha1',
|
|
|
|
|
userIdAttribute: 'email',
|
|
|
|
|
enabled: false,
|
|
|
|
|
},
|
|
|
|
|
}).as('sso')
|
|
|
|
|
|
|
|
|
|
cy.get('.modal-dialog').within(() => {
|
|
|
|
|
cy.findByRole('button', { name: 'Disable SSO' }).click()
|
|
|
|
|
})
|
|
|
|
|
cy.get('.modal-dialog').should('not.exist')
|
|
|
|
|
cy.get('.group-settings-sso-enable').within(() => {
|
|
|
|
|
cy.get('.switch-input').within(() => {
|
|
|
|
|
cy.get('.invisible-input').should('not.be.checked')
|
|
|
|
|
})
|
|
|
|
|
})
|
2023-10-12 06:30:14 -04:00
|
|
|
|
cy.findByText('SSO is disabled')
|
2023-10-09 06:19:25 -04:00
|
|
|
|
})
|
|
|
|
|
})
|
2023-10-02 03:26:33 -04:00
|
|
|
|
})
|
|
|
|
|
})
|