Skip to content

Commit

Permalink
Implementation of FAT-10196 (#3052)
Browse files Browse the repository at this point in the history
* Implementation of FAT-10196

* Implementation of FAT-10196

* add all settings permissions

* Fix testcases names
  • Loading branch information
IhorBohdan committed Jan 16, 2024
1 parent 2ae4d01 commit 1a1dff7
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Users -> Consortia', () => {
});

it(
'C405520: Affiliation in central tenant is automatically added after creating user in the member tenant (consortia)(thunderjet)',
'C387512: Affiliation in central tenant is automatically added after creating user in the member tenant (consortia)(thunderjet)',
{ tags: ['smokeECS', 'thunderjet'] },
() => {
Users.createViaUi(testUser).then((id) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Users -> Consortia', () => {
});

it(
'C405520: Affiliation in central tenant is automatically added after creating user in the member tenant (consortia)(thunderjet)',
'C387506: User created in Member tenant is logging right into Member tenant (consortia) (thunderjet)',
{ tags: ['smokeECS', 'thunderjet'] },
() => {
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.college);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import Permissions from '../../../support/dictionary/permissions';
import Affiliations, { tenantNames } from '../../../support/dictionary/affiliations';
import Users from '../../../support/fragments/users/users';
import ConsortiumManager from '../../../support/fragments/settings/consortium-manager/consortium-manager';
import SettingsMenu from '../../../support/fragments/settingsMenu';
import UsersSearchPane from '../../../support/fragments/users/usersSearchPane';
import UserEdit from '../../../support/fragments/users/userEdit';
import TopMenu from '../../../support/fragments/topMenu';

describe('Consortia -> Consortium manager', () => {
let user;

before('Create users, data', () => {
cy.getAdminToken();

cy.createTempUser([Permissions.consortiaSettingsSettingsMembershipEdit.gui])
.then((userProperties) => {
user = userProperties;
})
.then(() => {
cy.assignAffiliationToUser(Affiliations.College, user.userId);
cy.loginAsAdmin({ path: TopMenu.usersPath, waiter: UsersSearchPane.waitLoading });
UsersSearchPane.searchByUsername(user.username);
UsersSearchPane.openUser(user.username);
UserEdit.assignAllPermissionsToTenant(tenantNames.college, 'Settings');
cy.setTenant(Affiliations.College);
cy.assignPermissionsToExistingUser(user.userId, [
Permissions.consortiaSettingsSettingsMembershipEdit.gui,
Permissions.consortiaSettingsSettingsMembershipView.gui,
]);
cy.login(user.username, user.password, {
path: SettingsMenu.consortiumManagerPath,
waiter: ConsortiumManager.waitLoading,
});
});
});

after('Delete users, data', () => {
cy.resetTenant();
cy.getAdminToken();
Users.deleteViaApi(user.userId);
});

it(
'C386869: "Consortium manager" option is displayed in "Settings" only for Central Tenant (consortia) (thunderjet)',
{ tags: ['criticalPath', 'thunderjet'] },
() => {
ConsortiumManager.varifyConsortiumManagerOnPage();
ConsortiumManager.switchActiveAffiliationExists();
ConsortiumManager.switchActiveAffiliation(tenantNames.college);
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.college);
ConsortiumManager.varifyConsortiumManagerIsAbsent();
},
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ export default {
cy.expect(Section({ id: 'app-settings-nav-pane' }).exists());
},

varifyConsortiumManagerOnPage() {
cy.expect(
Section({ id: 'settings-nav-pane' }).find(NavListItem('Consortium manager')).exists(),
);
},

varifyConsortiumManagerIsAbsent() {
cy.expect(
Section({ id: 'settings-nav-pane' }).find(NavListItem('Consortium manager')).absent(),
);
},

selectMembership() {
cy.do(NavListItem('Membership').click());
},
Expand Down
31 changes: 31 additions & 0 deletions cypress/support/fragments/users/userEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Modal,
MultiColumnList,
MultiColumnListCell,
SelectionOption,
MultiColumnListRow,
MultiSelect,
Pane,
Expand Down Expand Up @@ -123,6 +124,36 @@ export default {
cy.do(selectPermissionsModal.find(saveAndCloseBtn).click());
},

assignAllPermissionsToTenant(tenant, permission) {
cy.do([userDetailsPane.find(actionsButton).click(), editButton.click()]);
cy.wait(5000);
cy.do([
permissionsAccordion.clickHeader(),
Button({ id: 'user-assigned-affiliations-select' }).click(),
SelectionOption(tenant).click(),
addPermissionsButton.click(),
]);

cy.do(userSearch.fillIn(permission));
cy.expect(userSearch.is({ value: permission }));
// wait is needed to avoid so fast robot clicks
cy.wait(1000);
cy.do(Button('Search').click());
cy.do(
Modal({ id: 'permissions-modal' })
.find(Checkbox({ name: 'selected-selectAll' }))
.click(),
);
cy.wait(2000);
cy.do(selectPermissionsModal.find(saveAndCloseBtn).click());
},

verifyPermissionDoesNotExist(permission) {
cy.do([addPermissionsButton.click(), userSearch.fillIn(permission)]);
cy.expect(userSearch.is({ value: permission }));
// wait is needed to avoid so fast robot clicks
cy.wait(1000);
cy.do(Button('Search').click());
verifyPermissionDoesNotExistInSelectPermissions(permission) {
this.searchForPermission(permission);
cy.expect(selectPermissionsModal.find(HTML('The list contains no items')).exists());
Expand Down

0 comments on commit 1a1dff7

Please sign in to comment.