Skip to content

Commit

Permalink
Implement FAT-12537 (#3519)
Browse files Browse the repository at this point in the history
* Fix extended tests Thunderjet

* Implement FAT-12537

* Implement FAT-12537

---------
  • Loading branch information
IhorBohdan authored Apr 24, 2024
1 parent a039d1c commit 7d0a74f
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import permissions from '../../support/dictionary/permissions';
import Organizations from '../../support/fragments/organizations/organizations';
import TopMenu from '../../support/fragments/topMenu';
import Users from '../../support/fragments/users/users';
import getRandomPostfix from '../../support/utils/stringTools';
import NewOrganization from '../../support/fragments/organizations/newOrganization';

describe('Organizations', () => {
const organization = {
name: `1_autotest_name_${getRandomPostfix()}`,
status: 'Active',
code: `autotest_code_${getRandomPostfix()}`,
isVendor: false,
isDonor: true,
erpCode: `ERP-${getRandomPostfix()}`,
};
const firstContact = { ...NewOrganization.defaultContact };
const secondContact = {
firstName: `2AT_FN_${getRandomPostfix()}`,
lastName: `2AT_LN_${getRandomPostfix()}`,
};
let user;

before(() => {
cy.getAdminToken();
Organizations.createOrganizationViaApi(organization).then((response) => {
organization.id = response;
});
cy.loginAsAdmin({ path: TopMenu.organizationsPath, waiter: Organizations.waitLoading });
Organizations.searchByParameters('Name', organization.name);
Organizations.selectOrganization(organization.name);
Organizations.editOrganization();
Organizations.addNewDonorContact(firstContact);
Organizations.closeContact();
Organizations.addDonorContactToOrganization(firstContact);
Organizations.checkDonorContactIsAdd(firstContact);
Organizations.saveOrganization();
cy.createTempUser([
permissions.uiOrganizationsViewEdit.gui,
permissions.uiOrganizationsViewEditCreateDeletePrivilegedDonorInformation.gui,
]).then((userProperties) => {
user = userProperties;
cy.login(user.username, user.password, {
path: TopMenu.organizationsPath,
waiter: Organizations.waitLoading,
});
});
});

after(() => {
cy.getAdminToken();
Users.deleteViaApi(user.userId);
Organizations.getOrganizationViaApi({ query: `name="${organization.name}"` }).then(
(returnedOrganization) => {
Organizations.deleteOrganizationViaApi(returnedOrganization.id);
},
);
});

it(
'C423690 Add privileged donor information in Organization (NOT a vendor) record (thunderjet)',
{ tags: ['criticalPath', 'thunderjet'] },
() => {
Organizations.searchByParameters('Name', organization.name);
Organizations.selectOrganization(organization.name);
Organizations.editOrganization();
Organizations.addNewDonorContact(secondContact);
Organizations.closeContact();
Organizations.addDonorContactToOrganization(secondContact);
Organizations.checkDonorContactIsAdd(secondContact);
Organizations.cancelOrganization();
Organizations.keepEditingOrganization();
Organizations.saveOrganization();
},
);
});
4 changes: 4 additions & 0 deletions cypress/support/dictionary/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,10 @@ export default {
internal: 'ui-organizations.create',
gui: 'Organizations: View, edit, create',
},
uiOrganizationsViewEditCreateDeletePrivilegedDonorInformation: {
internal: 'ui-organizations.privileged-contacts.edit',
gui: 'Organizations: can view, create, edit, delete privileged donor information',
},
uiOrganizationsViewEditDelete: {
internal: 'ui-organizations.delete',
gui: 'Organizations: View, edit, delete',
Expand Down
46 changes: 45 additions & 1 deletion cypress/support/fragments/organizations/organizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,35 @@ export default {
InteractorsTools.checkCalloutMessage('The contact was saved');
},

addNewDonorContact: (contact) => {
cy.do([
Button({ id: 'accordion-toggle-button-privilegedDonorInformation' }).click(),
Section({ id: 'privilegedDonorInformation' }).find(Button('Add donor')).click(),
addContacsModal.find(buttonNew).click(),
lastNameField.fillIn(contact.lastName),
firstNameField.fillIn(contact.firstName),
saveButtonInCotact.click(),
]);
InteractorsTools.checkCalloutMessage('The contact was saved');
},

addDonorContactToOrganization: (contact) => {
cy.do([
Button({ id: 'accordion-toggle-button-privilegedDonorInformation' }).click(),
Section({ id: 'privilegedDonorInformation' }).find(Button('Add donor')).click(),
addContacsModal.find(TextField({ id: 'input-record-search' })).fillIn(contact.lastName),
addContacsModal.find(Button('Search')).click(),
]);
cy.wait(4000);
cy.do([
addContacsModal
.find(MultiColumnListCell({ row: 0, columnIndex: 0 }))
.find(Checkbox())
.click(),
addContacsModal.find(saveButton).click(),
]);
},

deleteContact: () => {
cy.do([actionsButton.click(), deleteButton.click(), confirmButton.click()]);
},
Expand Down Expand Up @@ -608,15 +637,29 @@ export default {
cy.do(Button('Cancel').click());
},

keepEditingOrganization: () => {
cy.do(
Modal({ id: 'cancel-editing-confirmation' })
.find(Button({ id: 'clickable-cancel-editing-confirmation-confirm' }))
.click(),
);
},

checkContactIsAdd: (contact) => {
cy.expect(
contactPeopleSection
Section({ id: 'privilegedDonorInformation' })
.find(MultiColumnListRow({ index: 0 }))
.find(MultiColumnListCell({ columnIndex: 0 }))
.has({ content: `${contact.lastName}, ${contact.firstName}` }),
);
},

checkDonorContactIsAdd: (contact, index = 0) => {
cy.get('#privilegedDonorInformation [data-row-index="row-' + index + '"]').within(() => {
cy.get('div[class*=mclCell-]').eq(0).contains(`${contact.lastName}, ${contact.firstName}`);
});
},

checkInterfaceIsAdd: (defaultInterface) => {
cy.do(openInterfaceSectionButton.click());
cy.expect(interfaceSection.find(KeyValue({ value: defaultInterface.name })).exists());
Expand Down Expand Up @@ -775,6 +818,7 @@ export default {

saveOrganization: () => {
cy.do(saveAndClose.click());
cy.wait(6000);
},

addBankingInformation: (bankingInformation) => {
Expand Down

0 comments on commit 7d0a74f

Please sign in to comment.