From 4647d6e54e94b34a253870642fe27cb75c5bd724 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Tue, 17 May 2022 15:38:24 +0200 Subject: [PATCH] e2e path for activate/deactivate user on account/descriptor --- e2e/helpers/selectors.js | 1 + .../01_create_and_basic_data.spec.js | 49 ++++++++++++------- .../02_alias_create_and_basic_data.spec.js | 2 +- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 29176489c..b46410a23 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -55,6 +55,7 @@ export default { setPassword: '.vn-menu [name="setPassword"]', activateAccount: '.vn-menu [name="enableAccount"]', activateUser: '.vn-menu [name="activateUser"]', + deactivateUser: '.vn-menu [name="deactivateUser"]', newPassword: 'vn-textfield[ng-model="$ctrl.newPassword"]', repeatPassword: 'vn-textfield[ng-model="$ctrl.repeatPassword"]', newRole: 'vn-autocomplete[ng-model="$ctrl.newRole"]', diff --git a/e2e/paths/14-account/01_create_and_basic_data.spec.js b/e2e/paths/14-account/01_create_and_basic_data.spec.js index 4048413ba..0fc657375 100644 --- a/e2e/paths/14-account/01_create_and_basic_data.spec.js +++ b/e2e/paths/14-account/01_create_and_basic_data.spec.js @@ -36,8 +36,7 @@ describe('Account create and basic data path', () => { await page.waitForState('account.card.basicData'); }); - it('should reload the section and check the name is as expected', async() => { - await page.reloadSection('account.card.basicData'); + it('should check the name is as expected', async() => { const result = await page.waitToGetProperty(selectors.accountBasicData.name, 'value'); expect(result).toEqual('Remy'); @@ -103,25 +102,39 @@ describe('Account create and basic data path', () => { }); }); - // creating the account without the active property set to true seems to be creating an active user anyways - // describe('activate user', () => { - // it(`should check the inactive user icon is present in the descriptor`, async() => { - // await page.waitForSelector(selectors.accountDescriptor.activeUserIcon, {visible: true}); - // }); + describe('deactivate user', () => { + it(`should check the inactive user icon isn't present in the descriptor just yet`, async() => { + await page.waitForNumberOfElements(selectors.accountDescriptor.activeUserIcon, 0); + }); - // it('should activate the user using the descriptor menu', async() => { - // await page.waitToClick(selectors.accountDescriptor.menuButton); - // await page.waitToClick(selectors.accountDescriptor.activateUser); - // await page.waitToClick(selectors.accountDescriptor.acceptButton); - // const message = await page.waitForSnackbar(); + it('should deactivate the user using the descriptor menu', async() => { + await page.waitToClick(selectors.accountDescriptor.menuButton); + await page.waitToClick(selectors.accountDescriptor.deactivateUser); + await page.waitToClick(selectors.accountDescriptor.acceptButton); + const message = await page.waitForSnackbar(); - // expect(message.text).toContain('user enabled?'); - // }); + expect(message.text).toContain('User deactivated!'); + }); - // it('should check the inactive user icon is not present anymore', async() => { - // await page.waitForNumberOfElements(selectors.accountDescriptor.activeUserIcon, 0); - // }); - // }); + it('should check the inactive user icon is now present', async() => { + await page.waitForNumberOfElements(selectors.accountDescriptor.activeUserIcon, 1); + }); + }); + + describe('activate user', () => { + it('should activate the user using the descriptor menu', async() => { + await page.waitToClick(selectors.accountDescriptor.menuButton); + await page.waitToClick(selectors.accountDescriptor.activateUser); + await page.waitToClick(selectors.accountDescriptor.acceptButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('User activated!'); + }); + + it('should check the inactive user icon is not present anymore', async() => { + await page.waitForNumberOfElements(selectors.accountDescriptor.activeUserIcon, 0); + }); + }); describe('mail forwarding', () => { it('should activate the mail forwarding and set the recipent email', async() => { diff --git a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js index 0514899bc..dd35dd740 100644 --- a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js +++ b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js @@ -56,7 +56,7 @@ describe('Account Alias create and basic data path', () => { expect(result).toContain('psykers'); }); - it('should search for the IT alias group then access to the users section then check the role listed is the expected one', async() => { + it('should search IT alias then access the user section to check the role listed is the expected one', async() => { await page.accessToSearchResult('IT'); await page.accessToSection('account.alias.card.users'); const rolesCount = await page.countElement(selectors.accountAliasUsers.anyResult);