diff --git a/cypress/e2e/consortia/data-import/importing-marcBib-files/adding-deleting-fields-and-subfields-when-updating-shared-marcBib-in-central-via-DI-and-confirm-in-member.cy.js b/cypress/e2e/consortia/data-import/importing-marcBib-files/adding-deleting-fields-and-subfields-when-updating-shared-marcBib-in-central-via-DI-and-confirm-in-member.cy.js index 6fbe4b44d6..c609fe16b6 100644 --- a/cypress/e2e/consortia/data-import/importing-marcBib-files/adding-deleting-fields-and-subfields-when-updating-shared-marcBib-in-central-via-DI-and-confirm-in-member.cy.js +++ b/cypress/e2e/consortia/data-import/importing-marcBib-files/adding-deleting-fields-and-subfields-when-updating-shared-marcBib-in-central-via-DI-and-confirm-in-member.cy.js @@ -183,6 +183,7 @@ describe('Data Import', () => { // download exported marc file TopMenuNavigation.navigateToApp(APPLICATION_NAMES.DATA_EXPORT); + ExportFile.waitLandingPageOpened(); ExportFile.downloadExportedMarcFileWithRecordHrid( expectedRecordHrid, testData.marcFile.exportedFileName, diff --git a/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shared-instance-central.cy.js b/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shared-instance-central.cy.js index 19aca2bed3..c31f08f4af 100644 --- a/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shared-instance-central.cy.js +++ b/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shared-instance-central.cy.js @@ -20,23 +20,20 @@ describe('Inventory', () => { }; before('Create test data', () => { + cy.clearCookies({ domain: null }); cy.getAdminToken(); - cy.getConsortiaId().then((consortiaId) => { - testData.consortiaId = consortiaId; - }); - cy.wrap() - .then(() => { + cy.getConsortiaId() + .then((consortiaId) => { + testData.consortiaId = consortiaId; + cy.getInstanceTypes({ limit: 1 }).then((instanceTypes) => { testData.instanceTypeId = instanceTypes[0].id; }); cy.getHoldingTypes({ limit: 1 }).then((res) => { testData.holdingTypeId = res[0].id; }); - const collegeLocationData = Locations.getDefaultLocation({ - servicePointId: ServicePoints.getDefaultServicePoint().id, - }).location; - Locations.createViaApi(collegeLocationData).then((location) => { - testData.collegeLocation = location; + cy.getLocations({ limit: 1 }).then((res) => { + testData.locationId = res.id; }); cy.getLoanTypes({ limit: 1 }).then((res) => { testData.loanTypeId = res[0].id; @@ -44,6 +41,9 @@ describe('Inventory', () => { cy.getMaterialTypes({ limit: 1 }).then((res) => { testData.materialTypeId = res.id; }); + InventoryHoldings.getHoldingsFolioSource().then((folioSource) => { + testData.sourceId = folioSource.id; + }); }) .then(() => { InventoryInstances.createFolioInstanceViaApi({ @@ -54,7 +54,7 @@ describe('Inventory', () => { holdings: [ { holdingsTypeId: testData.holdingTypeId, - permanentLocationId: testData.collegeLocation.id, + permanentLocationId: testData.locationId, }, ], items: [ @@ -65,86 +65,107 @@ describe('Inventory', () => { materialType: { id: testData.materialTypeId }, }, ], - }).then((specialInstanceIds) => { - testData.testInstanceIds = specialInstanceIds; + }) + .then((specialInstanceIds) => { + testData.testInstanceIds = specialInstanceIds; + }) + .then(() => { + InventoryInstance.shareInstanceViaApi( + testData.testInstanceIds.instanceId, + testData.consortiaId, + Affiliations.College, + Affiliations.Consortia, + ); + + InventoryInstance.shareInstanceViaApi( + testData.testInstanceIds.instanceId, + testData.consortiaId, + Affiliations.College, + Affiliations.Consortia, + ); + // adding Holdings in College for shared Instance + cy.setTenant(Affiliations.College); + const collegeLocationData = Locations.getDefaultLocation({ + servicePointId: ServicePoints.getDefaultServicePoint().id, + }).location; + Locations.createViaApi(collegeLocationData).then((location) => { + testData.collegeLocation = location; - InventoryInstance.shareInstanceViaApi( - specialInstanceIds.instanceId, - testData.consortiaId, - Affiliations.College, - Affiliations.Consortia, - ) - .then(() => { - // adding Holdings in College for shared Instance - cy.setTenant(Affiliations.College); - cy.getCollegeAdminToken(); - const collegeLocationData = Locations.getDefaultLocation({ - servicePointId: ServicePoints.getDefaultServicePoint().id, - }).location; - Locations.createViaApi(collegeLocationData).then((location) => { - testData.collegeLocation = location; - InventoryHoldings.createHoldingRecordViaApi({ - instanceId: specialInstanceIds.id, - permanentLocationId: testData.collegeLocation.id, - }).then((holding) => { - testData.collegeHoldings.push(holding); + InventoryHoldings.getHoldingSources({ limit: 1, query: '(name=="FOLIO")' }).then( + (holdingSources) => { + InventoryHoldings.createHoldingRecordViaApi({ + instanceId: testData.testInstanceIds.instanceId, + permanentLocationId: testData.collegeLocation.id, + sourceId: holdingSources[0].id, + }) + .then((holding) => { + testData.collegeHolding = holding; - cy.getMaterialTypes({ limit: 1 }).then((res) => { - testData.collegeMaterialTypeId = res.id; - }); - cy.getLoanTypes({ limit: 1 }).then((res) => { - testData.collegeLoanTypeId = res[0].id; - }); + cy.getMaterialTypes({ limit: 1 }).then((res) => { + testData.collegeMaterialTypeId = res.id; + }); + cy.getLoanTypes({ limit: 1 }).then((res) => { + testData.collegeLoanTypeId = res[0].id; + }); + }) + .then(() => { + InventoryItems.createItemViaApi({ + holdingsRecordId: testData.collegeHolding.id, + materialType: { id: testData.collegeMaterialTypeId }, + permanentLoanType: { id: testData.collegeLoanTypeId }, + status: { name: ITEM_STATUS_NAMES.AVAILABLE }, + }).then((item) => { + testData.collegeItem = item; + }); + }); + }, + ); + }); - InventoryItems.createItemViaApi({ - holdingsRecordId: holding.id, - materialType: { id: testData.collegeMaterialTypeId }, - permanentLoanType: { id: testData.collegeLoanTypeId }, - status: { name: ITEM_STATUS_NAMES.AVAILABLE }, - }).then((item) => { - testData.collegeItems.push(item); - }); - }); - }); - }) - .then(() => { - // adding Holdings in University for shared Instance - cy.setTenant(Affiliations.University); - cy.getUniversityAdminToken(); - const universityLocationData = Locations.getDefaultLocation({ - servicePointId: ServicePoints.getDefaultServicePoint().id, - }).location; - Locations.createViaApi(universityLocationData).then((location) => { - testData.universityLocation = location; - InventoryHoldings.createHoldingRecordViaApi({ - instanceId: specialInstanceIds.id, - permanentLocationId: testData.universityLocation.id, - }).then((holding) => { - testData.universityHoldings.push(holding); + // adding Holdings in University for shared Instance + cy.resetTenant(); + cy.getAdminToken(); + cy.setTenant(Affiliations.University); + const universityLocationData = Locations.getDefaultLocation({ + servicePointId: ServicePoints.getDefaultServicePoint().id, + }).location; + Locations.createViaApi(universityLocationData).then((location) => { + testData.universityLocation = location; - cy.getMaterialTypes({ limit: 1 }).then((res) => { - testData.universityMaterialTypeId = res.id; - }); - cy.getLoanTypes({ limit: 1 }).then((res) => { - testData.universityLoanTypeId = res[0].id; - }); + InventoryHoldings.getHoldingSources({ limit: 1, query: '(name=="FOLIO")' }).then( + (holdingSources) => { + InventoryHoldings.createHoldingRecordViaApi({ + instanceId: testData.testInstanceIds.instanceId, + permanentLocationId: testData.universityLocation.id, + sourceId: holdingSources[0].id, + }) + .then((holding) => { + testData.universityHolding = holding; - InventoryItems.createItemViaApi({ - holdingsRecordId: holding.id, - materialType: { id: testData.universityMaterialTypeId }, - permanentLoanType: { id: testData.universityLoanTypeId }, - status: { name: ITEM_STATUS_NAMES.AVAILABLE }, - }).then((item) => { - testData.universityItems.push(item); - }); - }); - }); + cy.getMaterialTypes({ limit: 1 }).then((res) => { + testData.universityMaterialTypeId = res.id; + }); + cy.getLoanTypes({ limit: 1 }).then((res) => { + testData.universityLoanTypeId = res[0].id; + }); + }) + .then(() => { + InventoryItems.createItemViaApi({ + holdingsRecordId: testData.universityHolding.id, + materialType: { id: testData.universityMaterialTypeId }, + permanentLoanType: { id: testData.universityLoanTypeId }, + status: { name: ITEM_STATUS_NAMES.AVAILABLE }, + }).then((item) => { + testData.universityItem = item; + }); + }); + }, + ); }); - }); + }); }); cy.resetTenant(); - cy.getAdminToken(); cy.createTempUser([Permissions.inventoryAll.gui]).then((userProperties) => { testData.user = userProperties; @@ -158,30 +179,22 @@ describe('Inventory', () => { after('Delete test data', () => { cy.resetTenant(); cy.getAdminToken(); - Users.deleteViaApi(testData.user.userId); - cy.setTenant(Affiliations.College); - InventoryInstances.deleteInstanceAndHoldingRecordAndAllItemsViaApi(testData.itemBarcode); - Locations.deleteViaApi(testData.collegeLocation); - cy.setTenant(Affiliations.College); - cy.getCollegeAdminToken(); - testData.collegeItems.forEach((item) => { - InventoryItems.deleteItemViaApi(item.id); - }); - testData.collegeHoldings.forEach((holding) => { - InventoryHoldings.deleteHoldingRecordViaApi(holding.id); - }); + InventoryItems.deleteItemViaApi(testData.collegeItem.id); + InventoryHoldings.deleteHoldingRecordViaApi(testData.collegeHolding.id); Locations.deleteViaApi(testData.collegeLocation); + cy.resetTenant(); + cy.getAdminToken(); cy.setTenant(Affiliations.University); - cy.getUniversityAdminToken(); - testData.universityItems.forEach((item) => { - InventoryItems.deleteItemViaApi(item.id); - }); - testData.universityHoldings.forEach((holding) => { - InventoryHoldings.deleteHoldingRecordViaApi(holding.id); - }); + InventoryItems.deleteItemViaApi(testData.universityItem.id); + InventoryHoldings.deleteHoldingRecordViaApi(testData.universityHolding.id); Locations.deleteViaApi(testData.universityLocation); + + cy.resetTenant(); + cy.getAdminToken(); + Users.deleteViaApi(testData.user.userId); + InventoryInstances.deleteInstanceAndHoldingRecordAndAllItemsViaApi(testData.itemBarcode); }); it( @@ -199,12 +212,12 @@ describe('Inventory', () => { InventoryInstance.expandMemberSubHoldings(Affiliations.College); InventoryInstance.verifyMemberSubSubHoldingsAccordion( Affiliations.College, - testData.collegeHoldings[0].id, + testData.collegeHoldingsId, ); InventoryInstance.expandMemberSubHoldings(Affiliations.University); InventoryInstance.verifyMemberSubSubHoldingsAccordion( Affiliations.University, - testData.universityHoldings[0].id, + testData.universityHoldingsId, ); }, ); diff --git a/cypress/e2e/consortia/inventory/instance/limited-edit-permissions-for-shared-marc-folio-instance-on-member.cy.js b/cypress/e2e/consortia/inventory/instance/limited-edit-permissions-for-shared-marc-folio-instance-on-member.cy.js index 8dceefa57e..f0775936bd 100644 --- a/cypress/e2e/consortia/inventory/instance/limited-edit-permissions-for-shared-marc-folio-instance-on-member.cy.js +++ b/cypress/e2e/consortia/inventory/instance/limited-edit-permissions-for-shared-marc-folio-instance-on-member.cy.js @@ -72,14 +72,12 @@ describe('Inventory', () => { 'C402335 (CONSORTIA) Verify limited Edit permissions for Shared MARC instance on Member tenant (consortia) (folijet)', { tags: ['criticalPathECS', 'folijet', 'C402335'] }, () => { - cy.intercept('POST', '/authn/refresh').as('/authn/refresh'); InventorySearchAndFilter.verifySearchAndFilterPane(); InventorySearchAndFilter.bySource(C402335testData.instanceSource); cy.wait(1500); InventorySearchAndFilter.byShared('Yes'); cy.wait(1500); InventorySearchAndFilter.searchInstanceByTitle(C402335testData.instanceId); - cy.wait('@/authn/refresh', { timeout: 5000 }); InventorySearchAndFilter.verifyInstanceDetailsView(); InstanceRecordView.verifyInstanceSource(C402335testData.instanceSource); InstanceRecordView.verifyEditInstanceButtonAbsent(); diff --git a/cypress/e2e/consortia/inventory/instance/share-local-instance-button-for-folio-instance.cy.js b/cypress/e2e/consortia/inventory/instance/share-local-instance-button-for-folio-instance.cy.js deleted file mode 100644 index 7f5276c677..0000000000 --- a/cypress/e2e/consortia/inventory/instance/share-local-instance-button-for-folio-instance.cy.js +++ /dev/null @@ -1,156 +0,0 @@ -import Affiliations, { tenantNames } from '../../../../support/dictionary/affiliations'; -import Permissions from '../../../../support/dictionary/permissions'; -import InventoryInstance from '../../../../support/fragments/inventory/inventoryInstance'; -import InventoryInstances from '../../../../support/fragments/inventory/inventoryInstances'; -import ConsortiumManager from '../../../../support/fragments/settings/consortium-manager/consortium-manager'; -import TopMenu from '../../../../support/fragments/topMenu'; -import Users from '../../../../support/fragments/users/users'; - -describe('Inventory', () => { - describe('Instance', () => { - const testData = {}; - - before('Create test data', () => { - cy.getAdminToken(); - cy.getConsortiaId().then((consortiaId) => { - testData.consortiaId = consortiaId; - }); - cy.setTenant(Affiliations.College); - InventoryInstance.createInstanceViaApi().then(({ instanceData }) => { - testData.instance = instanceData; - InventoryInstance.shareInstanceViaApi( - testData.instance.instanceId, - testData.consortiaId, - Affiliations.College, - Affiliations.Consortia, - ); - }); - - cy.resetTenant(); - cy.getAdminToken(); - cy.createTempUser([ - Permissions.uiInventoryViewCreateInstances.gui, - Permissions.consortiaInventoryShareLocalInstance.gui, - ]).then((userProperties) => { - testData.user1 = userProperties; - }); - - cy.resetTenant(); - cy.getAdminToken(); - cy.createTempUser([Permissions.uiInventoryViewCreateInstances.gui]).then((userProperties) => { - testData.user2 = userProperties; - cy.assignAffiliationToUser(Affiliations.College, testData.user2.userId); - cy.setTenant(Affiliations.College); - cy.assignPermissionsToExistingUser(testData.user2.userId, [ - Permissions.uiInventoryViewCreateInstances.gui, - Permissions.consortiaInventoryShareLocalInstance.gui, - ]); - }); - - cy.resetTenant(); - cy.getAdminToken(); - cy.createTempUser([Permissions.uiInventoryViewCreateInstances.gui]).then((userProperties) => { - testData.user3 = userProperties; - }); - - cy.resetTenant(); - cy.getAdminToken(); - cy.createTempUser([Permissions.uiInventoryViewCreateInstances.gui]).then((userProperties) => { - testData.user4 = userProperties; - cy.assignAffiliationToUser(Affiliations.College, testData.user4.userId); - cy.setTenant(Affiliations.College); - cy.assignPermissionsToExistingUser(testData.user4.userId, [ - Permissions.uiInventoryViewCreateInstances.gui, - ]); - }); - }); - - after('Delete test data', () => { - cy.resetTenant(); - cy.getAdminToken(); - InventoryInstance.deleteInstanceViaApi(testData.instance.instanceId); - Users.deleteViaApi(testData.user1.userId); - Users.deleteViaApi(testData.user2.userId); - Users.deleteViaApi(testData.user3.userId); - Users.deleteViaApi(testData.user4.userId); - }); - - it( - 'C411343 (CONSORTIA) Check the "Share local instance" button on a Source = FOLIO Instance on Central tenant (consortia) (folijet)', - { tags: ['extendedPathECS', 'folijet', 'C411343'] }, - () => { - cy.login(testData.user1.username, testData.user1.password, { - path: TopMenu.inventoryPath, - waiter: InventoryInstances.waitContentLoading, - }); - - InventoryInstances.waitContentLoading(); - cy.intercept('POST', '/authn/refresh').as('/authn/refresh'); - InventoryInstances.searchByTitle(testData.instance.instanceTitle); - cy.wait('@/authn/refresh', { timeout: 5000 }); - InventoryInstances.selectInstance(); - - InventoryInstance.waitLoading(); - InventoryInstance.checkShareLocalInstanceButtonIsAbsent(); - }, - ); - - it( - 'C411329 (CONSORTIA) Check the "Share local instance" button on a shared Source = FOLIO Instance on Member tenant (consortia) (folijet)', - { tags: ['extendedPathECS', 'folijet', 'C411329'] }, - () => { - cy.login(testData.user2.username, testData.user2.password, { - path: TopMenu.inventoryPath, - waiter: InventoryInstances.waitContentLoading, - }); - - ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.central); - ConsortiumManager.switchActiveAffiliation(tenantNames.central, tenantNames.college); - ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.college); - InventoryInstances.waitContentLoading(); - InventoryInstances.searchByTitle(testData.instance.instanceTitle); - InventoryInstances.selectInstance(); - InventoryInstance.waitLoading(); - InventoryInstance.checkShareLocalInstanceButtonIsAbsent(); - }, - ); - - it( - 'C411345 (CONSORTIA) Check the "Share local instance" button without permission on a Source = FOLIO Instance on Central tenant (consortia) (folijet)', - { tags: ['extendedPathECS', 'folijet', 'C411345'] }, - () => { - cy.login(testData.user3.username, testData.user3.password, { - path: TopMenu.inventoryPath, - waiter: InventoryInstances.waitContentLoading, - }); - - ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.central); - InventoryInstances.waitContentLoading(); - InventoryInstances.searchByTitle(testData.instance.instanceTitle); - InventoryInstances.selectInstance(); - InventoryInstance.waitLoading(); - InventoryInstance.checkShareLocalInstanceButtonIsAbsent(); - }, - ); - - it( - 'C411334 (CONSORTIA) Check the "Share local instance" button without permission on a local Source = FOLIO Instance on Member tenant (consortia) (folijet)', - { tags: ['extendedPathECS', 'folijet', 'C411334'] }, - () => { - cy.login(testData.user4.username, testData.user4.password, { - path: TopMenu.inventoryPath, - waiter: InventoryInstances.waitContentLoading, - }); - - ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.central); - ConsortiumManager.switchActiveAffiliation(tenantNames.central, tenantNames.college); - ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.college); - InventoryInstances.waitContentLoading(); - InventoryInstances.searchByTitle(testData.instance.instanceTitle); - InventoryInstances.selectInstance(); - InventoryInstance.waitLoading(); - InventoryInstance.checkShareLocalInstanceButtonIsAbsent(); - }, - ); - }); -}); diff --git a/cypress/e2e/consortia/inventory/instance/user-can-see-name-of-locations-from-first-member-when-he-is-on-second-member.cy.js b/cypress/e2e/consortia/inventory/instance/user-can-see-name-of-locations-from-first-member-when-he-is-on-second-member.cy.js index c095fde5c6..90959f785d 100644 --- a/cypress/e2e/consortia/inventory/instance/user-can-see-name-of-locations-from-first-member-when-he-is-on-second-member.cy.js +++ b/cypress/e2e/consortia/inventory/instance/user-can-see-name-of-locations-from-first-member-when-he-is-on-second-member.cy.js @@ -107,7 +107,6 @@ describe('Inventory', () => { { tags: ['criticalPathECS', 'folijet', 'C423392'] }, () => { InventoryInstances.searchByTitle(testData.instanceIds.instanceId); - cy.reload(); InventoryInstance.waitLoading(); InventoryInstance.verifyConsortiaHoldingsAccordion(); InventoryInstance.expandConsortiaHoldings(); diff --git a/cypress/e2e/data-import/e2e/match-on-pol-and-update-instance.cy.js b/cypress/e2e/data-import/e2e/match-on-pol-and-update-instance.cy.js index 3397a20ceb..b43d27fb1c 100644 --- a/cypress/e2e/data-import/e2e/match-on-pol-and-update-instance.cy.js +++ b/cypress/e2e/data-import/e2e/match-on-pol-and-update-instance.cy.js @@ -145,7 +145,7 @@ describe('Data Import', () => { Permissions.uiOrdersApprovePurchaseOrders.gui, Permissions.uiInventoryViewCreateEditHoldings.gui, Permissions.uiInventoryViewCreateEditInstances.gui, - Permissions.uiInventoryViewCreateEditItems, + Permissions.uiInventoryViewCreateEditItems.gui, Permissions.uiInventoryViewInstances.gui, Permissions.uiQuickMarcQuickMarcBibliographicEditorView.gui, ]).then((userProperties) => { diff --git a/cypress/e2e/data-import/e2e/match-on-pol-and-update-items.cy.js b/cypress/e2e/data-import/e2e/match-on-pol-and-update-items.cy.js index 9c2c58586a..8a4ba9f1db 100644 --- a/cypress/e2e/data-import/e2e/match-on-pol-and-update-items.cy.js +++ b/cypress/e2e/data-import/e2e/match-on-pol-and-update-items.cy.js @@ -174,7 +174,7 @@ describe('Data Import', () => { Permissions.uiOrdersEdit.gui, Permissions.uiInventoryViewCreateEditHoldings.gui, Permissions.uiInventoryViewCreateEditInstances.gui, - Permissions.uiInventoryViewCreateEditItems, + Permissions.uiInventoryViewCreateEditItems.gui, Permissions.settingsDataImportEnabled.gui, Permissions.moduleDataImportEnabled.gui, Permissions.uiReceivingViewEditCreate.gui, diff --git a/cypress/e2e/data-import/importing-marc-bib-files/matching-on-newly-created-035-does-not-work.cy.js b/cypress/e2e/data-import/importing-marc-bib-files/matching-on-newly-created-035-does-not-work.cy.js index 89bdb611b0..01cef62829 100644 --- a/cypress/e2e/data-import/importing-marc-bib-files/matching-on-newly-created-035-does-not-work.cy.js +++ b/cypress/e2e/data-import/importing-marc-bib-files/matching-on-newly-created-035-does-not-work.cy.js @@ -113,7 +113,7 @@ describe('Data Import', () => { Permissions.moduleDataImportEnabled.gui, Permissions.settingsDataImportEnabled.gui, Permissions.inventoryAll.gui, - Permissions.uiInventorySingleRecordImport, + Permissions.uiInventorySingleRecordImport.gui, Permissions.uiQuickMarcQuickMarcBibliographicEditorView.gui, ]).then((userProperties) => { user = userProperties; diff --git a/cypress/e2e/data-import/importing-marc-bib-files/update-holdings-via-static-value-submatch.cy.js b/cypress/e2e/data-import/importing-marc-bib-files/update-holdings-via-static-value-submatch.cy.js index 1c66a37762..abfd3d2408 100644 --- a/cypress/e2e/data-import/importing-marc-bib-files/update-holdings-via-static-value-submatch.cy.js +++ b/cypress/e2e/data-import/importing-marc-bib-files/update-holdings-via-static-value-submatch.cy.js @@ -393,9 +393,7 @@ describe('Data Import', () => { FileDetails.checkHoldingsQuantityInSummaryTable(quantityOfItems, 1); TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY); - InventorySearchAndFilter.selectYesfilterStaffSuppress(); - InventorySearchAndFilter.searchInstanceByHRID(instanceHrid); - InstanceRecordView.openHoldingView(); + HoldingsRecordView.waitLoading(); HoldingsRecordView.checkFormerHoldingsId( holdingsMappingProfileForUpdate.formerHoldingsId, ); diff --git a/cypress/e2e/data-import/permissions/can-see-json-tab-for-imported-orders-with-data-import-can-upload-files-import-and-view-logs-permission.cy.js b/cypress/e2e/data-import/permissions/can-see-json-tab-for-imported-orders-with-data-import-can-upload-files-import-and-view-logs-permission.cy.js index 1190dab5ad..3d3c2de357 100644 --- a/cypress/e2e/data-import/permissions/can-see-json-tab-for-imported-orders-with-data-import-can-upload-files-import-and-view-logs-permission.cy.js +++ b/cypress/e2e/data-import/permissions/can-see-json-tab-for-imported-orders-with-data-import-can-upload-files-import-and-view-logs-permission.cy.js @@ -16,7 +16,6 @@ import NewJobProfile from '../../../support/fragments/data_import/job_profiles/n import FileDetails from '../../../support/fragments/data_import/logs/fileDetails'; import JsonScreenView from '../../../support/fragments/data_import/logs/jsonScreenView'; import Logs from '../../../support/fragments/data_import/logs/logs'; -import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance'; import OrderLines from '../../../support/fragments/orders/orderLines'; import { ActionProfiles as SettingsActionProfiles, @@ -36,7 +35,6 @@ import getRandomPostfix from '../../../support/utils/stringTools'; describe('Data Import', () => { describe('Permissions', () => { let user; - let instanceId; const filePath = 'marcBibFileForC377023.mrc'; const marcFileName = `C377023 autotestFileName${getRandomPostfix()}.mrc`; const title = 'ROALD DAHL : TELLER OF THE UNEXPECTED : A BIOGRAPHY.'; @@ -135,7 +133,6 @@ describe('Data Import', () => { SettingsJobProfiles.deleteJobProfileByNameViaApi(jobProfile.profileName); SettingsActionProfiles.deleteActionProfileByNameViaApi(actionProfile.name); SettingsFieldMappingProfiles.deleteMappingProfileByNameViaApi(mappingProfile.name); - InventoryInstance.deleteInstanceViaApi(instanceId); }); }); diff --git a/cypress/e2e/settings/data-import/no-duplicates-profiles-appears-in-job-profile-with-repeatable-profiles-after-duplicating.cy.js b/cypress/e2e/settings/data-import/no-duplicates-profiles-appears-in-job-profile-with-repeatable-profiles-after-duplicating.cy.js index 30231465dc..0a2258f4d7 100644 --- a/cypress/e2e/settings/data-import/no-duplicates-profiles-appears-in-job-profile-with-repeatable-profiles-after-duplicating.cy.js +++ b/cypress/e2e/settings/data-import/no-duplicates-profiles-appears-in-job-profile-with-repeatable-profiles-after-duplicating.cy.js @@ -227,11 +227,13 @@ describe('Data Import', () => { cy.wait(2000); JobProfileView.duplicate(); NewJobProfile.fillProfileName(jobProfileNameForChanging); - cy.wait(7000); + cy.wait(3000); NewJobProfile.unlinkProfile(1); + cy.wait(3000); NewJobProfile.saveAndClose(); JobProfileView.verifyCalloutMessage(calloutMessage); JobProfileView.verifyJobProfileOpened(); + cy.wait(7000); JobProfileView.verifyJobProfileName(jobProfileNameForChanging); JobProfileView.verifyLinkedProfiles(linkedProfileNames, linkedProfileNames.length); }, diff --git a/cypress/support/fragments/inventory/inventoryInstance.js b/cypress/support/fragments/inventory/inventoryInstance.js index f4454dea93..95f12ce1b6 100644 --- a/cypress/support/fragments/inventory/inventoryInstance.js +++ b/cypress/support/fragments/inventory/inventoryInstance.js @@ -1772,7 +1772,7 @@ export default { cy.wait(2000); cy.expect([ Accordion({ id: memberId }).has({ open: isOpen }), - Accordion({ id: `consortialHoldings.cs00000int_0005.${holdingsId}` }).exists(), + Accordion({ id: `consortialHoldings.${memberId}.${holdingsId}` }).exists(), ]); }, diff --git a/cypress/support/fragments/settings/dataImport/fieldMappingProfile/fieldMappingProfiles.js b/cypress/support/fragments/settings/dataImport/fieldMappingProfile/fieldMappingProfiles.js index bf80ca909f..01a73be498 100644 --- a/cypress/support/fragments/settings/dataImport/fieldMappingProfile/fieldMappingProfiles.js +++ b/cypress/support/fragments/settings/dataImport/fieldMappingProfile/fieldMappingProfiles.js @@ -197,7 +197,10 @@ export default { cells.push(cellValue); }); }) - .then(() => cy.expect(ArrayUtils.checkIsSortedAlphabetically({ array: cells })).to.equal(true)); + .then(() => { + const isSorted = ArrayUtils.checkIsSortedAlphabetically({ array: cells }); + cy.expect(isSorted).to.equal(true); + }); }, ...ResultsPane, clickCreateNewFieldMappingProfile() { diff --git a/cypress/support/utils/arrays.js b/cypress/support/utils/arrays.js index 088aa6b4ae..1a9aee236c 100644 --- a/cypress/support/utils/arrays.js +++ b/cypress/support/utils/arrays.js @@ -32,19 +32,27 @@ export default { }, checkIsSortedAlphabetically({ array = [], accuracy = 1 } = {}) { - const result = array.reduce((acc, it) => { - if (acc.length) { - const prev = acc[acc.length - 1].value; - const current = it.toLowerCase(); - - return [...acc, { value: current, order: prev.localeCompare(current) }]; - } else { - return [{ value: it.toLowerCase(), order: 0 }]; + if (array.length === 0) return true; + + let outOfOrderCount = 0; + + for (let i = 1; i < array.length; i++) { + // Normalize strings for comparison: replace hyphens with spaces and trim + const prev = array[i - 1].trim().toLowerCase().replace(/-/g, ' ').replace(/\s+/g, ' '); + const current = array[i].trim().toLowerCase().replace(/-/g, ' ').replace(/\s+/g, ' '); + + // Compare adjacent elements + if (prev.localeCompare(current) > 0) { + outOfOrderCount++; + + // Early exit if the accuracy threshold is exceeded + if ((outOfOrderCount * 100) / array.length >= accuracy) { + return false; + } } - }, []); + } - const invalidOrder = result.filter(({ order }) => order > 0); - return (invalidOrder.length * 100) / array.length < accuracy; + return true; }, };