Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAT-10473/C411578 #3248

Merged
merged 4 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,354 @@
import { Locations } from '../../../../support/fragments/settings/tenant/location-setup';
import ServicePoints from '../../../../support/fragments/settings/tenant/servicePoints/servicePoints';
import Permissions from '../../../../support/dictionary/permissions';
import Affiliations, { tenantNames } from '../../../../support/dictionary/affiliations';
import Users from '../../../../support/fragments/users/users';
import TopMenu from '../../../../support/fragments/topMenu';
import InventoryInstances from '../../../../support/fragments/inventory/inventoryInstances';
import InventoryInstance from '../../../../support/fragments/inventory/inventoryInstance';
import ConsortiumManager from '../../../../support/fragments/settings/consortium-manager/consortium-manager';
import getRandomPostfix from '../../../../support/utils/stringTools';
import DataImport from '../../../../support/fragments/data_import/dataImport';
import InventorySearchAndFilter from '../../../../support/fragments/inventory/inventorySearchAndFilter';
import Location from '../../../../support/fragments/settings/tenant/locations/newLocation';
import InventoryHoldings from '../../../../support/fragments/inventory/holdings/inventoryHoldings';
import BrowseContributors from '../../../../support/fragments/inventory/search/browseContributors';

describe('Inventory', () => {
describe('Search in Inventory', () => {
const users = {};
const createdHoldingsCollege = [];
const createdHoldingsUniversity = [];
const searchValue = 'C411578 Contributor';
const testData = {
servicePoint: ServicePoints.getDefaultServicePointWithPickUpLocation(),
};
const locationName = `C411578 Location / ${getRandomPostfix()}`;
const sharedFOLIOInstancesFromCentral = [
{
title: 'C411578 Instance 4 Shared FOLIO',
contributorName: 'C411578 Contributor 4',
},
{
title: 'C411578 Instance 5 Shared FOLIO with Holdings',
contributorName: 'C411578 Contributor 5',
},
{
title: 'C411578 Instance 6 Shared FOLIO with Holdings',
contributorName: 'C411578 Contributor 6',
},
];
const localFOLIOInstanceFromMember1 = {
title: 'C411578 Instance 7 Local FOLIO with Holdings',
contributorName: 'C411578 Contributor 7',
};
const localFOLIOInstanceFromMember2 = {
title: 'C411578 Instance 9 Local FOLIO with Holdings',
contributorName: 'C411578 Contributor 9',
};
const sharedMarcTitle1 = 'C411578 Instance 1 Shared MARC';
const sharedMarcTitle2 = 'C411578 Instance 2 Shared MARC with Holdings';
const sharedMarcTitle3 = 'C411578 Instance 3 Shared MARC with Holdings';
const localSharedMarcTitle = 'C411578 Instance 8 Local MARC with Holdings';

const createdRecordsIds = [];

const marcFiles = [
{
marc: 'marcBibFileForC411578-Shared.mrc',
fileName: `C411578 Central testMarcFile${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create instance and SRS MARC Bib',
propertyName: 'relatedInstanceInfo',
tenant: tenantNames.central,
numOfRecords: 3,
},
{
marc: 'marcBibFileForC411578-Local-M1.mrc',
fileName: `C411578 Member1 testMarcFile${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create instance and SRS MARC Bib',
propertyName: 'relatedInstanceInfo',
tenant: tenantNames.college,
numOfRecords: 1,
},
{
marc: 'marcBibFileForC411578-Local-M2.mrc',
fileName: `C411578 Member2 testMarcFile${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create instance and SRS MARC Bib',
propertyName: 'relatedInstanceInfo',
tenant: tenantNames.university,
numOfRecords: 1,
},
];

before('Create user, data', () => {
cy.getAdminToken();
cy.createTempUser([Permissions.uiInventoryViewInstances.gui]).then((userProperties) => {
users.userProperties = userProperties;

cy.assignAffiliationToUser(Affiliations.College, users.userProperties.userId);
cy.setTenant(Affiliations.College);
cy.assignPermissionsToExistingUser(users.userProperties.userId, [
Permissions.uiInventoryViewInstances.gui,
])
.then(() => {
cy.resetTenant();
cy.getAdminToken();

ServicePoints.createViaApi(testData.servicePoint);
testData.defaultLocation = Location.getDefaultLocation(testData.servicePoint.id);
Location.createViaApi({ ...testData.defaultLocation, name: locationName });

BrowseContributors.getContributorNameTypes().then((contributorNameTypes) => {
testData.contributorNameType = contributorNameTypes[0].id;
});

cy.getInstanceTypes({ limit: 1 }).then((instanceTypes) => {
testData.instanceTypeId = instanceTypes[0].id;
});

cy.getHoldingTypes({ limit: 1 }).then((res) => {
testData.holdingTypeId = res[0].id;
});
})
.then(() => {
sharedFOLIOInstancesFromCentral.forEach((sharedFOLIOInstance) => {
InventoryInstances.createFolioInstanceViaApi({
instance: {
instanceTypeId: testData.instanceTypeId,
title: sharedFOLIOInstance.title,
contributors: [
{
name: sharedFOLIOInstance.contributorName,
contributorNameTypeId: testData.contributorNameType,
},
],
},
}).then((specialInstanceIds) => {
sharedFOLIOInstance.testInstanceId = specialInstanceIds.instanceId;
});
});
})
.then(() => {
cy.setTenant(Affiliations.College);

BrowseContributors.getContributorNameTypes().then((contributorNameTypes) => {
testData.contributorNameTypeCollege = contributorNameTypes[0].id;
});

const collegeLocationData = Locations.getDefaultLocation({
servicePointId: ServicePoints.getDefaultServicePoint().id,
}).location;
Locations.createViaApi(collegeLocationData).then((location) => {
testData.collegeLocation = location;
InventoryInstances.createFolioInstanceViaApi({
instance: {
instanceTypeId: testData.instanceTypeId,
title: localFOLIOInstanceFromMember1.title,
contributors: [
{
name: localFOLIOInstanceFromMember1.contributorName,
contributorNameTypeId: testData.contributorNameTypeCollege,
},
],
},
holdings: [
{
holdingsTypeId: testData.holdingTypeId,
permanentLocationId: testData.collegeLocation.id,
},
],
}).then((specialInstanceIds) => {
localFOLIOInstanceFromMember1.testInstanceId = specialInstanceIds.instanceId;
createdHoldingsCollege.push(specialInstanceIds.holdingIds[0].id);
});
});
})
.then(() => {
cy.setTenant(Affiliations.University);

BrowseContributors.getContributorNameTypes().then((contributorNameTypes) => {
testData.contributorNameTypeUniversity = contributorNameTypes[0].id;
});

const universityLocationData = Locations.getDefaultLocation({
servicePointId: ServicePoints.getDefaultServicePoint().id,
}).location;
Locations.createViaApi(universityLocationData).then((location) => {
testData.universityLocation = location;

InventoryInstances.createFolioInstanceViaApi({
instance: {
instanceTypeId: testData.instanceTypeId,
title: localFOLIOInstanceFromMember2.title,
contributors: [
{
name: localFOLIOInstanceFromMember2.contributorName,
contributorNameTypeId: testData.contributorNameTypeUniversity,
},
],
},
holdings: [
{
holdingsTypeId: testData.holdingTypeId,
permanentLocationId: testData.universityLocation.id,
},
],
}).then((specialInstanceIds) => {
localFOLIOInstanceFromMember2.testInstanceId = specialInstanceIds.instanceId;
createdHoldingsUniversity.push(specialInstanceIds.holdingIds[0].id);
});
});
})
.then(() => {
cy.loginAsAdmin({ path: TopMenu.dataImportPath, waiter: DataImport.waitLoading }).then(
() => {
cy.resetTenant();
cy.getAdminToken();
DataImport.uploadFileViaApi(
marcFiles[0].marc,
marcFiles[0].fileName,
marcFiles[0].jobProfileToRun,
).then((response) => {
response.entries.forEach((record) => {
createdRecordsIds.push(record[marcFiles[0].propertyName].idList[0]);
});
});

cy.setTenant(Affiliations.College);
DataImport.uploadFileViaApi(
marcFiles[1].marc,
marcFiles[1].fileName,
marcFiles[1].jobProfileToRun,
).then((response) => {
response.entries.forEach((record) => {
createdRecordsIds.push(record[marcFiles[1].propertyName].idList[0]);
});
});

cy.setTenant(Affiliations.University);
DataImport.uploadFileViaApi(
marcFiles[2].marc,
marcFiles[2].fileName,
marcFiles[2].jobProfileToRun,
).then((response) => {
response.entries.forEach((record) => {
createdRecordsIds.push(record[marcFiles[2].propertyName].idList[0]);
});
});
},
);
})
.then(() => {
cy.setTenant(Affiliations.College);

InventoryHoldings.createHoldingRecordViaApi({
instanceId: sharedFOLIOInstancesFromCentral[1].testInstanceId,
permanentLocationId: testData.collegeLocation.id,
}).then((holding) => {
createdHoldingsCollege.push(holding.id);
});
InventoryHoldings.createHoldingRecordViaApi({
instanceId: createdRecordsIds[1],
permanentLocationId: testData.collegeLocation.id,
}).then((holding) => {
createdHoldingsCollege.push(holding.id);
});
InventoryHoldings.createHoldingRecordViaApi({
instanceId: createdRecordsIds[3],
permanentLocationId: testData.collegeLocation.id,
}).then((holding) => {
createdHoldingsCollege.push(holding.id);
});
})
.then(() => {
cy.setTenant(Affiliations.University);

InventoryHoldings.createHoldingRecordViaApi({
instanceId: sharedFOLIOInstancesFromCentral[2].testInstanceId,
permanentLocationId: testData.universityLocation.id,
}).then((holding) => {
createdHoldingsUniversity.push(holding.id);
});
InventoryHoldings.createHoldingRecordViaApi({
instanceId: createdRecordsIds[2],
permanentLocationId: testData.universityLocation.id,
}).then((holding) => {
createdHoldingsUniversity.push(holding.id);
});
InventoryHoldings.createHoldingRecordViaApi({
instanceId: createdRecordsIds[4],
permanentLocationId: testData.universityLocation.id,
}).then((holding) => {
createdHoldingsUniversity.push(holding.id);
});
});

cy.login(users.userProperties.username, users.userProperties.password, {
path: TopMenu.inventoryPath,
waiter: InventoryInstances.waitContentLoading,
}).then(() => {
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.central);
ConsortiumManager.switchActiveAffiliation(tenantNames.central, tenantNames.college);
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.college);
InventorySearchAndFilter.instanceTabIsDefault();
});
});
});

after('Delete user, data', () => {
// delete test data from the Central
cy.resetTenant();
cy.getAdminToken();
Users.deleteViaApi(users.userProperties.userId);
sharedFOLIOInstancesFromCentral.forEach((sharedInstance) => {
InventoryInstance.deleteInstanceViaApi(sharedInstance.testInstanceId);
});
for (let i = 0; i < 3; i++) {
InventoryInstance.deleteInstanceViaApi(createdRecordsIds[i]);
}
ServicePoints.deleteViaApi(testData.servicePoint.id);
Locations.deleteViaApi(testData.defaultLocation);

// delete test data from the College
cy.setTenant(Affiliations.College);
createdHoldingsCollege.forEach((collegeHoldingId) => {
InventoryHoldings.deleteHoldingRecordViaApi(collegeHoldingId);
});
InventoryInstance.deleteInstanceViaApi(localFOLIOInstanceFromMember1.testInstanceId);
InventoryInstance.deleteInstanceViaApi(createdRecordsIds[3]);
InventoryInstance.deleteInstanceViaApi(sharedFOLIOInstancesFromCentral[1].testInstanceId);
InventoryInstance.deleteInstanceViaApi(createdRecordsIds[1]);
Locations.deleteViaApi(testData.collegeLocation);

// delete test data from the University
cy.setTenant(Affiliations.University);
createdHoldingsUniversity.forEach((universityHoldingId) => {
InventoryHoldings.deleteHoldingRecordViaApi(universityHoldingId);
});
InventoryInstance.deleteInstanceViaApi(localFOLIOInstanceFromMember2.testInstanceId);
InventoryInstance.deleteInstanceViaApi(sharedFOLIOInstancesFromCentral[2].testInstanceId);
InventoryInstance.deleteInstanceViaApi(createdRecordsIds[4]);
InventoryInstance.deleteInstanceViaApi(createdRecordsIds[2]);
Locations.deleteViaApi(testData.universityLocation);
});

it(
'C411578 Search for Shared/Local records by "Contributor" search option from "Member" tenant (consortia) (spitfire)',
{ tags: ['criticalPathECS', 'spitfire'] },
() => {
InventorySearchAndFilter.selectSearchOptions('Contributor', searchValue);
InventorySearchAndFilter.verifySelectedSearchOption('contributor');
InventorySearchAndFilter.clickSearch();

InventorySearchAndFilter.verifySearchResult(sharedMarcTitle1);
InventorySearchAndFilter.verifySearchResult(sharedMarcTitle2);
InventorySearchAndFilter.verifySearchResult(sharedMarcTitle3);
InventorySearchAndFilter.verifySearchResult(sharedFOLIOInstancesFromCentral[0].title);
InventorySearchAndFilter.verifySearchResult(sharedFOLIOInstancesFromCentral[1].title);
InventorySearchAndFilter.verifySearchResult(sharedFOLIOInstancesFromCentral[2].title);
InventorySearchAndFilter.verifySearchResult(localFOLIOInstanceFromMember1.title);
InventorySearchAndFilter.verifySearchResult(localSharedMarcTitle);
},
);
});
});
1 change: 1 addition & 0 deletions cypress/fixtures/marcBibFileForC411578-Local-M1.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
02328cam a2200457 i 45000010011000000030006000110050017000170080041000340100017000750400067000920200047001590200044002060350022002500420008002720430021002800500022003010820016003231100035003392450048003742640098004223000030005203360026005503370028005763380027006044900043006315040051006745050419007256500026011446510038011706500079012086500044012876500052013316500051013836510038014346510068014726480018015406550039015587760142015978300044017399800087017831030445503OCoLC20180508153630.4180304s2018 enkab b 001 0 eng c a 2017032581 aLBSOR/DLCbengerdacDLCdOCLCQdBDXdYDXdOCLCOdOCLCQdOCLCF a9781138088481q(hardcoverqalkaline paper) a113808848Xq(hardcoverqalkaline paper) a(OCoLC)1030445503 apcc ae-gr---aa-tu---00aDF220b.W285 201800a938/.012231 aC411578 Contributor 8eauthor.10aC411578 Instance 8 Local MARC with Holdings 1aAbingdon, Oxon ;aNew York, NY :bRoutledge, an imprint of the Taylor & Francis Group,c2018. axxix, 504 pages ;c24 cm. atextbtxt2rdacontent aunmediatedbn2rdamedia avolumebnc2rdacarrier1 aRoutledge studies in archaeology ;v29 aIncludes bibliographical references and index.0 aImagining movement -- Movement as explanation : the heritage -- Movement, "Anatolianising" culture and Aegean social change c. 3500-2300 BC -- Crete and Cretans in the Mediterranean, 18th to 16th centuries BC -- "Aegean" expansion : new dynamics, new boundaries in the later Iba -- Myth and movement from c. 1200 BC -- Later Iron Age Aegean movement and "Greek colonisation" -- Conclusions : movement disassembled. 0aCivilization, Aegean. 0aGreecexCivilizationyTo 146 B.C. 0aMigration, InternalzAegean Islands (Greece and Turkey)xHistoryyTo 1500. 7aCivilization.2fast0(OCoLC)fst00862898 7aCivilization, Aegean.2fast0(OCoLC)fst00862943 7aMigration, Internal.2fast0(OCoLC)fst01020741 7aGreece.2fast0(OCoLC)fst01208380 7aMediterranean RegionzAegean Islands.2fast0(OCoLC)fst01310032 7aTo 15002fast 7aHistory.2fast0(OCoLC)fst0141162808iOnline version:aWallace, Saro, 1973-tTravellers in time.dAbingdon, Oxon ; New York : Routledge, 2018z9781315109831w(DLC) 2018015636 0aRoutledge studies in archaeology ;v29. a40028236036bCLA2cGendJRLeYBPg509551h606337i180611lClothm140.00q1j140.00
1 change: 1 addition & 0 deletions cypress/fixtures/marcBibFileForC411578-Local-M2.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
01340cam a2200361Ii 45000010011000000030006000110050017000170080041000340400052000750190015001270200027001420200030001690200030001990200027002290350041002560500022002970820014003191000036003332450049003692640037004183000052004553360026005073370028005333380027005614900019005885040067006075050138006746500014008126500011008266500036008378300020008739800085008931008987764OCoLC20180517120657.4171104s2018 enkag b 001 0 eng d aYDXbengerdacYDXdBDXdCHVBKdOCLCOdCDXdJHP a1008990200 a099319835Xq(softback) a9780993198359q(softback) a9780993198342q(hardback) a0993198341q(hardback) a(OCoLC)1008987764z(OCoLC)1008990200 4aML1700b.W56 201804a782.12231 aC411578 Contributor 10eauthor.10aC411578 Instance 10 Local MARC with Holdings 1aLondon :bPlumbago Books,c2018. axv, 271 pages :billustrations, music ;c24 cm. atextbtxt2rdacontent aunmediatedbn2rdamedia avolumebnc2rdacarrier1 aDefining opera aIncludes bibliographical references (pages 260-265) and index.0 a1. Sources -- 2. Genre -- 3. Style -- Interlude: Revision -- 4. Beginning and end -- 5. Invention -- 6. Psychology -- 7. Performance. 7aOper2gnd 0aOpera. 7aOpera2fast0(OCoLC)fst01046145 0aDefining opera. a40028236035bMUS2cGendJRLeYBPg509551h606337i180611lClothm80.00q1j80.00
Loading
Loading