Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing of FAT-10199 #2979

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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());
},
};