From 1b7fa6a575a0e42bc6fdb26f030cd0fbee8e8881 Mon Sep 17 00:00:00 2001 From: Tetiana Paranich <89065577+TetianaParanich@users.noreply.github.com> Date: Wed, 25 Dec 2024 12:54:34 +0200 Subject: [PATCH] fixed tests (#4583) --- .../e2e/match-on-holdings-856-u.cy.js | 6 +- .../e2e/mrc-import-with-matching-001.cy.js | 4 +- .../e2e/mrc-import-with-matching-999ff.cy.js | 3 +- ...stopping-running-job-and-deleting-it.cy.js | 2 +- .../log-summary-table-display.cy.js | 13 +- ...record-import-with-running-large-job.cy.js | 176 +++++++++--------- .../test-remove-field-mapping-option.cy.js | 1 + ...e-holdings-via-static-value-submatch.cy.js | 6 +- ...iles-import-and-view-logs-permission.cy.js | 4 - .../inventory/holdings/holdings-details.cy.js | 1 - .../import-by-oclc-source-folio.cy.js | 10 +- ...epeatable-profiles-after-duplicating.cy.js | 4 +- .../fragments/inventory/inventoryInstance.js | 3 + .../fieldMappingProfiles.js | 5 +- cypress/support/utils/arrays.js | 34 ++-- 15 files changed, 146 insertions(+), 126 deletions(-) diff --git a/cypress/e2e/data-import/e2e/match-on-holdings-856-u.cy.js b/cypress/e2e/data-import/e2e/match-on-holdings-856-u.cy.js index 845ca1f3d4..6a02bab318 100644 --- a/cypress/e2e/data-import/e2e/match-on-holdings-856-u.cy.js +++ b/cypress/e2e/data-import/e2e/match-on-holdings-856-u.cy.js @@ -17,9 +17,7 @@ import NewJobProfile from '../../../support/fragments/data_import/job_profiles/n import FileDetails from '../../../support/fragments/data_import/logs/fileDetails'; import Logs from '../../../support/fragments/data_import/logs/logs'; import HoldingsRecordView from '../../../support/fragments/inventory/holdingsRecordView'; -import InstanceRecordView from '../../../support/fragments/inventory/instanceRecordView'; import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance'; -import InventorySearchAndFilter from '../../../support/fragments/inventory/inventorySearchAndFilter'; import { ActionProfiles as SettingsActionProfiles, FieldMappingProfiles as SettingsFieldMappingProfiles, @@ -238,9 +236,7 @@ describe('Data Import', () => { Logs.checkJobStatus(nameForUpdateCreateMarcFile, JOB_STATUS_NAMES.COMPLETED); TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY); - InventorySearchAndFilter.searchInstanceByHRID(instanceHRID); - InstanceRecordView.verifyInstancePaneExists(); - InstanceRecordView.openHoldingView(); + HoldingsRecordView.waitLoading(); HoldingsRecordView.checkCallNumber('ONLINE'); }); }, diff --git a/cypress/e2e/data-import/e2e/mrc-import-with-matching-001.cy.js b/cypress/e2e/data-import/e2e/mrc-import-with-matching-001.cy.js index 2b4c622566..776c903cb6 100644 --- a/cypress/e2e/data-import/e2e/mrc-import-with-matching-001.cy.js +++ b/cypress/e2e/data-import/e2e/mrc-import-with-matching-001.cy.js @@ -193,8 +193,8 @@ describe('Data Import', () => { FileDetails.columnNameInResultList.instance, ); - TopMenuNavigation.openAppFromDropdown(APPLICATION_NAMES.INVENTORY); - cy.wait(2000); + TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY); + InventorySearchAndFilter.waitLoading(); InventorySearchAndFilter.searchInstanceByHRID(instanceHRID); // ensure the fields created in Field mapping profile exists in inventory InventorySearchAndFilter.checkInstanceDetails(); diff --git a/cypress/e2e/data-import/e2e/mrc-import-with-matching-999ff.cy.js b/cypress/e2e/data-import/e2e/mrc-import-with-matching-999ff.cy.js index a90c3bd962..3bea6850f3 100644 --- a/cypress/e2e/data-import/e2e/mrc-import-with-matching-999ff.cy.js +++ b/cypress/e2e/data-import/e2e/mrc-import-with-matching-999ff.cy.js @@ -236,8 +236,7 @@ describe('Data Import', () => { FileDetails.columnNameInResultList.instance, ); - TopMenuNavigation.openAppFromDropdown(APPLICATION_NAMES.INVENTORY); - InventorySearchAndFilter.searchInstanceByHRID(instanceHRID); + TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY); InstanceRecordView.verifyInstancePaneExists(); // ensure the fields created in Field mapping profile exists in inventory InventorySearchAndFilter.checkInstanceDetails(); diff --git a/cypress/e2e/data-import/importing-marc-bib-files/import-additional-files-without-handling-after-stopping-running-job-and-deleting-it.cy.js b/cypress/e2e/data-import/importing-marc-bib-files/import-additional-files-without-handling-after-stopping-running-job-and-deleting-it.cy.js index 1c709847b3..fd49672125 100644 --- a/cypress/e2e/data-import/importing-marc-bib-files/import-additional-files-without-handling-after-stopping-running-job-and-deleting-it.cy.js +++ b/cypress/e2e/data-import/importing-marc-bib-files/import-additional-files-without-handling-after-stopping-running-job-and-deleting-it.cy.js @@ -47,7 +47,7 @@ describe('Data Import', () => { JobProfiles.runImportFile(); Logs.checkFileIsRunning(bigFileName); // TODO wait until at least 1% of the file will be processed - cy.wait(45000); + cy.wait(15000); DataImport.deleteImportJob(bigFileName); DataImport.verifyCancelImportJobModal(); DataImport.confirmDeleteImportJob(); diff --git a/cypress/e2e/data-import/importing-marc-bib-files/log-summary-table-display.cy.js b/cypress/e2e/data-import/importing-marc-bib-files/log-summary-table-display.cy.js index 0714bd7696..09470aa81c 100644 --- a/cypress/e2e/data-import/importing-marc-bib-files/log-summary-table-display.cy.js +++ b/cypress/e2e/data-import/importing-marc-bib-files/log-summary-table-display.cy.js @@ -1,6 +1,7 @@ import { DEFAULT_JOB_PROFILE_NAMES, RECORD_STATUSES } from '../../../support/constants'; import { Permissions } from '../../../support/dictionary'; import DataImport from '../../../support/fragments/data_import/dataImport'; +import JobProfiles from '../../../support/fragments/data_import/job_profiles/jobProfiles'; import FileDetails from '../../../support/fragments/data_import/logs/fileDetails'; import Logs from '../../../support/fragments/data_import/logs/logs'; import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance'; @@ -20,16 +21,16 @@ describe('Data Import', () => { cy.createTempUser([Permissions.moduleDataImportEnabled.gui]).then((userProperties) => { user = userProperties; - DataImport.uploadFileViaApi(filePathToUpload, fileName, jobProfileToRun).then( - (response) => { - instanceId = response[0].instance.id; - }, - ); - cy.login(user.username, user.password, { path: TopMenu.dataImportPath, waiter: DataImport.waitLoading, }); + DataImport.verifyUploadState(); + DataImport.uploadFile(filePathToUpload, fileName); + JobProfiles.waitFileIsUploaded(); + JobProfiles.search(jobProfileToRun); + JobProfiles.runImportFile(); + Logs.waitFileIsImported(fileName); }); }); diff --git a/cypress/e2e/data-import/importing-marc-bib-files/single-record-import-with-running-large-job.cy.js b/cypress/e2e/data-import/importing-marc-bib-files/single-record-import-with-running-large-job.cy.js index 6976dd71cf..ade115a9eb 100644 --- a/cypress/e2e/data-import/importing-marc-bib-files/single-record-import-with-running-large-job.cy.js +++ b/cypress/e2e/data-import/importing-marc-bib-files/single-record-import-with-running-large-job.cy.js @@ -14,99 +14,107 @@ import Users from '../../../support/fragments/users/users'; import InteractorsTools from '../../../support/utils/interactorsTools'; import getRandomPostfix from '../../../support/utils/stringTools'; +let user; +const OCLCAuthentication = '100481406/PAOLF'; +const fileName = `C356824 autotestFile${getRandomPostfix()}.mrc`; +const jobProfileToRun = DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS; +const oclcForImport = '912958093'; +const oclcForUpdating = '698820890'; +const updatedInstanceData = { + title: + 'Dictionary of Louisiana French : as spoken in Cajun, Creole, and American Indian communities / Albert Valdman, editor ; Kevin J. Rottet, associate editor.', + language: 'English, French', + publisher: 'University Press of Mississippi', + placeOfPublication: 'Jackson', + publicationDate: '2010', + physicalDescription: 'XL, 892 S', + subject: 'French language--Dialects--Louisiana--Dictionaries', + notes: { + noteType: 'Bibliography note', + noteContent: 'Includes bibliographical references and index', + }, +}; + describe('Data Import', () => { - describe('Importing MARC Bib files', () => { - let user; - const OCLCAuthentication = '100481406/PAOLF'; - const fileName = `C356824 autotestFile${getRandomPostfix()}.mrc`; - const jobProfileToRun = DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS; - const oclcForImport = '912958093'; - const oclcForUpdating = '698820890'; - const updatedInstanceData = { - title: - 'Dictionary of Louisiana French : as spoken in Cajun, Creole, and American Indian communities / Albert Valdman, editor ; Kevin J. Rottet, associate editor.', - language: 'English, French', - publisher: 'University Press of Mississippi', - placeOfPublication: 'Jackson', - publicationDate: '2010', - physicalDescription: 'XL, 892 S', - subject: 'French language--Dialects--Louisiana--Dictionaries', - notes: { - noteType: 'Bibliography note', - noteContent: 'Includes bibliographical references and index', + describe( + 'Importing MARC Bib files', + { + retries: { + runMode: 2, }, - }; - - before('Create test user and login', () => { - cy.createTempUser([ - Permissions.moduleDataImportEnabled.gui, - Permissions.uiInventorySingleRecordImport.gui, - Permissions.uiInventorySettingsConfigureSingleRecordImport.gui, - Permissions.settingsDataImportEnabled.gui, - Permissions.remoteStorageView.gui, - ]).then((userProperties) => { - user = userProperties; + }, + () => { + beforeEach('Create test user and login', () => { + cy.createTempUser([ + Permissions.moduleDataImportEnabled.gui, + Permissions.uiInventorySingleRecordImport.gui, + Permissions.uiInventorySettingsConfigureSingleRecordImport.gui, + Permissions.settingsDataImportEnabled.gui, + Permissions.remoteStorageView.gui, + ]).then((userProperties) => { + user = userProperties; - cy.login(user.username, user.password, { - path: TopMenu.dataImportPath, - waiter: DataImport.waitLoading, + cy.login(user.username, user.password, { + path: TopMenu.dataImportPath, + waiter: DataImport.waitLoading, + }); }); }); - }); - after('Delete test data', () => { - cy.getAdminToken().then(() => { - Users.deleteViaApi(user.userId); + afterEach('Delete test data', () => { + cy.getAdminToken().then(() => { + Users.deleteViaApi(user.userId); + }); }); - }); - it( - 'C356824 Inventory single record import is not delayed when large data import jobs are running (folijet)', - { tags: ['criticalPathFlaky', 'folijet', 'C356824'] }, - () => { - Z3950TargetProfiles.changeOclcWorldCatValueViaApi(OCLCAuthentication); + it( + 'C356824 Inventory single record import is not delayed when large data import jobs are running (folijet)', + { tags: ['criticalPathFlaky', 'folijet', 'C356824'] }, + () => { + Z3950TargetProfiles.changeOclcWorldCatValueViaApi(OCLCAuthentication); - // import a file - DataImport.checkIsLandingPageOpened(); - DataImport.verifyUploadState(); - DataImport.uploadFile('oneThousandMarcBib.mrc', fileName); - JobProfiles.waitFileIsUploaded(); - JobProfiles.search(jobProfileToRun); - JobProfiles.runImportFile(); - Logs.checkFileIsRunning(fileName); + // import a file + DataImport.checkIsLandingPageOpened(); + DataImport.verifyUploadState(); + DataImport.uploadFile('oneThousandMarcBib.mrc', fileName); + JobProfiles.waitFileIsUploaded(); + JobProfiles.search(jobProfileToRun); + JobProfiles.runImportFile(); + Logs.checkFileIsRunning(fileName); - TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY); - InventoryInstances.importWithOclc(oclcForImport); - InventoryInstance.waitLoading(); - InventoryInstance.startOverlaySourceBibRecord(); - InventoryInstance.singleOverlaySourceBibRecordModalIsPresented(); - InventoryInstance.overlayWithOclc(oclcForUpdating); - InteractorsTools.checkCalloutMessage( - `Record ${oclcForUpdating} updated. Results may take a few moments to become visible in Inventory`, - calloutTypes.success, - ); - cy.reload(); - // check instance is updated - InventoryInstance.verifyInstanceTitle(updatedInstanceData.title); - InventoryInstance.verifyInstanceLanguage(updatedInstanceData.language); - InventoryInstance.verifyInstancePublisher({ - publisher: updatedInstanceData.publisher, - place: updatedInstanceData.placeOfPublication, - date: updatedInstanceData.publicationDate, - }); - InventoryInstance.verifyInstancePhysicalcyDescription( - updatedInstanceData.physicalDescription, - ); - InventoryInstance.openSubjectAccordion(); - InventoryInstance.verifyInstanceSubject(0, 0, updatedInstanceData.subject); - InventoryInstance.checkInstanceNotes( - updatedInstanceData.notes.noteType, - updatedInstanceData.notes.noteContent, - ); + TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY); + InventoryInstances.importWithOclc(oclcForImport); + InventoryInstance.waitLoading(); + InventoryInstance.startOverlaySourceBibRecord(); + InventoryInstance.singleOverlaySourceBibRecordModalIsPresented(); + InventoryInstance.overlayWithOclc(oclcForUpdating); + InteractorsTools.checkCalloutMessage( + `Record ${oclcForUpdating} updated. Results may take a few moments to become visible in Inventory`, + calloutTypes.success, + ); + cy.reload(); + // check instance is updated + InventoryInstance.verifyInstanceTitle(updatedInstanceData.title); + InventoryInstance.verifyInstanceLanguage(updatedInstanceData.language); + InventoryInstance.verifyInstancePublisher({ + publisher: updatedInstanceData.publisher, + place: updatedInstanceData.placeOfPublication, + date: updatedInstanceData.publicationDate, + }); + InventoryInstance.verifyInstancePhysicalcyDescription( + updatedInstanceData.physicalDescription, + ); + InventoryInstance.openSubjectAccordion(); + InventoryInstance.verifyInstanceSubject(0, 0, updatedInstanceData.subject); + InventoryInstance.checkInstanceNotes( + updatedInstanceData.notes.noteType, + updatedInstanceData.notes.noteContent, + ); - TopMenuNavigation.navigateToApp(APPLICATION_NAMES.DATA_IMPORT); - Logs.checkFileIsRunning(fileName); - }, - ); - }); + TopMenuNavigation.navigateToApp(APPLICATION_NAMES.DATA_IMPORT); + Logs.checkFileIsRunning(fileName); + }, + ); + }, + ); }); diff --git a/cypress/e2e/data-import/importing-marc-bib-files/test-remove-field-mapping-option.cy.js b/cypress/e2e/data-import/importing-marc-bib-files/test-remove-field-mapping-option.cy.js index 9a52bbd5f6..6d460d6cc9 100644 --- a/cypress/e2e/data-import/importing-marc-bib-files/test-remove-field-mapping-option.cy.js +++ b/cypress/e2e/data-import/importing-marc-bib-files/test-remove-field-mapping-option.cy.js @@ -465,6 +465,7 @@ describe('Data Import', () => { FileDetails.checkItemQuantityInSummaryTable(quantityOfItems, 1); TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY); + ItemRecordView.closeDetailView(); InventorySearchAndFilter.searchInstanceByHRID(initialInstanceHrId); InventoryInstance.openHoldingView(); HoldingsRecordView.checkTemporaryLocation('-'); 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..4f80604fde 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 @@ -361,7 +361,7 @@ describe('Data Import', () => { SettingsDataImport.selectSettingsTab(SETTINGS_TABS.MATCH_PROFILES); MatchProfiles.createMatchProfile(instanceMatchProfile); MatchProfiles.checkMatchProfilePresented(instanceMatchProfile.profileName); - cy.wait(1000); + cy.wait(3000); MatchProfiles.createMatchProfileWithStaticValue(holdingsMatchProfile); MatchProfiles.checkMatchProfilePresented(holdingsMatchProfile.profileName); @@ -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 877f9f9466..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); }); }); @@ -151,7 +148,6 @@ describe('Data Import', () => { JsonScreenView.openOrderTab(); JsonScreenView.verifyContentInTab(message); TopMenuNavigation.navigateToApp(APPLICATION_NAMES.DATA_IMPORT); - FileDetails.close(); Logs.openFileDetails(marcFileName); FileDetails.openOrder(RECORD_STATUSES.CREATED); OrderLines.waitLoading(); diff --git a/cypress/e2e/inventory/holdings/holdings-details.cy.js b/cypress/e2e/inventory/holdings/holdings-details.cy.js index 22c8ddfbdf..af873e7e0a 100644 --- a/cypress/e2e/inventory/holdings/holdings-details.cy.js +++ b/cypress/e2e/inventory/holdings/holdings-details.cy.js @@ -50,7 +50,6 @@ describe('Inventory', () => { HoldingsRecordEdit.saveAndClose(); HoldingsRecordView.waitLoading(); HoldingsRecordView.checkHoldingsType(testData.holdingsType); - cy.logout(); cy.login(testData.user.username, testData.user.password, { path: TopMenu.inventoryPath, diff --git a/cypress/e2e/inventory/single-record-import/import-by-oclc-source-folio.cy.js b/cypress/e2e/inventory/single-record-import/import-by-oclc-source-folio.cy.js index 766875e7e1..67fa408718 100644 --- a/cypress/e2e/inventory/single-record-import/import-by-oclc-source-folio.cy.js +++ b/cypress/e2e/inventory/single-record-import/import-by-oclc-source-folio.cy.js @@ -14,7 +14,7 @@ let user; let instanceRecord; const OCLCAuthentication = '100481406/PAOLF'; const oclcRecordData = { - title: 'Cooking Light Soups & Stew [electronic resource].', + title: 'Cooking Light Soups & Stew.', language: 'English', publisher: 'TI Inc. Books', placeOfPublication: 'Chicago', @@ -79,7 +79,6 @@ describe('Inventory', () => { `Record ${oclcRecordData.oclc} updated. Results may take a few moments to become visible in Inventory`, ); cy.wait(15000); - cy.reload(); InventoryInstance.waitInstanceRecordViewOpened(oclcRecordData.title); InventoryInstance.verifyLastUpdatedDate(); InstanceRecordView.verifyInstanceSource(INSTANCE_SOURCE_NAMES.MARC); @@ -91,9 +90,12 @@ describe('Inventory', () => { date: oclcRecordData.publicationDate, }); InventoryInstance.verifyInstancePhysicalcyDescription(oclcRecordData.physicalDescription); - InventoryInstance.verifyResourceIdentifier('ISBN', oclcRecordData.isbn1, 4); - InventoryInstance.verifyResourceIdentifier('ISBN', oclcRecordData.isbn2, 5); + InventoryInstance.openIdentifiersAccordion(); + InventoryInstance.verifyResourceIdentifier('ISBN', oclcRecordData.isbn1, 6); + InventoryInstance.verifyResourceIdentifier('ISBN', oclcRecordData.isbn2, 7); + InventoryInstance.openSubjectAccordion(); InventoryInstance.verifyInstanceSubject(0, 0, oclcRecordData.subject); + InventoryInstance.openInstanceNotesAccordion(); InventoryInstance.checkInstanceNotes( oclcRecordData.notes.noteType, oclcRecordData.notes.noteContent, 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..6779e63330 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,10 +227,12 @@ 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); + cy.wait(7000); JobProfileView.verifyJobProfileOpened(); 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 51caed9b14..79ee165b10 100644 --- a/cypress/support/fragments/inventory/inventoryInstance.js +++ b/cypress/support/fragments/inventory/inventoryInstance.js @@ -394,6 +394,7 @@ export default { }, openSubjectAccordion: () => cy.do(subjectAccordion.clickHeader()), + openIdentifiersAccordion: () => cy.do(identifiersAccordion.clickHeader()), openInstanceNotesAccordion: () => cy.do(Button({ id: 'accordion-toggle-button-instance-details-notes' }).click()), checkAuthorityAppIconInSection: (sectionId, value, isPresent) => { if (isPresent) { @@ -1436,7 +1437,9 @@ export default { 'Inventory Single Record - Default Update Instance (Default)', ), ); + cy.wait(1500); cy.do(singleRecordImportModal.find(TextField({ name: 'externalIdentifier' })).fillIn(oclc)); + cy.wait(1500); cy.do(singleRecordImportModal.find(Button('Import')).click()); }, diff --git a/cypress/support/fragments/settings/dataImport/fieldMappingProfile/fieldMappingProfiles.js b/cypress/support/fragments/settings/dataImport/fieldMappingProfile/fieldMappingProfiles.js index 6fbffbbe22..cba01464b9 100644 --- a/cypress/support/fragments/settings/dataImport/fieldMappingProfile/fieldMappingProfiles.js +++ b/cypress/support/fragments/settings/dataImport/fieldMappingProfile/fieldMappingProfiles.js @@ -195,7 +195,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..ec417189fc 100644 --- a/cypress/support/utils/arrays.js +++ b/cypress/support/utils/arrays.js @@ -32,19 +32,31 @@ 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; // An empty array is considered sorted. + + let outOfOrderCount = 0; + + for (let i = 1; i < array.length; i++) { + // Normalize strings: remove non-alphanumeric characters, spaces, and convert to lowercase + const prev = array[i - 1] + .replace(/[^a-z0-9]/gi, '') // Remove non-alphanumeric characters + .toLowerCase(); + const current = array[i] + .replace(/[^a-z0-9]/gi, '') // Remove non-alphanumeric characters + .toLowerCase(); + + // 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; }, };