Skip to content

Commit

Permalink
Merge branch 'master' into FAT-13622
Browse files Browse the repository at this point in the history
  • Loading branch information
sviatlana-stsiapanava committed May 27, 2024
2 parents 1129dda + 8b00530 commit d1dab2d
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import permissions from '../../../support/dictionary/permissions';
import FinanceHelp from '../../../support/fragments/finance/financeHelper';
import FiscalYears from '../../../support/fragments/finance/fiscalYears/fiscalYears';
import Funds from '../../../support/fragments/finance/funds/funds';
import Ledgers from '../../../support/fragments/finance/ledgers/ledgers';
import TopMenu from '../../../support/fragments/topMenu';
import Users from '../../../support/fragments/users/users';
import NewLocation from '../../../support/fragments/settings/tenant/locations/newLocation';
import ServicePoints from '../../../support/fragments/settings/tenant/servicePoints/servicePoints';

describe('ui-finance: Funds', () => {
const defaultFund = { ...Funds.defaultUiFund };
const defaultFiscalYear = { ...FiscalYears.defaultUiFiscalYear };
const defaultLedger = { ...Ledgers.defaultUiLedger };
let user;
let servicePointId;
let location;

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

FiscalYears.createViaApi(defaultFiscalYear).then((response) => {
defaultFiscalYear.id = response.id;
defaultLedger.fiscalYearOneId = defaultFiscalYear.id;

Ledgers.createViaApi(defaultLedger).then((ledgerResponse) => {
defaultLedger.id = ledgerResponse.id;
defaultFund.ledgerId = defaultLedger.id;
Funds.createViaApi(defaultFund).then((fundResponse) => {
defaultFund.id = fundResponse.fund.id;
});
});
});

ServicePoints.getViaApi().then((servicePoint) => {
servicePointId = servicePoint[0].id;
NewLocation.createViaApi(NewLocation.getDefaultLocation(servicePointId)).then((res) => {
location = res;
});
});

cy.createTempUser([permissions.uiFinanceViewEditCreateFundAndBudget.gui]).then(
(userProperties) => {
user = userProperties;
cy.login(userProperties.username, userProperties.password, {
path: TopMenu.fundPath,
waiter: Funds.waitLoading,
});
},
);
});

after(() => {
cy.getAdminToken();
Funds.deleteFundViaApi(defaultFund.id);
Ledgers.deleteledgerViaApi(defaultLedger.id);
FiscalYears.deleteFiscalYearViaApi(defaultFiscalYear.id);
Users.deleteViaApi(user.userId);
});

it(
'C423530 Marking Fund as restricted by location when create a fund (thunderjet)',
{ tags: ['criticalPath', 'thunderjet'] },
() => {
FinanceHelp.searchByName(defaultFund.name);
Funds.selectFund(defaultFund.name);
Funds.editBudget();
Funds.clickRestrictByLocationsCheckbox();
Funds.varifyLocationSectionExist();
Funds.addLocationToFund(location.name);
Funds.save();
Funds.varifyFundIsSaved();
Funds.waitForFundDetailsLoading();
},
);
});
9 changes: 6 additions & 3 deletions cypress/e2e/requests/request-types-filter.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ describe('ui-requests: Make sure that request type filters are working properly'
cy.visit(TopMenu.requestsPath);
// Apply filters and test that the appropriate results display
requests.forEach(({ requestType }) => {
// eslint-disable-next-line spaced-comment
//Requests.waitUIFilteredByRequestType();
Requests.checkRequestType(requestType);
Requests.waitUIFilteredByRequestType();
Requests.verifyIsFilteredByRequestType(requestType);
Requests.resetAllFilters();
});
Expand All @@ -97,7 +98,8 @@ describe('ui-requests: Make sure that request type filters are working properly'
// Navigate to other apps and back to ensure the filters are saved
requests.forEach(({ requestType }) => {
Requests.checkRequestType(requestType);
Requests.waitUIFilteredByRequestType();
// eslint-disable-next-line spaced-comment
//Requests.waitUIFilteredByRequestType();
Requests.verifyIsFilteredByRequestType(requestType);
Requests.navigateToApp('Data export');
cy.expect(Pane({ title: 'Logs' }).exists());
Expand All @@ -117,7 +119,8 @@ describe('ui-requests: Make sure that request type filters are working properly'
// Test that filters and search terms work well together
requests.forEach(({ requestType, instance: { title } }) => {
Requests.checkRequestType(requestType);
Requests.waitUIFilteredByRequestType();
// eslint-disable-next-line spaced-comment
//Requests.waitUIFilteredByRequestType();
Requests.findCreatedRequest(title);
Requests.verifyCreatedRequest(title);
Requests.resetAllFilters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@ describe('Create Item or Title level request', () => {
testData.userServicePoint.id,
);
TitleLevelRequests.enableTLRViaApi();
cy.wait(3000);
cy.getInstance({
limit: 1,
expandAll: true,
query: `"id"=="${instanceData.instanceId}"`,
}).then((instance) => {
cy.wait(3000).then(() => {
instanceData.instanceHRID = instance.hrid;
});
instanceData.instanceHRID = instance.hrid;
});
Requests.createNewRequestViaApi({
fulfillmentPreference: FULFILMENT_PREFERENCES.HOLD_SHELF,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,13 @@ describe('Title level Request', () => {
})
.then(() => {
TitleLevelRequests.enableTLRViaApi();
cy.wait(3000);
cy.getInstance({
limit: 1,
expandAll: true,
query: `"id"=="${instanceData.instanceId}"`,
}).then((instance) => {
cy.wait(3000).then(() => {
instanceData.instanceHRID = instance.hrid;
});
instanceData.instanceHRID = instance.hrid;
});
})
.then(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,13 @@ describe('Create Item or Title level request', () => {
})
.then(() => {
TitleLevelRequests.enableTLRViaApi();
cy.wait(3000);
cy.getInstance({
limit: 1,
expandAll: true,
query: `"id"=="${instanceData.instanceId}"`,
}).then((instance) => {
cy.wait(3000).then(() => {
instanceData.instanceHRID = instance.hrid;
});
instanceData.instanceHRID = instance.hrid;
});
})
.then(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,13 @@ describe('Title Level Request. Create Item or Title level request', () => {
],
}).then((specialInstanceIds) => {
instanceData.instanceId = specialInstanceIds.instanceId;
cy.wait(3000);
cy.getInstance({
limit: 1,
expandAll: true,
query: `"id"=="${instanceData.instanceId}"`,
}).then((instance) => {
cy.wait(3000).then(() => {
testData.instanceHRID = instance.hrid;
});
testData.instanceHRID = instance.hrid;
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,13 @@ describe('Title Level Request', () => {
testData.servicePoint.id,
);
instanceData = testData.folioInstances[0];
cy.wait(3000);
cy.getInstance({
limit: 1,
expandAll: true,
query: `"id"=="${instanceData.instanceId}"`,
}).then((instance) => {
cy.wait(3000).then(() => {
testData.instanceHRID = instance.hrid;
});
testData.instanceHRID = instance.hrid;
});
TitleLevelRequests.enableTLRViaApi();
Requests.createNewRequestViaApi({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,13 @@ describe('Title Level Request. Request detail', () => {
instanceData.instanceId = specialInstanceIds.instanceId;
instanceData.holdingId = specialInstanceIds.holdingIds[0].id;
instanceData.itemId = specialInstanceIds.holdingIds[0].itemIds;
cy.wait(3000);
cy.getInstance({
limit: 1,
expandAll: true,
query: `"id"=="${instanceData.instanceId}"`,
}).then((instance) => {
cy.wait(3000).then(() => {
instanceHRID = instance.hrid;
});
instanceHRID = instance.hrid;
});
});
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,13 @@ describe('Title Level Request', () => {
],
}).then((specialInstanceIds) => {
instanceData.instanceId = specialInstanceIds.instanceId;
cy.wait(3000);
cy.getInstance({
limit: 1,
expandAll: true,
query: `"id"=="${instanceData.instanceId}"`,
}).then((instance) => {
cy.wait(3000).then(() => {
testData.instanceHRID = instance.hrid;
});
testData.instanceHRID = instance.hrid;
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,13 @@ describe('Create Item or Title level request', () => {
testData.userServicePoint.id,
);
TitleLevelRequests.enableTLRViaApi();
cy.wait(3000);
cy.getInstance({
limit: 1,
expandAll: true,
query: `"id"=="${instanceData.instanceId}"`,
}).then((instance) => {
cy.wait(3000).then(() => {
testData.instanceHRID = instance.hrid;
});
testData.instanceHRID = instance.hrid;
});
Checkout.checkoutItemViaApi({
id: uuid(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,13 @@ describe('Create Item or Title level request', () => {
userData.userId,
testData.userServicePoint.id,
);
cy.wait(3000);
cy.getInstance({
limit: 1,
expandAll: true,
query: `"id"=="${instanceData.instanceId}"`,
}).then((instance) => {
cy.wait(3000).then(() => {
instanceData.instanceHRID = instance.hrid;
});
instanceData.instanceHRID = instance.hrid;
});
TitleLevelRequests.enableTLRViaApi();
cy.login(userData.username, userData.password, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,23 @@ export default {
},

cancelMultipleCheckOutModal: () => {
cy.wait(500);
cy.do(modal.find(Button('Cancel')).click());
cy.expect(modal.absent());
},

openLoanDetails() {
cy.do(actionsButton.click());
cy.wait(500);
cy.do(Button('Loan details').click());
cy.wait(500);
cy.expect(Pane({ id: 'pane-loandetails' }).exists());
},

openCheckOutNotes() {
cy.wait(500);
cy.do(actionsButton.click());
cy.wait(500);
cy.expect(checkOutNotesButton.exists());
cy.do(checkOutNotesButton.click());
},
Expand Down
23 changes: 19 additions & 4 deletions cypress/support/fragments/finance/funds/funds.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ const addExpenseClassButton = Button({ id: 'budget-status-expense-classes-add-bu
const saveAndClose = Button('Save & close');
const fundFormSection = Section({ id: 'pane-fund-form' });
const locationSection = Section({ id: 'locations' });
const editButton = Button('Edit');
const selectLocationsModal = Modal('Select locations');

export default {
defaultUiFund: {
Expand Down Expand Up @@ -166,6 +168,19 @@ export default {
cy.wait(4000);
},

addLocationToFund(locationName) {
cy.do([
locationSection.find(Button({ id: 'fund-locations' })).click(),
selectLocationsModal.find(SearchField({ id: 'input-record-search' })).fillIn(locationName),
Button('Search').click(),
]);
cy.wait(2000);
cy.do([
selectLocationsModal.find(Checkbox({ ariaLabel: 'Select all' })).click(),
selectLocationsModal.find(Button('Save')).click(),
]);
},

varifyLocationSectionExist() {
cy.expect(fundFormSection.find(locationSection).exists());
},
Expand Down Expand Up @@ -212,7 +227,7 @@ export default {
addGroupToFund: (group) => {
cy.do([
actionsButton.click(),
Button('Edit').click(),
editButton.click(),
MultiSelect({ label: 'Group' }).select([group]),
saveAndCloseButton.click(),
]);
Expand All @@ -222,7 +237,7 @@ export default {
addTransferTo: (fund) => {
cy.do([
actionsButton.click(),
Button('Edit').click(),
editButton.click(),
MultiSelect({ label: 'Transfer to' }).select([fund]),
saveAndCloseButton.click(),
]);
Expand Down Expand Up @@ -856,7 +871,7 @@ export default {

editBudget: () => {
cy.wait(4000);
cy.do([actionsButton.click(), Button('Edit').click()]);
cy.do([actionsButton.click(), editButton.click()]);
},

changeStatusOfBudget: (statusName, fund, fiscalYear) => {
Expand Down Expand Up @@ -1051,7 +1066,7 @@ export default {
},

addAUToFund: (AUName) => {
cy.do([actionsButton.click(), Button('Edit').click()]);
cy.do([actionsButton.click(), editButton.click()]);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(4000);
cy.do([
Expand Down
5 changes: 4 additions & 1 deletion cypress/support/fragments/inventory/createPageTypeRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default {

clickItemBarcodeLink(barcode) {
cy.do(Link(barcode).click());
cy.wait(500);
this.verifyInventoryDetailsPage(barcode);
},

Expand Down Expand Up @@ -112,10 +113,12 @@ export default {

saveAndClose(servicePointName = 'Circ Desk 1') {
newRequest.chooseRequestType(REQUEST_TYPES.PAGE);
cy.wait(500);
Requests.verifyFulfillmentPreference();
newRequest.choosePickupServicePoint(servicePointName);
cy.wait(1000);
cy.wait(500);
newRequest.saveRequestAndClose();
cy.wait(500);
Requests.verifyRequestsPage();
this.verifyNewRequest();
},
Expand Down
5 changes: 5 additions & 0 deletions cypress/support/fragments/requests/newRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ function addRequester(userName) {
}

function openNewRequestPane() {
cy.do(actionsButton.click());
cy.wait(500);
cy.do([actionsButton.click(), newRequestButton.click()]);
}

Expand Down Expand Up @@ -86,6 +88,7 @@ export default {
cy.do(enterRequesterBarcodeButton.click());
cy.expect(selectServicePoint.exists);
cy.wait('@getUsers');
cy.wait(500);
cy.do(selectRequestType.choose(newRequest.requestType));
},

Expand All @@ -100,7 +103,9 @@ export default {
createNewRequest(newRequest) {
openNewRequestPane();
this.fillRequiredFields(newRequest);
cy.wait(500);
this.choosePickupServicePoint(newRequest.pickupServicePoint);
cy.wait(500);
this.saveRequestAndClose();
this.waitLoading();
},
Expand Down
Loading

0 comments on commit d1dab2d

Please sign in to comment.