From 7d9e683a80b471dda15f43ff853f5f8a7bff608b Mon Sep 17 00:00:00 2001 From: Kyrylo Brener Date: Wed, 18 Dec 2024 13:45:15 +0200 Subject: [PATCH 1/3] minor changes for fse ui tests to address non-english localization --- cypress/e2e/fse/ui/copycat-ui.cy.js | 10 ++++------ cypress/e2e/fse/ui/data-import-ui.cy.js | 2 +- cypress/support/fragments/data_import/dataImport.js | 5 +++++ .../fragments/inventory/inventorySearchAndFilter.js | 2 +- .../inventory/integrations/z39.50TargetProfiles.js | 4 ++++ .../fragments/settings/inventory/settingsInventory.js | 9 +++++++++ 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/fse/ui/copycat-ui.cy.js b/cypress/e2e/fse/ui/copycat-ui.cy.js index 15729aa29a..69ba871e35 100644 --- a/cypress/e2e/fse/ui/copycat-ui.cy.js +++ b/cypress/e2e/fse/ui/copycat-ui.cy.js @@ -1,7 +1,5 @@ import TopMenu from '../../../support/fragments/topMenu'; -import SettingsInventory, { - INVENTORY_SETTINGS_TABS, -} from '../../../support/fragments/settings/inventory/settingsInventory'; +import SettingsInventory from '../../../support/fragments/settings/inventory/settingsInventory'; import Z3950TargetProfiles from '../../../support/fragments/settings/inventory/integrations/z39.50TargetProfiles'; describe('fse-copycat - UI for productions tenants', () => { @@ -17,9 +15,9 @@ describe('fse-copycat - UI for productions tenants', () => { { tags: ['sanity', 'fse', 'ui', 'copycat'] }, () => { cy.visit(TopMenu.settingsPath); - SettingsInventory.goToSettingsInventory(); - SettingsInventory.selectSettingsTab(INVENTORY_SETTINGS_TABS.TARGET_PROFILES); - Z3950TargetProfiles.verifyTargetProfilesListDisplayed(); + SettingsInventory.goToSettingsInventoryNoInteractors(); + SettingsInventory.selectz3950ProfilesNoInteractors(); + Z3950TargetProfiles.verifyTargetProfilesListDisplayedNoIntearctors(); }, ); }); diff --git a/cypress/e2e/fse/ui/data-import-ui.cy.js b/cypress/e2e/fse/ui/data-import-ui.cy.js index d25447d0aa..b4f5515406 100644 --- a/cypress/e2e/fse/ui/data-import-ui.cy.js +++ b/cypress/e2e/fse/ui/data-import-ui.cy.js @@ -14,7 +14,7 @@ describe('fse-data-import - UI', () => { { tags: ['sanity', 'fse', 'ui', 'data-import'] }, () => { cy.visit(TopMenu.dataImportPath); - DataImport.waitLoading(); + DataImport.waitLoadingNoInteractors(); }, ); }); diff --git a/cypress/support/fragments/data_import/dataImport.js b/cypress/support/fragments/data_import/dataImport.js index eecb883e99..d5cd01fe17 100644 --- a/cypress/support/fragments/data_import/dataImport.js +++ b/cypress/support/fragments/data_import/dataImport.js @@ -952,4 +952,9 @@ export default { verifyUploadSectionHasNoUplodedFiles() { cy.expect(sectionPaneJobsTitle.find(Button('or choose files')).exists()); }, + + waitLoadingNoInteractors() { + cy.expect(sectionPaneJobsTitle.exists()); + cy.expect(logsPaneHeader.exists()); + }, }; diff --git a/cypress/support/fragments/inventory/inventorySearchAndFilter.js b/cypress/support/fragments/inventory/inventorySearchAndFilter.js index a91bee9afd..0d8d8433fd 100644 --- a/cypress/support/fragments/inventory/inventorySearchAndFilter.js +++ b/cypress/support/fragments/inventory/inventorySearchAndFilter.js @@ -608,7 +608,7 @@ export default { }, resetAll() { - cy.do(resetAllBtn.click()); + cy.do(resetAllButton.click()); cy.wait(1000); }, diff --git a/cypress/support/fragments/settings/inventory/integrations/z39.50TargetProfiles.js b/cypress/support/fragments/settings/inventory/integrations/z39.50TargetProfiles.js index a397cdf8c9..8f3ca6ad6e 100644 --- a/cypress/support/fragments/settings/inventory/integrations/z39.50TargetProfiles.js +++ b/cypress/support/fragments/settings/inventory/integrations/z39.50TargetProfiles.js @@ -338,4 +338,8 @@ export default { isDefaultSearchParamsRequired: false, }); }, + + verifyTargetProfilesListDisplayedNoIntearctors() { + cy.xpath("//span[contains(text(), 'Z39.50')]").should('be.visible'); + }, }; diff --git a/cypress/support/fragments/settings/inventory/settingsInventory.js b/cypress/support/fragments/settings/inventory/settingsInventory.js index 0735d0264c..acc2e76ac4 100644 --- a/cypress/support/fragments/settings/inventory/settingsInventory.js +++ b/cypress/support/fragments/settings/inventory/settingsInventory.js @@ -28,4 +28,13 @@ export default { cy.do(NavListItem('Inventory').click()); cy.expect(inventoryPane.exists()); }, + + goToSettingsInventoryNoInteractors() { + cy.xpath("//a[contains(@href, '/settings/inventory')]").click(); + cy.xpath("//div[@id='paneHeaderapp-settings-nav-pane']").should('be.visible'); + }, + + selectz3950ProfilesNoInteractors() { + cy.xpath("//a[contains(@href, '/settings/inventory/targetProfiles')]").click(); + }, }; From 140fff6e2649ecd210e1e6deb48f86d83c2cf6d2 Mon Sep 17 00:00:00 2001 From: Yauhen Viazau Date: Wed, 18 Dec 2024 16:45:36 +0500 Subject: [PATCH 2/3] FAT-17697, FAT-17698: tests added (#4565) --- ...stance-date-fields-length-validation.cy.js | 100 ++++++++++++++++++ .../instance/edit-instance-no-date2.cy.js | 60 +++++++++++ .../fragments/inventory/instanceRecordEdit.js | 7 ++ 3 files changed, 167 insertions(+) create mode 100644 cypress/e2e/inventory/instance/edit-instance-date-fields-length-validation.cy.js create mode 100644 cypress/e2e/inventory/instance/edit-instance-no-date2.cy.js diff --git a/cypress/e2e/inventory/instance/edit-instance-date-fields-length-validation.cy.js b/cypress/e2e/inventory/instance/edit-instance-date-fields-length-validation.cy.js new file mode 100644 index 0000000000..950de7e35b --- /dev/null +++ b/cypress/e2e/inventory/instance/edit-instance-date-fields-length-validation.cy.js @@ -0,0 +1,100 @@ +import getRandomPostfix from '../../../support/utils/stringTools'; +import InstanceRecordEdit from '../../../support/fragments/inventory/instanceRecordEdit'; +import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance'; +import InventoryInstances from '../../../support/fragments/inventory/inventoryInstances'; +import TopMenu from '../../../support/fragments/topMenu'; +import { INSTANCE_DATE_TYPES } from '../../../support/constants'; +import InstanceRecordView from '../../../support/fragments/inventory/instanceRecordView'; +import Users from '../../../support/fragments/users/users'; +import Permissions from '../../../support/dictionary/permissions'; + +describe('Inventory', () => { + describe('Instance', () => { + const testData = { + instanceTitle: `C552531 Auto ${getRandomPostfix()}`, + date1set: ['1999u', '1', '12', '12b', '12b6', '12b6', '12b6'], + date2set: ['20b27', '9', '199u', '199u', '19', '199', '199u'], + dateType: INSTANCE_DATE_TYPES.RANGE, + }; + + before('Login', () => { + cy.createTempUser([Permissions.uiInventoryViewCreateEditInstances.gui]).then( + (userProperties) => { + testData.user = userProperties; + InventoryInstance.createInstanceViaApi({ instanceTitle: testData.instanceTitle }).then( + ({ instanceData }) => { + testData.instanceId = instanceData.instanceId; + cy.login(testData.user.username, testData.user.password, { + path: TopMenu.inventoryPath, + waiter: InventoryInstances.waitContentLoading, + }); + InventoryInstances.searchByTitle(testData.instanceId); + InventoryInstances.selectInstanceById(testData.instanceId); + }, + ); + }, + ); + }); + + after('Delete test data', () => { + cy.getAdminToken(); + InventoryInstance.deleteInstanceViaApi(testData.instanceId); + Users.deleteViaApi(testData.user.userId); + }); + + it( + 'C552531 Cannot update Instance with more or less than 4 characters in "Date 1" and "Date 2" fields (spitfire)', + { tags: ['criticalPath', 'spitfire', 'C552531'] }, + () => { + InstanceRecordView.verifyInstancePaneExists(); + InstanceRecordView.edit(); + InstanceRecordEdit.waitLoading(); + InstanceRecordEdit.verifyDateFieldsValues(); + InstanceRecordEdit.fillDates( + testData.date1set[0], + testData.date2set[0], + testData.dateType, + true, + ); + InstanceRecordEdit.clickSaveAndKeepEditingButton(); + InstanceRecordEdit.verifySuccessfulMessage(); + InstanceRecordEdit.waitLoading(); + InstanceRecordEdit.verifyDateFieldsValues( + testData.date1set[0].slice(0, 4), + testData.date2set[0].slice(0, 4), + testData.dateType, + ); + + InstanceRecordEdit.fillDates(testData.date1set[1], testData.date2set[1]); + InstanceRecordEdit.clickSaveAndCloseButton(); + InstanceRecordEdit.verifyDateFieldsValidationErrors(true, true); + + InstanceRecordEdit.fillDates(testData.date1set[2], testData.date2set[2]); + InstanceRecordEdit.clickSaveAndCloseButton(); + InstanceRecordEdit.verifyDateFieldsValidationErrors(true, false); + + InstanceRecordEdit.fillDates(testData.date1set[3], testData.date2set[3]); + InstanceRecordEdit.clickSaveAndCloseButton(); + InstanceRecordEdit.verifyDateFieldsValidationErrors(true, false); + + InstanceRecordEdit.fillDates(testData.date1set[4], testData.date2set[4]); + InstanceRecordEdit.clickSaveAndCloseButton(); + InstanceRecordEdit.verifyDateFieldsValidationErrors(false, true); + + InstanceRecordEdit.fillDates(testData.date1set[5], testData.date2set[5]); + InstanceRecordEdit.clickSaveAndCloseButton(); + InstanceRecordEdit.verifyDateFieldsValidationErrors(false, true); + + InstanceRecordEdit.fillDates(testData.date1set[6], testData.date2set[6]); + InstanceRecordEdit.saveAndClose(); + InstanceRecordEdit.verifySuccessfulMessage(); + InstanceRecordView.verifyInstanceIsOpened(testData.instanceTitle); + InstanceRecordView.verifyDates( + testData.date1set[6], + testData.date2set[6], + testData.dateType, + ); + }, + ); + }); +}); diff --git a/cypress/e2e/inventory/instance/edit-instance-no-date2.cy.js b/cypress/e2e/inventory/instance/edit-instance-no-date2.cy.js new file mode 100644 index 0000000000..f269902eaf --- /dev/null +++ b/cypress/e2e/inventory/instance/edit-instance-no-date2.cy.js @@ -0,0 +1,60 @@ +import getRandomPostfix from '../../../support/utils/stringTools'; +import InstanceRecordEdit from '../../../support/fragments/inventory/instanceRecordEdit'; +import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance'; +import InventoryInstances from '../../../support/fragments/inventory/inventoryInstances'; +import TopMenu from '../../../support/fragments/topMenu'; +import { INSTANCE_DATE_TYPES } from '../../../support/constants'; +import InstanceRecordView from '../../../support/fragments/inventory/instanceRecordView'; +import Users from '../../../support/fragments/users/users'; +import Permissions from '../../../support/dictionary/permissions'; + +describe('Inventory', () => { + describe('Instance', () => { + const testData = { + instanceTitle: `C552528 Auto ${getRandomPostfix()}`, + date1: '0981', + dateType: INSTANCE_DATE_TYPES.QUESTIONABLE, + }; + + before('Login', () => { + cy.createTempUser([Permissions.uiInventoryViewCreateEditInstances.gui]).then( + (userProperties) => { + testData.user = userProperties; + InventoryInstance.createInstanceViaApi({ instanceTitle: testData.instanceTitle }).then( + ({ instanceData }) => { + testData.instanceId = instanceData.instanceId; + cy.login(testData.user.username, testData.user.password, { + path: TopMenu.inventoryPath, + waiter: InventoryInstances.waitContentLoading, + }); + InventoryInstances.searchByTitle(testData.instanceId); + InventoryInstances.selectInstanceById(testData.instanceId); + }, + ); + }, + ); + }); + + after('Delete test data', () => { + cy.getAdminToken(); + InventoryInstance.deleteInstanceViaApi(testData.instanceId); + Users.deleteViaApi(testData.user.userId); + }); + + it( + 'C552528 Edit Instance with selected "Date type" and field "Date 1" filled only (spitfire)', + { tags: ['criticalPath', 'spitfire', 'C552528'] }, + () => { + InstanceRecordView.verifyInstancePaneExists(); + InstanceRecordView.edit(); + InstanceRecordEdit.waitLoading(); + InstanceRecordEdit.verifyDateFieldsValues(); + InstanceRecordEdit.fillDates(testData.date1, undefined, testData.dateType); + InstanceRecordEdit.saveAndClose(); + InstanceRecordEdit.verifySuccessfulMessage(); + InstanceRecordView.verifyInstanceIsOpened(testData.instanceTitle); + InstanceRecordView.verifyDates(testData.date1, undefined, testData.dateType); + }, + ); + }); +}); diff --git a/cypress/support/fragments/inventory/instanceRecordEdit.js b/cypress/support/fragments/inventory/instanceRecordEdit.js index 11dcbb648f..bb6767bcf4 100644 --- a/cypress/support/fragments/inventory/instanceRecordEdit.js +++ b/cypress/support/fragments/inventory/instanceRecordEdit.js @@ -51,6 +51,7 @@ const date1Field = descriptiveDataAccordion.find(TextField({ name: 'dates.date1' const date2Field = descriptiveDataAccordion.find(TextField({ name: 'dates.date2' })); const dateTypePlaceholderOption = 'Select date type'; const dateValueLengthErrorText = 'Date must contain four characters.'; +const saveAndKeepEditing = Button('Save & keep editing'); const checkboxes = { 'Suppress from discovery': supressFromDiscoveryCheckbox, @@ -295,6 +296,7 @@ export default { InteractorsTools.checkCalloutMessage( matching(new RegExp(InstanceStates.instanceSavedSuccessfully)), ); + InteractorsTools.dismissCallout(matching(new RegExp(InstanceStates.instanceSavedSuccessfully))); }, checkCheckboxConditions(fields = []) { fields.forEach(({ label, conditions }) => { @@ -476,4 +478,9 @@ export default { ); } else cy.expect(date2Field.has({ errorBorder: false, error: undefined })); }, + + clickSaveAndKeepEditingButton(saved = true) { + cy.do(saveAndKeepEditing.click()); + if (saved) cy.expect(saveAndKeepEditing.has({ disabled: true })); + }, }; From 39a0c036b79c26b0ca6ec73ca8e2f052d91549f8 Mon Sep 17 00:00:00 2001 From: Sviatlana Stsiapanava <152482600+sviatlana-stsiapanava@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:00:04 +0500 Subject: [PATCH 3/3] Add the test case C494359 (#4568) --- ...eplace-with-action-in-central-tenant.cy.js | 486 ++++++++++++++++++ ...-holdings-verify-add-note-in-central.cy.js | 4 - .../fragments/bulk-edit/bulk-edit-actions.js | 8 + .../urlRelationshipConsortiumManager.js | 37 ++ .../instance-holdings-item/urlRelationship.js | 22 + 5 files changed, 553 insertions(+), 4 deletions(-) create mode 100644 cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-electronic-access-replace-with-action-in-central-tenant.cy.js create mode 100644 cypress/support/fragments/consortium-manager/inventory/instances-holdings-items/urlRelationshipConsortiumManager.js diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-electronic-access-replace-with-action-in-central-tenant.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-electronic-access-replace-with-action-in-central-tenant.cy.js new file mode 100644 index 0000000000..6cc8eadfb7 --- /dev/null +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-electronic-access-replace-with-action-in-central-tenant.cy.js @@ -0,0 +1,486 @@ +import permissions from '../../../../support/dictionary/permissions'; +import BulkEditActions from '../../../../support/fragments/bulk-edit/bulk-edit-actions'; +import BulkEditSearchPane from '../../../../support/fragments/bulk-edit/bulk-edit-search-pane'; +import BulkEditFiles from '../../../../support/fragments/bulk-edit/bulk-edit-files'; +import InventoryInstances from '../../../../support/fragments/inventory/inventoryInstances'; +import TopMenu from '../../../../support/fragments/topMenu'; +import Users from '../../../../support/fragments/users/users'; +import FileManager from '../../../../support/utils/fileManager'; +import getRandomPostfix from '../../../../support/utils/stringTools'; +import ExportFile from '../../../../support/fragments/data-export/exportFile'; +import InventorySearchAndFilter from '../../../../support/fragments/inventory/inventorySearchAndFilter'; +import InventoryHoldings from '../../../../support/fragments/inventory/holdings/inventoryHoldings'; +import InventoryInstance from '../../../../support/fragments/inventory/inventoryInstance'; +import HoldingsRecordView from '../../../../support/fragments/inventory/holdingsRecordView'; +import UrlRelationship from '../../../../support/fragments/settings/inventory/instance-holdings-item/urlRelationship'; +import UrlRelationshipConsortiumManager from '../../../../support/fragments/consortium-manager/inventory/instances-holdings-items/urlRelationshipConsortiumManager'; +import ConsortiumManager from '../../../../support/fragments/settings/consortium-manager/consortium-manager'; +import Affiliations, { tenantNames } from '../../../../support/dictionary/affiliations'; +import { APPLICATION_NAMES, BULK_EDIT_TABLE_COLUMN_HEADERS } from '../../../../support/constants'; +import TopMenuNavigation from '../../../../support/fragments/topMenuNavigation'; + +let user; +let instanceTypeId; +let locationId; +let sourceId; +let sharedUrlRelationshipData; +const collegeHoldingIds = []; +const collegeHoldingHrids = []; +const universityHoldingIds = []; +const universityHoldingHrids = []; +const folioInstance = { + title: `C494359 folio instance testBulkEdit_${getRandomPostfix()}`, +}; +const marcInstance = { + title: `C494359 marc instance testBulkEdit_${getRandomPostfix()}`, +}; +const sharedUrlRelationship = { + payload: { + name: `C494359 shared urlRelationship ${getRandomPostfix()}`, + }, +}; +const localUrlRelationship = { + name: `C494359 local urlRelationship ${getRandomPostfix()}`, +}; +const localUrlRelationshipNameWithAffiliation = `${localUrlRelationship.name} (${Affiliations.College})`; +const newUri = 'https://www.NewUri.org'; +const newLinkText = 'New Link text'; +const newMaterialSpecified = 'New Materials specified'; +const newUrlPublicNote = 'New URL public note'; +const instances = [folioInstance, marcInstance]; +const electronicAccessTableHeaders = 'RelationshipURILink textMaterials specifiedPublic note'; +const electronicAccessTableHeadersInFile = + 'URL relationship;URI;Link text;Materials specified;URL public note\n'; +const holdingUUIDsFileName = `holdingUUIdsFileName_${getRandomPostfix()}.csv`; +const matchedRecordsFileName = `*-Matched-Records-${holdingUUIDsFileName}`; +const previewFileName = `*-Updates-Preview-${holdingUUIDsFileName}`; +const changedRecordsFileName = `*-Changed-Records-${holdingUUIDsFileName}`; +const errorsFromCommittingFileName = `*-Committing-changes-Errors-${holdingUUIDsFileName}`; +const getReasonForError = (holdingId) => { + return `${holdingId} cannot be updated because the record is associated with ${Affiliations.University} and URL relationship is not associated with this tenant.`; +}; +const getRowsInCsvFileMatchingHrids = (csvFileData, hrids) => { + return csvFileData.filter((row) => { + return hrids.some((hrid) => { + return row[BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.HOLDINGS_HRID].includes(hrid); + }); + }); +}; + +describe('Bulk-edit', () => { + describe('In-app approach', () => { + describe('Consortia', () => { + before('create test data', () => { + cy.clearLocalStorage(); + cy.getAdminToken(); + cy.createTempUser([ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditHoldings.gui, + ]).then((userProperties) => { + user = userProperties; + + cy.assignAffiliationToUser(Affiliations.College, user.userId); + cy.setTenant(Affiliations.College); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditHoldings.gui, + ]); + + cy.resetTenant(); + cy.assignAffiliationToUser(Affiliations.University, user.userId); + cy.setTenant(Affiliations.University); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditHoldings.gui, + ]); + + cy.resetTenant(); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { + instanceTypeId = instanceTypeData[0].id; + }); + cy.getLocations({ query: 'name="DCB"' }).then((res) => { + locationId = res.id; + }); + InventoryHoldings.getHoldingsFolioSource().then((folioSource) => { + sourceId = folioSource.id; + }); + UrlRelationshipConsortiumManager.createViaApi(sharedUrlRelationship) + .then((newUrlRelationship) => { + sharedUrlRelationshipData = newUrlRelationship; + }) + .then(() => { + // create shared folio instance + InventoryInstances.createFolioInstanceViaApi({ + instance: { + instanceTypeId, + title: folioInstance.title, + }, + }).then((createdInstanceData) => { + folioInstance.id = createdInstanceData.instanceId; + }); + }) + .then(() => { + // create shared marc instance + cy.createSimpleMarcBibViaAPI(marcInstance.title).then((instanceId) => { + marcInstance.id = instanceId; + }); + }) + .then(() => { + cy.setTenant(Affiliations.College); + // create local url relationship in College + UrlRelationship.createViaApi({ + name: localUrlRelationship.name, + source: 'local', + }).then((response) => { + localUrlRelationship.id = response.id; + }); + // create holdings in College tenant + instances.forEach((instance) => { + InventoryHoldings.createHoldingRecordViaApi({ + instanceId: instance.id, + permanentLocationId: locationId, + electronicAccess: [ + { + linkText: 'College link text', + materialsSpecification: 'College materials specified', + publicNote: 'College url public note', + uri: 'https://college-uri.com', + relationshipId: sharedUrlRelationship.settingId, + }, + ], + sourceId, + }).then((holding) => { + collegeHoldingIds.push(holding.id); + collegeHoldingHrids.push(holding.hrid); + }); + cy.wait(1000); + }); + }) + .then(() => { + // create holdings in University tenant + cy.setTenant(Affiliations.University); + + instances.forEach((instance) => { + InventoryHoldings.createHoldingRecordViaApi({ + instanceId: instance.id, + permanentLocationId: locationId, + electronicAccess: [ + { + linkText: 'University link text', + materialsSpecification: 'University materials specified', + publicNote: 'University url public note', + uri: 'https://university-uri.com', + relationshipId: sharedUrlRelationship.settingId, + }, + ], + sourceId, + }).then((holding) => { + universityHoldingIds.push(holding.id); + universityHoldingHrids.push(holding.hrid); + }); + cy.wait(1000); + }); + }) + .then(() => { + FileManager.createFile( + `cypress/fixtures/${holdingUUIDsFileName}`, + `${collegeHoldingIds.join('\n')}\n${universityHoldingIds.join('\n')}`, + ); + }); + + cy.login(user.username, user.password, { + path: TopMenu.bulkEditPath, + waiter: BulkEditSearchPane.waitLoading, + }); + ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.central); + }); + }); + + after('delete test data', () => { + cy.resetTenant(); + cy.getAdminToken(); + cy.setTenant(Affiliations.College); + UrlRelationship.deleteViaApi(localUrlRelationship.id); + + collegeHoldingIds.forEach((collegeHoldingId) => { + cy.deleteHoldingRecordViaApi(collegeHoldingId); + }); + + cy.setTenant(Affiliations.University); + + universityHoldingIds.forEach((universityHoldingId) => { + cy.deleteHoldingRecordViaApi(universityHoldingId); + }); + + cy.resetTenant(); + cy.getAdminToken(); + + instances.forEach((instance) => { + InventoryInstance.deleteInstanceViaApi(instance.id); + }); + + UrlRelationshipConsortiumManager.deleteViaApi(sharedUrlRelationshipData); + Users.deleteViaApi(user.userId); + FileManager.deleteFile(`cypress/fixtures/${holdingUUIDsFileName}`); + FileManager.deleteFileFromDownloadsByMask( + matchedRecordsFileName, + previewFileName, + changedRecordsFileName, + errorsFromCommittingFileName, + ); + }); + + it( + 'C494359 Verify "Replace with" action for Holdings electronic access in Central tenant (consortia) (firebird)', + { tags: ['smokeECS', 'firebird', 'C494359'] }, + () => { + BulkEditSearchPane.verifyDragNDropRecordTypeIdentifierArea('Holdings', 'Holdings UUIDs'); + BulkEditSearchPane.uploadFile(holdingUUIDsFileName); + BulkEditSearchPane.verifyPaneTitleFileName(holdingUUIDsFileName); + BulkEditSearchPane.verifyPaneRecordsCount(4); + BulkEditSearchPane.verifyFileNameHeadLine(holdingUUIDsFileName); + + const holdingHrids = [...collegeHoldingHrids, ...universityHoldingHrids]; + + holdingHrids.forEach((holdingHrid) => { + BulkEditSearchPane.verifyExactChangesUnderColumnsByIdentifierInResultsAccordion( + holdingHrid, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.HOLDINGS_HRID, + holdingHrid, + ); + }); + + BulkEditSearchPane.verifyPreviousPaginationButtonDisabled(); + BulkEditSearchPane.verifyNextPaginationButtonDisabled(); + BulkEditActions.openActions(); + BulkEditSearchPane.changeShowColumnCheckbox( + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + ); + BulkEditSearchPane.verifyCheckboxesInActionsDropdownMenuChecked( + true, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + ); + + const collegeHoldingsElectronicAccess = `${electronicAccessTableHeaders}${sharedUrlRelationship.payload.name}https://college-uri.comCollege link textCollege materials specifiedCollege url public note`; + const universityHoldingsElectronicAccess = `${electronicAccessTableHeaders}${sharedUrlRelationship.payload.name}https://university-uri.comUniversity link textUniversity materials specifiedUniversity url public note`; + + collegeHoldingHrids.forEach((holdingHrid) => { + BulkEditSearchPane.verifyExactChangesUnderColumnsByIdentifierInResultsAccordion( + holdingHrid, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + collegeHoldingsElectronicAccess, + ); + }); + universityHoldingHrids.forEach((holdingHrid) => { + BulkEditSearchPane.verifyExactChangesUnderColumnsByIdentifierInResultsAccordion( + holdingHrid, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + universityHoldingsElectronicAccess, + ); + }); + + BulkEditSearchPane.changeShowColumnCheckbox( + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + ); + BulkEditSearchPane.verifyCheckboxesInActionsDropdownMenuChecked( + false, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + ); + BulkEditSearchPane.verifyResultColumnTitlesDoNotIncludeTitles( + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + ); + BulkEditActions.openActions(); + BulkEditActions.downloadMatchedResults(); + + const collegeHoldingsElectronicAccessInFile = `${electronicAccessTableHeadersInFile}${sharedUrlRelationship.payload.name};https://college-uri.com;College link text;College materials specified;College url public note`; + const universityHoldingsElectronicAccessInFile = `${electronicAccessTableHeadersInFile}${sharedUrlRelationship.payload.name};https://university-uri.com;University link text;University materials specified;University url public note`; + + FileManager.convertCsvToJson(matchedRecordsFileName).then((csvFileData) => { + const collegeHoldingRows = getRowsInCsvFileMatchingHrids( + csvFileData, + collegeHoldingHrids, + ); + const universityHoldingRows = getRowsInCsvFileMatchingHrids( + csvFileData, + universityHoldingHrids, + ); + + collegeHoldingRows.forEach((collegeRow) => { + cy.expect( + collegeRow[BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS], + ).to.equal(collegeHoldingsElectronicAccessInFile); + }); + universityHoldingRows.forEach((universityRow) => { + cy.expect( + universityRow[BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS], + ).to.equal(universityHoldingsElectronicAccessInFile); + }); + }); + + BulkEditActions.openInAppStartBulkEditFrom(); + BulkEditSearchPane.verifyBulkEditsAccordionExists(); + BulkEditActions.verifyOptionsDropdown(); + BulkEditActions.verifyRowIcons(); + BulkEditActions.verifyCancelButtonDisabled(false); + BulkEditSearchPane.isConfirmButtonDisabled(true); + BulkEditActions.selectOption('URL Relationship'); + BulkEditActions.selectSecondAction('Replace with'); + BulkEditActions.verifySecondActionSelected('Replace with'); + BulkEditActions.selectFromUnchangedSelect(localUrlRelationshipNameWithAffiliation); + BulkEditSearchPane.isConfirmButtonDisabled(false); + BulkEditActions.addNewBulkEditFilterString(); + BulkEditActions.verifyNewBulkEditRow(1); + BulkEditActions.replaceWithAction('URI', newUri, 1); + BulkEditSearchPane.isConfirmButtonDisabled(false); + BulkEditActions.addNewBulkEditFilterString(); + BulkEditActions.verifyNewBulkEditRow(2); + BulkEditActions.replaceWithAction('Link text', newLinkText, 2); + BulkEditSearchPane.isConfirmButtonDisabled(false); + BulkEditActions.addNewBulkEditFilterString(); + BulkEditActions.verifyNewBulkEditRow(3); + BulkEditActions.replaceWithAction('Materials specified', newMaterialSpecified, 3); + BulkEditSearchPane.isConfirmButtonDisabled(false); + BulkEditActions.addNewBulkEditFilterString(); + BulkEditActions.verifyNewBulkEditRow(4); + BulkEditActions.replaceWithAction('URL public note', newUrlPublicNote, 4); + BulkEditSearchPane.isConfirmButtonDisabled(false); + BulkEditActions.confirmChanges(); + BulkEditActions.verifyMessageBannerInAreYouSureForm(4); + + const updatedHoldingsElectronicAccess = `${electronicAccessTableHeaders}${localUrlRelationship.name}${newUri}${newLinkText}${newMaterialSpecified}${newUrlPublicNote}`; + const updatedHoldingsUniversityElectronicAccess = `${electronicAccessTableHeaders}${sharedUrlRelationship.payload.name}${newUri}${newLinkText}${newMaterialSpecified}${newUrlPublicNote}`; + const updatedHoldingsElectronicAccessInFile = `${electronicAccessTableHeadersInFile}${localUrlRelationship.name};${newUri};${newLinkText};${newMaterialSpecified};${newUrlPublicNote}`; + const updatedHoldingsUniversutyElectronicAccessInFile = `${electronicAccessTableHeadersInFile}${sharedUrlRelationship.payload.name};${newUri};${newLinkText};${newMaterialSpecified};${newUrlPublicNote}`; + + holdingHrids.forEach((holdingHrid) => { + BulkEditSearchPane.verifyExactChangesUnderColumnsByIdentifier( + holdingHrid, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + updatedHoldingsElectronicAccess, + ); + }); + + BulkEditActions.verifyAreYouSureForm(4); + BulkEditSearchPane.verifyPreviousPaginationButtonInAreYouSureFormDisabled(); + BulkEditSearchPane.verifyNextPaginationButtonInAreYouSureFormDisabled(); + BulkEditActions.downloadPreview(); + + FileManager.convertCsvToJson(previewFileName).then((csvFileData) => { + csvFileData.forEach((row) => { + cy.expect(row).to.have.property( + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + updatedHoldingsElectronicAccessInFile, + ); + }); + }); + + BulkEditActions.commitChanges(); + BulkEditActions.verifySuccessBanner(4); + + collegeHoldingHrids.forEach((holdingHrid) => { + BulkEditSearchPane.verifyExactChangesUnderColumnsByIdentifierInChangesAccordion( + holdingHrid, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + updatedHoldingsElectronicAccess, + ); + }); + universityHoldingHrids.forEach((holdingHrid) => { + BulkEditSearchPane.verifyExactChangesUnderColumnsByIdentifierInChangesAccordion( + holdingHrid, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + updatedHoldingsUniversityElectronicAccess, + ); + }); + + BulkEditSearchPane.verifyErrorLabelInErrorAccordion(holdingUUIDsFileName, 4, 4, 2); + BulkEditSearchPane.verifyNonMatchedResults(); + + universityHoldingIds.forEach((universityHoldingId) => { + BulkEditSearchPane.verifyErrorByIdentifier( + universityHoldingId, + getReasonForError(universityHoldingId), + ); + }); + + BulkEditActions.openActions(); + BulkEditActions.downloadChangedCSV(); + + FileManager.convertCsvToJson(changedRecordsFileName).then((csvFileData) => { + const collegeHoldingRows = getRowsInCsvFileMatchingHrids( + csvFileData, + collegeHoldingHrids, + ); + const universityHoldingRows = getRowsInCsvFileMatchingHrids( + csvFileData, + universityHoldingHrids, + ); + + collegeHoldingRows.forEach((collegeRow) => { + cy.expect( + collegeRow[BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS], + ).to.equal(updatedHoldingsElectronicAccessInFile); + }); + universityHoldingRows.forEach((universityRow) => { + cy.expect( + universityRow[BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS], + ).to.equal(updatedHoldingsUniversutyElectronicAccessInFile); + }); + }); + + BulkEditActions.downloadErrors(); + + universityHoldingIds.forEach((universityHoldingId) => { + ExportFile.verifyFileIncludes(errorsFromCommittingFileName, [ + `${universityHoldingId},${getReasonForError(universityHoldingId)}`, + ]); + }); + + BulkEditFiles.verifyCSVFileRecordsNumber(errorsFromCommittingFileName, 2); + ConsortiumManager.switchActiveAffiliation(tenantNames.central, tenantNames.college); + + collegeHoldingHrids.forEach((collegeHoldingHrid) => { + TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY); + InventorySearchAndFilter.switchToHoldings(); + InventorySearchAndFilter.searchHoldingsByHRID(collegeHoldingHrid); + InventorySearchAndFilter.selectViewHoldings(); + HoldingsRecordView.waitLoading(); + + const electronicAccessFieldsToValidateInCollege = [ + localUrlRelationship.name, + newUri, + newLinkText, + newMaterialSpecified, + newUrlPublicNote, + ]; + + electronicAccessFieldsToValidateInCollege.forEach((field, ind) => { + HoldingsRecordView.verifyElectronicAccessByElementIndex(ind, field); + }); + }); + + ConsortiumManager.switchActiveAffiliation(tenantNames.college, tenantNames.university); + + universityHoldingHrids.forEach((universityHoldingHrid) => { + TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY); + InventorySearchAndFilter.switchToHoldings(); + InventorySearchAndFilter.searchHoldingsByHRID(universityHoldingHrid); + InventorySearchAndFilter.selectViewHoldings(); + HoldingsRecordView.waitLoading(); + + const electronicAccessFieldsToValidateInUniversity = [ + sharedUrlRelationship.payload.name, + newUri, + newLinkText, + newMaterialSpecified, + newUrlPublicNote, + ]; + + electronicAccessFieldsToValidateInUniversity.forEach((field, ind) => { + HoldingsRecordView.verifyElectronicAccessByElementIndex(ind, field); + }); + }); + }, + ); + }); + }); +}); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-add-note-in-central.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-add-note-in-central.cy.js index b420cfadf0..fe124b055e 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-add-note-in-central.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-add-note-in-central.cy.js @@ -32,8 +32,6 @@ let centralSharedNoteTypeData; const callNumberStarts = `${randomFourDigitNumber()}`; const folioInstance = { title: `C477646 folio instance testBulkEdit_${getRandomPostfix()}`, - barcodeInCollege: `Item_College${getRandomPostfix()}`, - barcodeInUniversity: `Item_University${getRandomPostfix()}`, holdingCallNumberInCollege: `${callNumberStarts}${randomFourDigitNumber()}`, holdingCallNumberInUniversity: `${callNumberStarts}${randomFourDigitNumber()}`, holdingIds: [], @@ -41,8 +39,6 @@ const folioInstance = { }; const marcInstance = { title: `C477646 marc instance testBulkEdit_${getRandomPostfix()}`, - barcodeInCollege: `Item_College${getRandomPostfix()}`, - barcodeInUniversity: `Item_University${getRandomPostfix()}`, holdingCallNumberInCollege: `${callNumberStarts}${randomFourDigitNumber()}`, holdingCallNumberInUniversity: `${callNumberStarts}${randomFourDigitNumber()}`, holdingIds: [], diff --git a/cypress/support/fragments/bulk-edit/bulk-edit-actions.js b/cypress/support/fragments/bulk-edit/bulk-edit-actions.js index 0e91bbe1ac..f7d53fdaa9 100644 --- a/cypress/support/fragments/bulk-edit/bulk-edit-actions.js +++ b/cypress/support/fragments/bulk-edit/bulk-edit-actions.js @@ -787,6 +787,14 @@ export default { ]); }, + replaceWithAction(option, newValue, rowIndex = 0) { + this.selectOption(option, rowIndex); + this.selectSecondAction('Replace with', rowIndex); + this.verifySecondActionSelected('Replace with', rowIndex); + this.fillInSecondTextArea(newValue, rowIndex); + this.verifyValueInSecondTextArea(newValue, rowIndex); + }, + noteReplaceWith(noteType, oldNote, newNote, rowIndex = 0) { this.findValue(noteType, rowIndex); this.fillInFirstTextArea(oldNote, rowIndex); diff --git a/cypress/support/fragments/consortium-manager/inventory/instances-holdings-items/urlRelationshipConsortiumManager.js b/cypress/support/fragments/consortium-manager/inventory/instances-holdings-items/urlRelationshipConsortiumManager.js new file mode 100644 index 0000000000..7375c5c5da --- /dev/null +++ b/cypress/support/fragments/consortium-manager/inventory/instances-holdings-items/urlRelationshipConsortiumManager.js @@ -0,0 +1,37 @@ +import uuid from 'uuid'; +import { REQUEST_METHOD } from '../../../../constants'; + +const id = uuid(); + +export default { + createViaApi(type) { + return cy.getConsortiaId().then((consortiaId) => { + cy.okapiRequest({ + method: REQUEST_METHOD.POST, + path: `consortia/${consortiaId}/sharing/settings`, + body: { + url: '/electronic-access-relationships', + settingId: id, + payload: { + id, + name: type.payload.name, + }, + }, + }).then(() => { + type.url = '/electronic-access-relationships'; + type.settingId = id; + return type; + }); + }); + }, + + deleteViaApi(type) { + cy.getConsortiaId().then((consortiaId) => { + cy.okapiRequest({ + method: REQUEST_METHOD.DELETE, + path: `consortia/${consortiaId}/sharing/settings/${type.settingId}`, + body: type, + }); + }); + }, +}; diff --git a/cypress/support/fragments/settings/inventory/instance-holdings-item/urlRelationship.js b/cypress/support/fragments/settings/inventory/instance-holdings-item/urlRelationship.js index 43904fdc20..10a0b3e1c4 100644 --- a/cypress/support/fragments/settings/inventory/instance-holdings-item/urlRelationship.js +++ b/cypress/support/fragments/settings/inventory/instance-holdings-item/urlRelationship.js @@ -38,6 +38,28 @@ function getListOfURLRelationship() { export default { getListOfURLRelationship, + createViaApi(type) { + return cy + .okapiRequest({ + method: 'POST', + path: 'electronic-access-relationships', + body: type, + isDefaultSearchParamsRequired: false, + }) + .then((response) => { + return response.body; + }); + }, + + deleteViaApi(id) { + return cy.okapiRequest({ + method: 'DELETE', + path: `electronic-access-relationships/${id}`, + isDefaultSearchParamsRequired: false, + failOnStatusCode: false, + }); + }, + openTabFromInventorySettingsList() { cy.do(NavListItem('Inventory').click()); cy.do(NavListItem('URL relationship').click());