Skip to content

Commit 9e9aea5

Browse files
Merge pull request #7468 from folio-org/FAT-27503
FAT-27503-C68880-C889719-C889720-C1259779-C1259780-C1282798-C1282801
2 parents 3d42d7f + fc24a73 commit 9e9aea5

16 files changed

Lines changed: 1529 additions & 47 deletions

cypress/e2e/lists/create-list/add-new-list.cy.js

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,64 @@ import Users from '../../../support/fragments/users/users';
55
import { getTestEntityValue } from '../../../support/utils/stringTools';
66

77
describe('Lists', () => {
8-
describe('Add new list', () => {
9-
let userData = {};
10-
const listData = {
11-
name: getTestEntityValue('list'),
12-
};
8+
describe(
9+
'Add new list',
10+
{
11+
retries: {
12+
runMode: 1,
13+
},
14+
},
15+
() => {
16+
let userData = {};
17+
let listData;
18+
19+
beforeEach('Create test data', () => {
20+
listData = {
21+
name: getTestEntityValue('list'),
22+
};
1323

14-
before('Create test data', () => {
15-
cy.getAdminToken();
16-
cy.createTempUser([
17-
Permissions.listsEdit.gui,
18-
Permissions.usersViewRequests.gui,
19-
Permissions.uiOrdersCreate.gui,
20-
Permissions.inventoryAll.gui,
21-
Permissions.loansAll.gui,
22-
Permissions.uiOrganizationsViewEditCreate.gui,
23-
]).then((userProperties) => {
24-
userData = userProperties;
24+
cy.createTempUser([
25+
Permissions.listsEdit.gui,
26+
Permissions.usersViewRequests.gui,
27+
Permissions.uiOrdersCreate.gui,
28+
Permissions.inventoryAll.gui,
29+
Permissions.loansAll.gui,
30+
Permissions.uiOrganizationsViewEditCreate.gui,
31+
]).then((userProperties) => {
32+
userData = userProperties;
33+
});
2534
});
26-
});
2735

28-
after('Delete test data', () => {
29-
cy.getAdminToken();
30-
Lists.deleteListByNameViaApi(listData.name);
31-
Users.deleteViaApi(userData.userId);
32-
});
36+
afterEach('Delete test data', () => {
37+
cy.getAdminToken();
38+
Lists.deleteListByNameViaApi(listData.name);
39+
Users.deleteViaApi(userData.userId);
40+
});
3341

34-
it(
35-
'C411705 Verify that created new list is visible on the "Lists" landing page (corsair)',
36-
{ tags: ['smoke', 'corsair', 'shiftLeft', 'C411705'] },
37-
() => {
38-
cy.login(userData.username, userData.password, {
39-
path: TopMenu.listsPath,
40-
waiter: Lists.waitLoading,
41-
});
42-
Lists.openNewListPane();
43-
Lists.setName(listData.name);
44-
Lists.setDescription(listData.name);
45-
Lists.selectRecordType('Loans');
46-
Lists.selectVisibility('Shared');
47-
Lists.selectStatus('Active');
48-
Lists.saveList();
49-
Lists.verifySuccessCalloutMessage(`List ${listData.name} saved.`);
50-
Lists.closeListDetailsPane();
51-
Lists.findResultRowIndexByContent(listData.name).then((rowIndex) => {
52-
Lists.checkResultSearch(listData, rowIndex);
53-
});
54-
},
55-
);
56-
});
42+
it(
43+
'C411705 Verify that created new list is visible on the "Lists" landing page (corsair)',
44+
{ tags: ['smoke', 'corsair', 'shiftLeft', 'C411705'] },
45+
() => {
46+
cy.login(userData.username, userData.password, {
47+
path: TopMenu.listsPath,
48+
waiter: Lists.waitLoading,
49+
});
50+
Lists.openNewListPane();
51+
Lists.setName(listData.name);
52+
Lists.setDescription(listData.name);
53+
Lists.selectRecordType('Loans');
54+
Lists.selectVisibility('Shared');
55+
Lists.selectStatus('Active');
56+
Lists.saveList();
57+
Lists.verifySuccessCalloutMessage(`List ${listData.name} saved.`);
58+
Lists.verifyRecordsNumber('No');
59+
cy.wait(4000);
60+
Lists.closeListDetailsPane();
61+
Lists.findResultRowIndexByContent(listData.name).then((rowIndex) => {
62+
Lists.checkResultSearch(listData, rowIndex);
63+
});
64+
},
65+
);
66+
},
67+
);
5768
});
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import Permissions from '../../../../support/dictionary/permissions';
2+
import { FEE_FINE_ACCOUNTS_WITH_USERS_FIELDS } from '../../../../support/constants/query-builder/feeFineAccountsWithUsersFields';
3+
import QueryModal from '../../../../support/fragments/bulk-edit/query-modal';
4+
import { Lists } from '../../../../support/fragments/lists/lists';
5+
import TopMenu from '../../../../support/fragments/topMenu';
6+
import Users from '../../../../support/fragments/users/users';
7+
import getRandomPostfix from '../../../../support/utils/stringTools';
8+
9+
let user;
10+
const listName = `AT_C1259779_List_${getRandomPostfix()}`;
11+
12+
describe('Lists', () => {
13+
describe('Query Builder', () => {
14+
describe('Composite Entity Types', () => {
15+
before('Create test user and login', () => {
16+
cy.createTempUser([
17+
Permissions.listsEdit.gui,
18+
Permissions.uiFeeFinesActions.gui,
19+
Permissions.uiFeeFines.gui,
20+
Permissions.uiUsersViewLoans.gui,
21+
]).then((userProperties) => {
22+
user = userProperties;
23+
24+
cy.login(user.username, user.password, {
25+
path: TopMenu.listsPath,
26+
waiter: Lists.waitLoading,
27+
});
28+
});
29+
});
30+
31+
after('Delete test data', () => {
32+
cy.getAdminToken();
33+
Users.deleteViaApi(user.userId);
34+
});
35+
36+
it(
37+
'C1259779 Composite ET: Fee/fine accounts with users (corsair)',
38+
{ tags: ['extendedPath', 'corsair', 'C1259779'] },
39+
() => {
40+
// Step 1: Click on "New" button, add list name, click on "Select record type" dropdown and select "Fee/Fine accounts with users"
41+
Lists.openNewListPane();
42+
Lists.setName(listName);
43+
Lists.selectRecordType(Lists.recordTypes.feeFineAccountsWithUsers);
44+
Lists.verifySaveButtonIsActive();
45+
Lists.verifyCancelButtonIsActive();
46+
47+
// Step 2: Click on "Build query" button
48+
Lists.buildQuery();
49+
QueryModal.verify();
50+
51+
// Step 3: Click on the "Field" dropdown
52+
QueryModal.clickSelectFieldButton();
53+
QueryModal.closeOpenedSelection();
54+
55+
// Step 4: Search for the source "Fee/Fine accounts"
56+
Object.values(FEE_FINE_ACCOUNTS_WITH_USERS_FIELDS.FEE_FINE_ACCOUNTS).forEach(
57+
(fieldName) => {
58+
QueryModal.selectField(fieldName);
59+
},
60+
);
61+
62+
// Step 5: Search for the source "User"
63+
Object.values(FEE_FINE_ACCOUNTS_WITH_USERS_FIELDS.USER).forEach((fieldName) => {
64+
QueryModal.selectField(fieldName);
65+
});
66+
67+
// Step 6: Search for the source "User — Patron group"
68+
Object.values(FEE_FINE_ACCOUNTS_WITH_USERS_FIELDS.PATRON_GROUP).forEach((fieldName) => {
69+
QueryModal.selectField(fieldName);
70+
});
71+
},
72+
);
73+
});
74+
});
75+
});
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
import uuid from 'uuid';
2+
import moment from 'moment';
3+
import Permissions from '../../../../support/dictionary/permissions';
4+
import { LOST_ITEMS_REQUIRING_ACTUAL_COST_FIELDS } from '../../../../support/constants/query-builder/lostItemsRequiringActualCostFields';
5+
import QueryModal, { QUERY_OPERATIONS } from '../../../../support/fragments/bulk-edit/query-modal';
6+
import { Lists } from '../../../../support/fragments/lists/lists';
7+
import TopMenu from '../../../../support/fragments/topMenu';
8+
import Users from '../../../../support/fragments/users/users';
9+
import InventoryInstances from '../../../../support/fragments/inventory/inventoryInstances';
10+
import { Locations, ServicePoints } from '../../../../support/fragments/settings/tenant';
11+
import UserEdit from '../../../../support/fragments/users/userEdit';
12+
import Checkout from '../../../../support/fragments/checkout/checkout';
13+
import UserLoans from '../../../../support/fragments/users/loans/userLoans';
14+
import UsersOwners from '../../../../support/fragments/settings/users/usersOwners';
15+
import LostItemFeePolicy from '../../../../support/fragments/circulation/lost-item-fee-policy';
16+
import CirculationRules from '../../../../support/fragments/circulation/circulation-rules';
17+
import getRandomPostfix from '../../../../support/utils/stringTools';
18+
19+
let user;
20+
const listName = `AT_C1282801_List_${getRandomPostfix()}`;
21+
const instanceName = `AT_C1282801_FolioInstance_${getRandomPostfix()}`;
22+
const itemBarcode = `barcode-${getRandomPostfix()}`;
23+
24+
const testData = {
25+
userServicePoint: ServicePoints.getDefaultServicePointWithPickUpLocation(),
26+
};
27+
28+
const ownerBody = {
29+
owner: 'AutotestOwner' + getRandomPostfix(),
30+
servicePointOwner: [
31+
{
32+
value: testData.userServicePoint.id,
33+
label: testData.userServicePoint.name,
34+
},
35+
],
36+
};
37+
38+
const lostItemFeePolicy = {
39+
name: `ActualCostPolicy_${getRandomPostfix()}`,
40+
chargeAmountItem: {
41+
chargeType: 'actualCost',
42+
amount: 0.0,
43+
},
44+
lostItemProcessingFee: 0.0,
45+
chargeAmountItemPatron: true,
46+
chargeAmountItemSystem: true,
47+
returnedLostItemProcessingFee: false,
48+
replacedLostItemProcessingFee: false,
49+
replacementProcessingFee: 0.0,
50+
replacementAllowed: false,
51+
lostItemReturned: 'Charge',
52+
id: uuid(),
53+
};
54+
55+
describe('Lists', () => {
56+
describe('Query Builder', () => {
57+
describe('Composite Entity Types', () => {
58+
before('Create test data', () => {
59+
cy.getAdminToken();
60+
ServicePoints.getCircDesk2ServicePointViaApi().then((servicePoint) => {
61+
testData.userServicePoint = servicePoint;
62+
63+
Locations.getViaApiAnyDefault().then((location) => {
64+
testData.defaultLocation = location[0];
65+
66+
testData.instanceId = InventoryInstances.createInstanceViaApi(
67+
instanceName,
68+
itemBarcode,
69+
);
70+
cy.getHoldings({ limit: 1, query: `"instanceId"="${testData.instanceId}"` }).then(
71+
(holdings) => {
72+
cy.updateHoldingRecord(holdings[0].id, {
73+
...holdings[0],
74+
permanentLocationId: testData.defaultLocation.id,
75+
});
76+
},
77+
);
78+
79+
cy.getItems({ limit: 1, expandAll: true, query: `"barcode"=="${itemBarcode}"` }).then(
80+
(res) => {
81+
testData.materialTypeId = res.materialType.id;
82+
testData.itemId = res.id;
83+
84+
LostItemFeePolicy.createViaApi(lostItemFeePolicy);
85+
CirculationRules.addRuleViaApi(
86+
{ m: testData.materialTypeId },
87+
{ i: lostItemFeePolicy.id },
88+
).then((newRule) => {
89+
testData.addedRule = newRule;
90+
});
91+
},
92+
);
93+
94+
UsersOwners.createViaApi(ownerBody).then((ownerResponse) => {
95+
testData.ownerId = ownerResponse.id;
96+
});
97+
98+
cy.createTempUser([
99+
Permissions.listsEdit.gui,
100+
Permissions.uiUsersView.gui,
101+
Permissions.uiUserLostItemRequiringActualCost.gui,
102+
]).then((userProperties) => {
103+
user = userProperties;
104+
105+
UserEdit.addServicePointViaApi(testData.userServicePoint.id, user.userId);
106+
Checkout.checkoutItemViaApi({
107+
itemBarcode,
108+
userBarcode: user.barcode,
109+
servicePointId: testData.userServicePoint.id,
110+
});
111+
UserLoans.getUserLoansIdViaApi(user.userId).then((userLoans) => {
112+
UserLoans.declareLoanLostViaApi(
113+
{
114+
servicePointId: testData.userServicePoint.id,
115+
declaredLostDateTime: moment.utc().format(),
116+
},
117+
userLoans.loans[0].id,
118+
);
119+
});
120+
121+
cy.login(user.username, user.password, {
122+
path: TopMenu.listsPath,
123+
waiter: Lists.waitLoading,
124+
});
125+
});
126+
});
127+
});
128+
});
129+
130+
after('Delete test data', () => {
131+
cy.getAdminToken();
132+
CirculationRules.deleteRuleViaApi(testData.addedRule);
133+
InventoryInstances.deleteInstanceAndHoldingRecordAndAllItemsViaApi(itemBarcode);
134+
LostItemFeePolicy.deleteViaApi(lostItemFeePolicy.id);
135+
Users.deleteViaApi(user.userId);
136+
UsersOwners.deleteViaApi(testData.ownerId);
137+
Lists.deleteListByNameViaApi(listName);
138+
});
139+
140+
it(
141+
'C1282801 Composite ET: Lost items requiring actual cost (corsair)',
142+
{ tags: ['criticalPath', 'corsair', 'C1282801'] },
143+
() => {
144+
// Step 1: Click "New" button, enter list name, select "Lost items requiring actual cost" record type
145+
Lists.openNewListPane();
146+
Lists.setName(listName);
147+
Lists.selectRecordType(Lists.recordTypes.lostItemsRequiringActualCost);
148+
Lists.verifySaveButtonIsActive();
149+
Lists.verifyCancelButtonIsActive();
150+
151+
// Step 2: Click "Build query" button
152+
Lists.buildQuery();
153+
QueryModal.verify();
154+
155+
// Step 3: Click "Field" dropdown - verify field sources available
156+
QueryModal.verifyAllAvailableFieldOptions([
157+
...Object.values(LOST_ITEMS_REQUIRING_ACTUAL_COST_FIELDS.ACTUAL_COST),
158+
...Object.values(LOST_ITEMS_REQUIRING_ACTUAL_COST_FIELDS.ACTUAL_COST_CREATED_BY),
159+
...Object.values(LOST_ITEMS_REQUIRING_ACTUAL_COST_FIELDS.ACTUAL_COST_UPDATED_BY),
160+
...Object.values(LOST_ITEMS_REQUIRING_ACTUAL_COST_FIELDS.USER),
161+
]);
162+
163+
// Step 4: Build a query that returns at least 1 record
164+
QueryModal.selectField(LOST_ITEMS_REQUIRING_ACTUAL_COST_FIELDS.USER.BARCODE);
165+
QueryModal.selectOperator(QUERY_OPERATIONS.EQUAL);
166+
QueryModal.fillInValueTextfield(user.barcode);
167+
QueryModal.testQuery();
168+
169+
// Verify precondition record is in results
170+
QueryModal.verifyPreviewOfRecordsMatched();
171+
QueryModal.verifyNumberOfMatchedRecords(1);
172+
Lists.verifyResultCellContains(
173+
0,
174+
LOST_ITEMS_REQUIRING_ACTUAL_COST_FIELDS.USER.BARCODE,
175+
user.barcode,
176+
);
177+
178+
// Step 5: Click "Run query & save"
179+
Lists.runQueryAndSave();
180+
Lists.verifyListSavedCalloutMessage(listName);
181+
182+
// Step 6: Wait for list refresh - verify toast and record count
183+
Lists.waitForCompilingToComplete();
184+
Lists.verifySingleRecordNumber();
185+
186+
// Step 7: Verify record table displays based on query
187+
Lists.verifyResultCellContains(
188+
0,
189+
LOST_ITEMS_REQUIRING_ACTUAL_COST_FIELDS.USER.BARCODE,
190+
user.barcode,
191+
);
192+
},
193+
);
194+
});
195+
});
196+
});

0 commit comments

Comments
 (0)