Skip to content

Commit

Permalink
Implementing of FAT-10199 (#2979)
Browse files Browse the repository at this point in the history
  • Loading branch information
IhorBohdan committed Jan 5, 2024
1 parent f608fac commit 441cca9
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import Permissions from '../../support/dictionary/permissions';
import Affiliations, { tenantNames } from '../../support/dictionary/affiliations';
import Users from '../../support/fragments/users/users';
import TopMenu from '../../support/fragments/topMenu';
import ConsortiumManager from '../../support/fragments/settings/consortium-manager/consortium-manager';

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

before(() => {
cy.getAdminToken();
});

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

it(
'C388499: "Switch active affiliation" option is NOT displayed when a user has only one assigned affiliation (consortia)(thunderjet)',
{ tags: ['criticalPath', 'thunderjet'] },
() => {
cy.createTempUser([
Permissions.consortiaSettingsConsortiaAffiliationsEdit.gui,
Permissions.uiUsersPermissions.gui,
Permissions.uiUserEdit.gui,
Permissions.uiUsersPermissionsView.gui,
Permissions.uiUsersView.gui,
])
.then((userProperties) => {
user = userProperties;
cy.login(user.username, user.password, {
path: TopMenu.usersPath,
waiter: Users.waitLoading,
});
cy.wait(8000);
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.central);
ConsortiumManager.switchActiveAffiliationIsAbsent();
})
.then(() => {
cy.getAdminToken();
cy.assignAffiliationToUser(Affiliations.College, user.userId);
cy.setTenant(Affiliations.College);
});
cy.reload();
ConsortiumManager.switchActiveAffiliationExists();
ConsortiumManager.switchActiveAffiliation(tenantNames.college);
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.college);
},
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import {
HTML,
} from '../../../../../interactors';

const myProfileButton = Button({ ariaLabel: 'My profile' });
const switchActiveAffiliationButton = Button('Switch active affiliation');

export default {
waitLoading() {
cy.expect(Section({ id: 'app-settings-nav-pane' }).exists());
Expand Down Expand Up @@ -60,8 +63,8 @@ export default {
switchActiveAffiliation(tenantName) {
cy.wait(8000);
cy.do([
Button({ ariaLabel: 'My profile' }).click(),
Button('Switch active affiliation').click(),
myProfileButton.click(),
switchActiveAffiliationButton.click(),
Modal('Select affiliation')
.find(Button({ id: 'consortium-affiliations-select' }))
.click(),
Expand All @@ -71,11 +74,21 @@ export default {
cy.wait(8000);
},

switchActiveAffiliationIsAbsent() {
cy.wait(8000);
cy.do(myProfileButton.click());
cy.expect(switchActiveAffiliationButton.absent());
cy.do(myProfileButton.click());
},

switchActiveAffiliationExists() {
cy.wait(8000);
cy.do(myProfileButton.click());
cy.expect(switchActiveAffiliationButton.exists());
cy.do(myProfileButton.click());
},

checkCurrentTenantInTopMenu(tenantName) {
cy.expect(
Button({ ariaLabel: 'My profile' })
.find(HTML({ text: including(tenantName) }))
.exists(),
);
cy.expect(myProfileButton.find(HTML({ text: including(tenantName) })).exists());
},
};

0 comments on commit 441cca9

Please sign in to comment.