|
| 1 | +import { Permissions } from '../../../support/dictionary'; |
| 2 | +import InstanceRecordEdit from '../../../support/fragments/inventory/instanceRecordEdit'; |
| 3 | +import InstanceRecordView from '../../../support/fragments/inventory/instanceRecordView'; |
| 4 | +import InventoryInstances from '../../../support/fragments/inventory/inventoryInstances'; |
| 5 | +import TopMenu from '../../../support/fragments/topMenu'; |
| 6 | +import Users from '../../../support/fragments/users/users'; |
| 7 | +import getRandomPostfix from '../../../support/utils/stringTools'; |
| 8 | + |
| 9 | +describe('Inventory', () => { |
| 10 | + describe('Instance', () => { |
| 11 | + const testData = { |
| 12 | + instanceTitle: `AT_C400652_Instance_${getRandomPostfix()}`, |
| 13 | + statisticalCode1: 'ARL (Collection stats): books - Book, print (books)', |
| 14 | + statisticalCode2: 'ARL (Collection stats): ebooks - Books, electronic (ebooks)', |
| 15 | + filterValue: 'ARL', |
| 16 | + }; |
| 17 | + |
| 18 | + before('Create test user and login', () => { |
| 19 | + cy.getAdminToken(); |
| 20 | + cy.createTempUser([Permissions.inventoryAll.gui]).then((userProperties) => { |
| 21 | + testData.user = userProperties; |
| 22 | + |
| 23 | + cy.login(testData.user.username, testData.user.password, { |
| 24 | + path: TopMenu.inventoryPath, |
| 25 | + waiter: InventoryInstances.waitContentLoading, |
| 26 | + }); |
| 27 | + }); |
| 28 | + }); |
| 29 | + |
| 30 | + after('Delete test data', () => { |
| 31 | + cy.getAdminToken().then(() => { |
| 32 | + Users.deleteViaApi(testData.user.userId); |
| 33 | + InventoryInstances.deleteInstanceByTitleViaApi(testData.instanceTitle); |
| 34 | + }); |
| 35 | + }); |
| 36 | + |
| 37 | + it( |
| 38 | + 'C400652 Check the new formatting of Statistical codes field on Instance create/edit screen (folijet) (TaaS)', |
| 39 | + { tags: ['extendedPath', 'folijet', 'C400652'] }, |
| 40 | + () => { |
| 41 | + // Step 1: Go to Inventory -> Actions -> New |
| 42 | + const NewInstance = InventoryInstances.addNewInventory(); |
| 43 | + |
| 44 | + // Step 2: Click "Add statistical code" -> "Select code" dropdown appears |
| 45 | + NewInstance.clickAddStatisticalCodeButton(); |
| 46 | + |
| 47 | + // Step 3: Open "Select code" dropdown -> "Filter options list" + all codes present |
| 48 | + NewInstance.openStatisticalCodeDropdown(); |
| 49 | + NewInstance.verifyStatisticalCodeDropdown(); |
| 50 | + |
| 51 | + // Step 4: Filter by value -> list updated accordingly |
| 52 | + NewInstance.filterStatisticalCodeByName(testData.filterValue); |
| 53 | + NewInstance.verifyStatisticalCodeListOptionsFilteredBy(testData.filterValue); |
| 54 | + |
| 55 | + // Step 5: Select a value -> shown in dropdown, no error |
| 56 | + NewInstance.filterStatisticalCodeByName(testData.filterValue); |
| 57 | + NewInstance.selectStatisticalCode(testData.statisticalCode1); |
| 58 | + NewInstance.checkErrorMessageForStatisticalCode(false); |
| 59 | + |
| 60 | + // Steps 6-7: Fill required fields |
| 61 | + NewInstance.fillRequiredValues(testData.instanceTitle); |
| 62 | + |
| 63 | + // Step 8: Save & close |
| 64 | + NewInstance.clickSaveAndCloseButton(); |
| 65 | + |
| 66 | + // Step 9: Actions -> Edit instance |
| 67 | + InstanceRecordView.edit(); |
| 68 | + InstanceRecordEdit.waitLoading(); |
| 69 | + |
| 70 | + // Step 10: Repeat steps 3-5 on edit screen |
| 71 | + NewInstance.clickAddStatisticalCodeButton(); |
| 72 | + InstanceRecordEdit.openStatisticalCodeDropdown(1); |
| 73 | + InstanceRecordEdit.verifyStatisticalCodeDropdown(); |
| 74 | + InstanceRecordEdit.filterStatisticalCodeByName(testData.filterValue); |
| 75 | + InstanceRecordEdit.verifyStatisticalCodeListOptionsFilteredBy(testData.filterValue); |
| 76 | + |
| 77 | + InstanceRecordEdit.chooseStatisticalCode(testData.statisticalCode2); |
| 78 | + InstanceRecordEdit.checkErrorMessageForStatisticalCode(false); |
| 79 | + }, |
| 80 | + ); |
| 81 | + }); |
| 82 | +}); |
0 commit comments