diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-electronic-access-clear-field.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-electronic-access-clear-field.cy.js index 911360ed24..e42fcb7247 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-electronic-access-clear-field.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-electronic-access-clear-field.cy.js @@ -69,22 +69,16 @@ describe('Bulk-edit', () => { ]).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(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditHoldings.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-electronic-access-find-replace-action-in-central-tenant.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-electronic-access-find-replace-action-in-central-tenant.cy.js new file mode 100644 index 0000000000..fb9b88dcaa --- /dev/null +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-electronic-access-find-replace-action-in-central-tenant.cy.js @@ -0,0 +1,493 @@ +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: `C494356 folio instance testBulkEdit_${getRandomPostfix()}`, +}; +const marcInstance = { + title: `C494356 marc instance testBulkEdit_${getRandomPostfix()}`, +}; +const sharedUrlRelationship = { + payload: { + name: `C494356 shared urlRelationship ${getRandomPostfix()}`, + }, +}; +const localUrlRelationship = { + name: `C494356 local urlRelationship ${getRandomPostfix()}`, +}; +const localUrlRelationshipNameWithAffiliation = `${localUrlRelationship.name} (${Affiliations.College})`; +const electronicAccessFieldsFromUpperCase = { + uri: 'HTTPS://www.testuri.com/uri', + linkText: 'Te;st: [sample] li*nk$text', + materialsSpecification: 'Test materials specified', + publicNote: 'URL public note', +}; +const electronicAccessFieldsFromLowerCase = { + uri: 'https://www.testuri.com/uri', + linkText: 'te;st: [sample] li*nk$text', + materialsSpecification: 'test materials specified', + publicNote: '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; + + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + 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: [ + { + ...electronicAccessFieldsFromUpperCase, + relationshipId: sharedUrlRelationship.settingId, + }, + { + ...electronicAccessFieldsFromLowerCase, + 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: [ + { + ...electronicAccessFieldsFromUpperCase, + relationshipId: sharedUrlRelationship.settingId, + }, + { + ...electronicAccessFieldsFromLowerCase, + 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( + 'C494356 Verify "Find & replace" action for Holdings electronic access in Central tenant (consortia) (firebird)', + { tags: ['smokeECS', 'firebird', 'C494356'] }, + () => { + BulkEditSearchPane.verifyDragNDropRecordTypeIdentifierArea('Holdings', 'Holdings UUIDs'); + BulkEditSearchPane.uploadFile(holdingUUIDsFileName); + BulkEditSearchPane.verifyPaneTitleFileName(holdingUUIDsFileName); + BulkEditSearchPane.verifyPaneRecordsCount('4 holding'); + 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 electronicAccessFieldsFromUpperCaseToString = Object.values( + electronicAccessFieldsFromUpperCase, + ).join(''); + const electronicAccessFieldsFromLowerCaseToString = Object.values( + electronicAccessFieldsFromLowerCase, + ).join(''); + + const holdingElectronicAccessFields = `${electronicAccessTableHeaders}${sharedUrlRelationship.payload.name}${electronicAccessFieldsFromUpperCaseToString}${sharedUrlRelationship.payload.name}${electronicAccessFieldsFromLowerCaseToString}`; + + holdingHrids.forEach((holdingHrid) => { + BulkEditSearchPane.verifyExactChangesUnderColumnsByIdentifierInResultsAccordion( + holdingHrid, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + holdingElectronicAccessFields, + ); + }); + + 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 electronicAccessFieldsFromUpperCaseToStringInFile = Object.values( + electronicAccessFieldsFromUpperCase, + ).join(';'); + const electronicAccessFieldsFromLowerCaseToStringInFile = Object.values( + electronicAccessFieldsFromLowerCase, + ).join(';'); + const holdingElectronicAccessFieldsInFile = `${electronicAccessTableHeadersInFile}${sharedUrlRelationship.payload.name};${electronicAccessFieldsFromUpperCaseToStringInFile}|${sharedUrlRelationship.payload.name};${electronicAccessFieldsFromLowerCaseToStringInFile}`; + + FileManager.convertCsvToJson(matchedRecordsFileName).then((csvFileData) => { + csvFileData.forEach((row) => { + cy.expect( + row[BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS], + ).to.equal(holdingElectronicAccessFieldsInFile); + }); + }); + + BulkEditActions.openInAppStartBulkEditFrom(); + BulkEditSearchPane.verifyBulkEditsAccordionExists(); + BulkEditActions.verifyOptionsDropdown(); + BulkEditActions.verifyRowIcons(); + BulkEditActions.verifyCancelButtonDisabled(false); + BulkEditSearchPane.isConfirmButtonDisabled(true); + BulkEditActions.selectOption('URL Relationship'); + BulkEditActions.selectSecondAction('Find (full field search)'); + BulkEditActions.checkTypeExists(localUrlRelationshipNameWithAffiliation); + BulkEditActions.selectFromUnchangedSelect(sharedUrlRelationship.payload.name); + BulkEditActions.selectSecondAction('Replace with'); + BulkEditActions.checkTypeNotExist(sharedUrlRelationship.payload.name, 0, 1); + BulkEditActions.selectFromUnchangedSelect(localUrlRelationshipNameWithAffiliation); + BulkEditSearchPane.isConfirmButtonDisabled(false); + BulkEditActions.addNewBulkEditFilterString(); + BulkEditActions.verifyNewBulkEditRow(1); + BulkEditActions.noteReplaceWith('URI', 'HTTPS', 'https', 1); + + const options = ['Remove', 'Replace with']; + + BulkEditActions.verifyTheSecondActionOptions(options); + BulkEditSearchPane.isConfirmButtonDisabled(false); + BulkEditActions.addNewBulkEditFilterString(); + BulkEditActions.verifyNewBulkEditRow(2); + BulkEditActions.noteReplaceWith('Link text', 'Te;st:', 'te;st:', 2); + BulkEditSearchPane.isConfirmButtonDisabled(false); + BulkEditActions.addNewBulkEditFilterString(); + BulkEditActions.verifyNewBulkEditRow(3); + BulkEditActions.noteReplaceWith('Materials specified', 'Test', 'test', 3); + BulkEditSearchPane.isConfirmButtonDisabled(false); + BulkEditActions.addNewBulkEditFilterString(); + BulkEditActions.verifyNewBulkEditRow(4); + BulkEditActions.noteReplaceWith('URL public note', 'URL', 'url', 4); + BulkEditSearchPane.isConfirmButtonDisabled(false); + BulkEditActions.confirmChanges(); + BulkEditActions.verifyMessageBannerInAreYouSureForm(4); + + const holdingElectronicAccessFieldsToEdit = `${electronicAccessTableHeaders}${localUrlRelationship.name}${electronicAccessFieldsFromLowerCaseToString}${localUrlRelationship.name}${electronicAccessFieldsFromLowerCaseToString}`; + + holdingHrids.forEach((holdingHrid) => { + BulkEditSearchPane.verifyExactChangesUnderColumnsByIdentifier( + holdingHrid, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + holdingElectronicAccessFieldsToEdit, + ); + }); + + BulkEditActions.verifyAreYouSureForm(4); + BulkEditSearchPane.verifyPreviousPaginationButtonInAreYouSureFormDisabled(); + BulkEditSearchPane.verifyNextPaginationButtonInAreYouSureFormDisabled(); + BulkEditActions.downloadPreview(); + + const holdingElectronicAccessFieldsToEditInFile = `${electronicAccessTableHeadersInFile}${localUrlRelationship.name};${electronicAccessFieldsFromLowerCaseToStringInFile}|${localUrlRelationship.name};${electronicAccessFieldsFromLowerCaseToStringInFile}`; + + FileManager.convertCsvToJson(previewFileName).then((csvFileData) => { + csvFileData.forEach((row) => { + cy.expect(row).to.have.property( + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + holdingElectronicAccessFieldsToEditInFile, + ); + }); + }); + + BulkEditActions.commitChanges(); + BulkEditActions.verifySuccessBanner(4); + + const editedElectronicAccessFieldsInCollege = `${electronicAccessTableHeaders}${localUrlRelationship.name}${electronicAccessFieldsFromLowerCaseToString}${localUrlRelationship.name}${electronicAccessFieldsFromLowerCaseToString}`; + const editedElectronicAccessFieldsInUniversity = `${electronicAccessTableHeaders}${sharedUrlRelationship.payload.name}${electronicAccessFieldsFromLowerCaseToString}${sharedUrlRelationship.payload.name}${electronicAccessFieldsFromLowerCaseToString}`; + + collegeHoldingHrids.forEach((holdingHrid) => { + BulkEditSearchPane.verifyExactChangesUnderColumnsByIdentifierInChangesAccordion( + holdingHrid, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + editedElectronicAccessFieldsInCollege, + ); + }); + universityHoldingHrids.forEach((holdingHrid) => { + BulkEditSearchPane.verifyExactChangesUnderColumnsByIdentifierInChangesAccordion( + holdingHrid, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, + editedElectronicAccessFieldsInUniversity, + ); + }); + + BulkEditSearchPane.verifyErrorLabel(2); + + universityHoldingIds.forEach((universityHoldingId) => { + BulkEditSearchPane.verifyErrorByIdentifier( + universityHoldingId, + getReasonForError(universityHoldingId), + ); + }); + + BulkEditActions.openActions(); + BulkEditActions.downloadChangedCSV(); + + const holdingElectronicAccessFieldsEditedInCollegeInFile = `${electronicAccessTableHeadersInFile}${localUrlRelationship.name};${electronicAccessFieldsFromLowerCaseToStringInFile}|${localUrlRelationship.name};${electronicAccessFieldsFromLowerCaseToStringInFile}`; + const holdingElectronicAccessFieldsEditedInUniversityInFile = `${electronicAccessTableHeadersInFile}${sharedUrlRelationship.payload.name};${electronicAccessFieldsFromLowerCaseToStringInFile}|${sharedUrlRelationship.payload.name};${electronicAccessFieldsFromLowerCaseToStringInFile}`; + + 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(holdingElectronicAccessFieldsEditedInCollegeInFile); + }); + universityHoldingRows.forEach((universityRow) => { + cy.expect( + universityRow[BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS], + ).to.equal(holdingElectronicAccessFieldsEditedInUniversityInFile); + }); + }); + + 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, + electronicAccessFieldsFromLowerCase.uri, + electronicAccessFieldsFromLowerCase.linkText, + electronicAccessFieldsFromLowerCase.materialsSpecification, + electronicAccessFieldsFromLowerCase.publicNote, + ]; + + electronicAccessFieldsToValidateInCollege.forEach((field, ind) => { + HoldingsRecordView.verifyElectronicAccessByElementIndex(ind, field); + HoldingsRecordView.verifyElectronicAccessByElementIndex(ind, field, 1); + }); + }); + + 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, + electronicAccessFieldsFromLowerCase.uri, + electronicAccessFieldsFromLowerCase.linkText, + electronicAccessFieldsFromLowerCase.materialsSpecification, + electronicAccessFieldsFromLowerCase.publicNote, + ]; + + electronicAccessFieldsToValidateInUniversity.forEach((field, ind) => { + HoldingsRecordView.verifyElectronicAccessByElementIndex(ind, field); + HoldingsRecordView.verifyElectronicAccessByElementIndex(ind, field, 1); + }); + }); + }, + ); + }); + }); +}); 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 index 6cc8eadfb7..314dbb884d 100644 --- 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 @@ -79,22 +79,16 @@ describe('Bulk-edit', () => { ]).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(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditHoldings.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-staff-only-notes-in-central-tenant.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-staff-only-notes-in-central-tenant.cy.js index f087315560..c04dafdd0d 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-staff-only-notes-in-central-tenant.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-staff-only-notes-in-central-tenant.cy.js @@ -68,20 +68,16 @@ describe('Bulk-edit', () => { ]).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(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditHoldings.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); 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 fe124b055e..640524007f 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 @@ -79,24 +79,17 @@ describe('Bulk-edit', () => { ]).then((userProperties) => { user = userProperties; - cy.assignAffiliationToUser(Affiliations.College, user.userId); - cy.setTenant(Affiliations.College); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditHoldings.gui, - permissions.bulkEditQueryView.gui, - ]); - - cy.resetTenant(); - cy.assignAffiliationToUser(Affiliations.University, user.userId); - cy.setTenant(Affiliations.University); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditHoldings.gui, - permissions.bulkEditQueryView.gui, - ]); - - cy.resetTenant(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditHoldings.gui, + permissions.bulkEditQueryView.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-change-note-type-in-Central-tenant.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-change-note-type-in-Central-tenant.cy.js index 9ddfac3989..2c8ed30bac 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-change-note-type-in-Central-tenant.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-change-note-type-in-Central-tenant.cy.js @@ -78,20 +78,16 @@ describe('Bulk-edit', () => { ]).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(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditHoldings.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-remove-all-notes-in-Central-tenant.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-remove-all-notes-in-Central-tenant.cy.js index 015189bbed..d83dc4ec84 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-remove-all-notes-in-Central-tenant.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-holdings-verify-remove-all-notes-in-Central-tenant.cy.js @@ -73,20 +73,16 @@ describe('Bulk-edit', () => { ]).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(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditHoldings.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-clear-loan-type-in-central-tenant.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-clear-loan-type-in-central-tenant.cy.js index 40a59a55d2..c595b6c9c0 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-clear-loan-type-in-central-tenant.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-clear-loan-type-in-central-tenant.cy.js @@ -72,22 +72,16 @@ describe('Bulk-edit', () => { ]).then((userProperties) => { user = userProperties; - cy.assignAffiliationToUser(Affiliations.College, user.userId); - cy.setTenant(Affiliations.College); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); - cy.assignAffiliationToUser(Affiliations.University, user.userId); - cy.setTenant(Affiliations.University); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditItems.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-find-replace-item-notes-in-central-tenant.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-find-replace-item-notes-in-central-tenant.cy.js index e0d2d14fa6..c1007c92b1 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-find-replace-item-notes-in-central-tenant.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-find-replace-item-notes-in-central-tenant.cy.js @@ -86,22 +86,16 @@ describe('Bulk-edit', () => { ]).then((userProperties) => { user = userProperties; - cy.assignAffiliationToUser(Affiliations.College, user.userId); - cy.setTenant(Affiliations.College); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); - cy.assignAffiliationToUser(Affiliations.University, user.userId); - cy.setTenant(Affiliations.University); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditItems.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-replace-loan-type-in-central-tenant.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-replace-loan-type-in-central-tenant.cy.js index 300d6fb37e..e2b2467776 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-replace-loan-type-in-central-tenant.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-replace-loan-type-in-central-tenant.cy.js @@ -79,22 +79,16 @@ describe('Bulk-edit', () => { ]).then((userProperties) => { user = userProperties; - cy.assignAffiliationToUser(Affiliations.College, user.userId); - cy.setTenant(Affiliations.College); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); - cy.assignAffiliationToUser(Affiliations.University, user.userId); - cy.setTenant(Affiliations.University); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditItems.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-staff-only-notes-in-central.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-staff-only-notes-in-central.cy.js index a34178f52e..00a79c4806 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-staff-only-notes-in-central.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-staff-only-notes-in-central.cy.js @@ -82,22 +82,16 @@ describe('Bulk-edit', () => { ]).then((userProperties) => { user = userProperties; - cy.assignAffiliationToUser(Affiliations.College, user.userId); - cy.setTenant(Affiliations.College); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); - cy.assignAffiliationToUser(Affiliations.University, user.userId); - cy.setTenant(Affiliations.University); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditItems.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-add-note-action-in-Central-tenant.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-add-note-action-in-Central-tenant.cy.js index fda1e580a4..36a89a7725 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-add-note-action-in-Central-tenant.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-add-note-action-in-Central-tenant.cy.js @@ -83,22 +83,16 @@ describe('Bulk-edit', () => { ]).then((userProperties) => { user = userProperties; - cy.assignAffiliationToUser(Affiliations.College, user.userId); - cy.setTenant(Affiliations.College); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); - cy.assignAffiliationToUser(Affiliations.University, user.userId); - cy.setTenant(Affiliations.University); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditItems.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-change-note-type-action-in-Central-tenant.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-change-note-type-action-in-Central-tenant.cy.js index 66bfc708ce..0fe4479aac 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-change-note-type-action-in-Central-tenant.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-change-note-type-action-in-Central-tenant.cy.js @@ -88,22 +88,16 @@ describe('Bulk-edit', () => { ]).then((userProperties) => { user = userProperties; - cy.assignAffiliationToUser(Affiliations.College, user.userId); - cy.setTenant(Affiliations.College); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); - cy.assignAffiliationToUser(Affiliations.University, user.userId); - cy.setTenant(Affiliations.University); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - - cy.resetTenant(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditItems.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-remove-all-notes-action-in-central-tenant.cy.js b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-remove-all-notes-action-in-central-tenant.cy.js index e604fec0c4..9677db9b59 100644 --- a/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-remove-all-notes-action-in-central-tenant.cy.js +++ b/cypress/e2e/consortia/bulk-edit/in-app/bulk-edit-in-app-items-verify-remove-all-notes-action-in-central-tenant.cy.js @@ -84,20 +84,16 @@ describe('Bulk-edit', () => { ]).then((userProperties) => { user = userProperties; - cy.assignAffiliationToUser(Affiliations.College, user.userId); - cy.setTenant(Affiliations.College); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - cy.resetTenant(); - cy.assignAffiliationToUser(Affiliations.University, user.userId); - cy.setTenant(Affiliations.University); - cy.assignPermissionsToExistingUser(user.userId, [ - permissions.bulkEditEdit.gui, - permissions.uiInventoryViewCreateEditItems.gui, - ]); - cy.resetTenant(); + [Affiliations.College, Affiliations.University].forEach((affiliation) => { + cy.assignAffiliationToUser(affiliation, user.userId); + cy.setTenant(affiliation); + cy.assignPermissionsToExistingUser(user.userId, [ + permissions.bulkEditEdit.gui, + permissions.uiInventoryViewCreateEditItems.gui, + ]); + cy.resetTenant(); + }); + cy.getInstanceTypes({ limit: 1 }).then((instanceTypeData) => { instanceTypeId = instanceTypeData[0].id; }); diff --git a/cypress/e2e/settings/tenant/location-setup.cy.js b/cypress/e2e/settings/tenant/location-setup.cy.js index aff0139603..f4ee06ace6 100644 --- a/cypress/e2e/settings/tenant/location-setup.cy.js +++ b/cypress/e2e/settings/tenant/location-setup.cy.js @@ -1,8 +1,13 @@ +import uuid from 'uuid'; import { Permissions } from '../../../support/dictionary'; import { Locations, ServicePoints } from '../../../support/fragments/settings/tenant'; import TenantPane, { TENANTS } from '../../../support/fragments/settings/tenant/tenantPane'; import TopMenuNavigation from '../../../support/fragments/topMenuNavigation'; import Users from '../../../support/fragments/users/users'; +import Campuses from '../../../support/fragments/settings/tenant/location-setup/campuses'; +import Institutions from '../../../support/fragments/settings/tenant/location-setup/institutions'; +import Libraries from '../../../support/fragments/settings/tenant/location-setup/libraries'; +import getRandomPostfix from '../../../support/utils/stringTools'; describe('Settings: Tenant', () => { const testData = { @@ -15,12 +20,43 @@ describe('Settings: Tenant', () => { cy.createTempUser([Permissions.settingsTenantViewLocation.gui]).then((userProperties) => { testData.user = userProperties; cy.getAdminToken().then(() => { - ServicePoints.createViaApi(testData.servicePoint); - const { institution, location } = Locations.getDefaultLocation({ - servicePointId: testData.servicePoint.id, + testData.institution = Institutions.getDefaultInstitution({ + id: uuid(), + name: `1_autotest_institution_${getRandomPostfix()}`, + }); + testData.campus = Campuses.getDefaultCampuse({ + id: uuid(), + name: `1_autotest_campuse_${getRandomPostfix()}`, + institutionId: testData.institution.id, }); - testData.institution = institution; - testData.location = location; + testData.library = Libraries.getDefaultLibrary({ + id: uuid(), + name: `1_autotest_library_${getRandomPostfix()}`, + campusId: testData.campus.id, + }); + testData.location = { + id: uuid(), + isActive: true, + institutionId: testData.institution.id, + institutionName: testData.institution.name, + campusId: testData.campus.id, + campusName: testData.campus.name, + libraryId: testData.library.id, + libraryName: testData.library.name, + servicePointIds: [testData.servicePoint.id], + name: `1_autotest_location_name_${getRandomPostfix()}`, + code: `1_autotest_location_code_${getRandomPostfix()}`, + discoveryDisplayName: `1_autotest_name_${getRandomPostfix()}`, + primaryServicePoint: testData.servicePoint.id, + }; + + Institutions.createViaApi(testData.institution).then(() => { + Campuses.createViaApi(testData.campus).then(() => { + Libraries.createViaApi(testData.library); + }); + }); + + ServicePoints.createViaApi(testData.servicePoint); Locations.createViaApi(testData.location); }); @@ -44,12 +80,12 @@ describe('Settings: Tenant', () => { () => { cy.intercept('/location-units/institutions*', { locinsts: [testData.institution] }); // Select "Institutions" option on the "Location setup" subsection - const Institutions = TenantPane.selectTenant(TENANTS.INSTITUTIONS); + TenantPane.selectTenant(TENANTS.INSTITUTIONS); Institutions.checkNoActionButtons(); // Select "Campuses" option on the "Location setup" subsection // Select any existing institution from the "Select institution" dropdown - const Campuses = TenantPane.selectTenant(TENANTS.CAMPUSES); + TenantPane.selectTenant(TENANTS.CAMPUSES); Campuses.selectOption('Institution', { name: testData.location.institutionName, id: testData.location.institutionId, @@ -58,7 +94,7 @@ describe('Settings: Tenant', () => { // Select "Libraries" option on the "Location setup" subsection // Select any existing institution from the "Select institution" dropdown - const Libraries = TenantPane.selectTenant(TENANTS.LIBRARIES); + TenantPane.selectTenant(TENANTS.LIBRARIES); Libraries.selectOption('Institution', { name: testData.location.institutionName, id: testData.location.institutionId, diff --git a/cypress/e2e/settings/tenant/service-points-view.cy.js b/cypress/e2e/settings/tenant/service-points-view.cy.js index aee9bba2c0..4f2aa43e70 100644 --- a/cypress/e2e/settings/tenant/service-points-view.cy.js +++ b/cypress/e2e/settings/tenant/service-points-view.cy.js @@ -13,6 +13,7 @@ import ServicePoints from '../../../support/fragments/settings/tenant/servicePoi import SettingsMenu from '../../../support/fragments/settingsMenu'; import TopMenuNavigation from '../../../support/fragments/topMenuNavigation'; import Users from '../../../support/fragments/users/users'; +import getRandomPostfix from '../../../support/utils/stringTools'; describe('Settings: Tenant', () => { const testData = { @@ -27,7 +28,44 @@ describe('Settings: Tenant', () => { ServicePoints.createViaApi(servicePoint); }); - const location = NewLocation.getDefaultLocation(testData.servicePoints[0].id); + const location = { + id: uuid(), + isActive: true, + institutionId: uuid(), + institutionName: `1_autotest_institution_${getRandomPostfix()}`, + campusId: uuid(), + campusName: `1_autotest_campuse_${getRandomPostfix()}`, + libraryId: uuid(), + libraryName: `1_autotest_library_${getRandomPostfix()}`, + servicePointIds: [testData.servicePoints[0].id], + name: `1_autotest_location_name_${getRandomPostfix()}`, + code: `1_autotest_location_code_${getRandomPostfix()}`, + discoveryDisplayName: `1_autotest_name_${getRandomPostfix()}`, + primaryServicePoint: testData.servicePoints[0].id, + }; + + Institutions.createViaApi( + Institutions.getDefaultInstitution({ + id: location.institutionId, + name: location.institutionName, + }), + ).then(() => { + Campuses.createViaApi( + Campuses.getDefaultCampuse({ + id: location.campusId, + name: location.campusName, + institutionId: location.institutionId, + }), + ).then(() => { + Libraries.createViaApi( + Libraries.getDefaultLibrary({ + id: location.libraryId, + name: location.libraryName, + campusId: location.campusId, + }), + ); + }); + }); [...Array(3).keys()].forEach((index) => { testData.locations.push({ diff --git a/cypress/e2e/settings/tenant/tenant-view.cy.js b/cypress/e2e/settings/tenant/tenant-view.cy.js index 3ec76d85ab..95cb0110c4 100644 --- a/cypress/e2e/settings/tenant/tenant-view.cy.js +++ b/cypress/e2e/settings/tenant/tenant-view.cy.js @@ -1,8 +1,13 @@ +import uuid from 'uuid'; import { Permissions } from '../../../support/dictionary'; import { Locations, ServicePoints } from '../../../support/fragments/settings/tenant'; import TenantPane, { TENANTS } from '../../../support/fragments/settings/tenant/tenantPane'; import TopMenuNavigation from '../../../support/fragments/topMenuNavigation'; import Users from '../../../support/fragments/users/users'; +import Campuses from '../../../support/fragments/settings/tenant/location-setup/campuses'; +import Institutions from '../../../support/fragments/settings/tenant/location-setup/institutions'; +import Libraries from '../../../support/fragments/settings/tenant/location-setup/libraries'; +import getRandomPostfix from '../../../support/utils/stringTools'; describe('Settings: Tenant', () => { const testData = { @@ -11,11 +16,42 @@ describe('Settings: Tenant', () => { before('Create test data', () => { cy.getAdminToken(); ServicePoints.createViaApi(testData.servicePoint); - const { institution, location } = Locations.getDefaultLocation({ - servicePointId: testData.servicePoint.id, + + testData.institution = Institutions.getDefaultInstitution({ + id: uuid(), + name: `1_autotest_institution_${getRandomPostfix()}`, + }); + testData.campus = Campuses.getDefaultCampuse({ + id: uuid(), + name: `1_autotest_campuse_${getRandomPostfix()}`, + institutionId: testData.institution.id, + }); + testData.library = Libraries.getDefaultLibrary({ + id: uuid(), + name: `1_autotest_library_${getRandomPostfix()}`, + campusId: testData.campus.id, + }); + testData.location = { + id: uuid(), + isActive: true, + institutionId: testData.institution.id, + institutionName: testData.institution.name, + campusId: testData.campus.id, + campusName: testData.campus.name, + libraryId: testData.library.id, + libraryName: testData.library.name, + servicePointIds: [testData.servicePoint.id], + name: `1_autotest_location_name_${getRandomPostfix()}`, + code: `1_autotest_location_code_${getRandomPostfix()}`, + discoveryDisplayName: `1_autotest_name_${getRandomPostfix()}`, + primaryServicePoint: testData.servicePoint.id, + }; + + Institutions.createViaApi(testData.institution).then(() => { + Campuses.createViaApi(testData.campus).then(() => { + Libraries.createViaApi(testData.library); + }); }); - testData.institution = institution; - testData.location = location; Locations.createViaApi(testData.location); cy.createTempUser([Permissions.settingsTenantView.gui]).then((userProperties) => { testData.user = userProperties; @@ -39,15 +75,13 @@ describe('Settings: Tenant', () => { { tags: ['extendedPath', 'firebird', 'C409487'] }, () => { cy.intercept('/location-units/institutions*', { locinsts: [testData.institution] }); - // reload is needed because sometimes Location setup section is not displayed - cy.reload(); // Select "Institutions" option on the "Location setup" subsection - const Institutions = TenantPane.selectTenant(TENANTS.INSTITUTIONS); + TenantPane.selectTenant(TENANTS.INSTITUTIONS); Institutions.checkNoActionButtons(); // Select "Campuses" option on the "Location setup" subsection // Select any existing institution from the "Select institution" dropdown - const Campuses = TenantPane.selectTenant(TENANTS.CAMPUSES); + TenantPane.selectTenant(TENANTS.CAMPUSES); Campuses.selectOption('Institution', { name: testData.location.institutionName, id: testData.location.institutionId, @@ -56,7 +90,7 @@ describe('Settings: Tenant', () => { // Select "Libraries" option on the "Location setup" subsection // Select any existing institution from the "Select institution" dropdown - const Libraries = TenantPane.selectTenant(TENANTS.LIBRARIES); + TenantPane.selectTenant(TENANTS.LIBRARIES); Libraries.selectOption('Institution', { name: testData.location.institutionName, id: testData.location.institutionId, diff --git a/cypress/support/fragments/bulk-edit/bulk-edit-actions.js b/cypress/support/fragments/bulk-edit/bulk-edit-actions.js index 8a0c78d8f5..a388d00416 100644 --- a/cypress/support/fragments/bulk-edit/bulk-edit-actions.js +++ b/cypress/support/fragments/bulk-edit/bulk-edit-actions.js @@ -1255,6 +1255,14 @@ export default { }); }, + checkTypeExists(type, rowIndex = 0, whichSelect = 0) { + cy.get(`[class^="repeatableField"]:eq(${rowIndex}) #urlRelationship`) + .eq(whichSelect) + .then(($select) => { + expect($select.text()).to.contain(type); + }); + }, + verifyCheckboxAbsent() { cy.expect(Checkbox().absent()); },