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-10472/C411611 #3234

Merged
merged 3 commits into from
Feb 22, 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,246 @@
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 JobProfiles from '../../../../support/fragments/data_import/job_profiles/jobProfiles';
import Logs from '../../../../support/fragments/data_import/logs/logs';
import { JOB_STATUS_NAMES } from '../../../../support/constants';
import InventorySearchAndFilter from '../../../../support/fragments/inventory/inventorySearchAndFilter';
import Location from '../../../../support/fragments/settings/tenant/locations/newLocation';
import InventoryHoldings from '../../../../support/fragments/inventory/holdings/inventoryHoldings';

describe('Inventory', () => {
describe('Search in Inventory', () => {
const users = {};
const createdHoldingsCollege = [];
const searchValue = 'C411611 Alternative title';
const alternativeTitleTypeName = `C411611 Title type${getRandomPostfix()}`;
const testData = {
servicePoint: ServicePoints.getDefaultServicePointWithPickUpLocation(),
};
const locationName = `C411611 Location / ${getRandomPostfix()}`;
const sharedFOLIOInstancesFromCentral = [
{
title: 'C411611 Instance 3 Shared FOLIO',
alternativeTitle: 'C411611 Alternative title 3',
},
{
title: 'C411611 Instance 4 Shared FOLIO with Holdings',
alternativeTitle: 'C411611 Alternative title 4',
},
];
const localFOLIOInstanceFromMember = {
title: 'C411611 Instance 5 Local FOLIO with Holdings',
alternativeTitle: 'C411611 Alternative title 5',
};
const sharedMarcTitle1 = 'C411611 Instance 1 Shared MARC';
const sharedMarcTitle2 = 'C411611 Instance 2 Shared MARC with Holdings';

const marcFiles = [
{
marc: 'marcBibFileForC411611-Shared.mrc',
fileName: `C411611 Central testMarcFile${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create instance and SRS MARC Bib',
tenant: tenantNames.central,
numOfRecords: 2,
createdRecordsId: [],
},
{
marc: 'marcBibFileForC411611-Local.mrc',
fileName: `C411611 Member1 testMarcFile${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create instance and SRS MARC Bib',
tenant: tenantNames.college,
numOfRecords: 1,
createdRecordsId: [],
},
];

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

cy.resetTenant();
cy.getAdminToken();

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

InventoryInstance.createAlternativeTitleTypeViaAPI(alternativeTitleTypeName).then(
(alternativeTitleTypeID) => {
testData.alternativeTitleTypeID = alternativeTitleTypeID;
},
);

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,
alternativeTitles: [
{
alternativeTitleTypeId: testData.alternativeTitleTypeID,
alternativeTitle: sharedFOLIOInstance.alternativeTitle,
},
],
},
}).then((specialInstanceIds) => {
sharedFOLIOInstance.testInstanceId = specialInstanceIds.instanceId;
});
});
})
.then(() => {
cy.setTenant(Affiliations.College);

InventoryInstance.createAlternativeTitleTypeViaAPI(alternativeTitleTypeName).then(
(alternativeTitleTypeID) => {
testData.alternativeTitleTypeIDCollege = alternativeTitleTypeID;
},
);

const collegeLocationData = Locations.getDefaultLocation({
servicePointId: ServicePoints.getDefaultServicePoint().id,
}).location;
Locations.createViaApi(collegeLocationData).then((location) => {
testData.collegeLocation = location;
InventoryInstances.createFolioInstanceViaApi({
instance: {
instanceTypeId: testData.instanceTypeId,
title: localFOLIOInstanceFromMember.title,
alternativeTitles: [
{
alternativeTitleTypeId: testData.alternativeTitleTypeIDCollege,
alternativeTitle: localFOLIOInstanceFromMember.alternativeTitle,
},
],
},
holdings: [
{
holdingsTypeId: testData.holdingTypeId,
permanentLocationId: testData.collegeLocation.id,
},
],
}).then((specialInstanceIds) => {
localFOLIOInstanceFromMember.testInstanceId = specialInstanceIds.instanceId;
createdHoldingsCollege.push(specialInstanceIds.holdingIds[0].id);
});
});
})
.then(() => {
cy.loginAsAdmin({ path: TopMenu.dataImportPath, waiter: DataImport.waitLoading }).then(
() => {
marcFiles.forEach((marcFile) => {
cy.visit(TopMenu.dataImportPath);
if (marcFile.tenant === 'College') {
ConsortiumManager.switchActiveAffiliation(
tenantNames.central,
tenantNames.college,
);
}
DataImport.verifyUploadState();
DataImport.uploadFileAndRetry(marcFile.marc, marcFile.fileName);
JobProfiles.waitLoadingList();
JobProfiles.search(marcFile.jobProfileToRun);
JobProfiles.runImportFile();
Logs.waitFileIsImported(marcFile.fileName);
Logs.checkJobStatus(marcFile.fileName, JOB_STATUS_NAMES.COMPLETED);
Logs.openFileDetails(marcFile.fileName);
for (let i = 0; i < marcFile.numOfRecords; i++) {
Logs.getCreatedItemsID(i).then((link) => {
marcFile.createdRecordsId.push(link.split('/')[5]);
});
}
});
},
);
})
.then(() => {
cy.setTenant(Affiliations.College);

InventoryHoldings.createHoldingRecordViaApi({
instanceId: sharedFOLIOInstancesFromCentral[1].testInstanceId,
permanentLocationId: testData.collegeLocation.id,
}).then((holding) => {
createdHoldingsCollege.push(holding.id);
});
InventoryHoldings.createHoldingRecordViaApi({
instanceId: marcFiles[0].createdRecordsId[1],
permanentLocationId: testData.collegeLocation.id,
}).then((holding) => {
createdHoldingsCollege.push(holding.id);
});
InventoryHoldings.createHoldingRecordViaApi({
instanceId: marcFiles[1].createdRecordsId[0],
permanentLocationId: testData.collegeLocation.id,
}).then((holding) => {
createdHoldingsCollege.push(holding.id);
});

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

after('Delete user, data', () => {
cy.resetTenant();
cy.getAdminToken();
Users.deleteViaApi(users.userProperties.userId);
sharedFOLIOInstancesFromCentral.forEach((sharedInstance) => {
InventoryInstance.deleteInstanceViaApi(sharedInstance.testInstanceId);
});
marcFiles[0].createdRecordsId.forEach((id) => {
InventoryInstance.deleteInstanceViaApi(id);
});
ServicePoints.deleteViaApi(testData.servicePoint.id);
Locations.deleteViaApi(testData.defaultLocation);
cy.deleteAlternativeTitleTypes(testData.alternativeTitleTypeID);

cy.setTenant(Affiliations.College);
createdHoldingsCollege.forEach((collegeHoldingId) => {
InventoryHoldings.deleteHoldingRecordViaApi(collegeHoldingId);
});
InventoryInstance.deleteInstanceViaApi(localFOLIOInstanceFromMember.testInstanceId);
InventoryInstance.deleteInstanceViaApi(marcFiles[1].createdRecordsId[0]);
InventoryInstance.deleteInstanceViaApi(sharedFOLIOInstancesFromCentral[1].testInstanceId);
InventoryInstance.deleteInstanceViaApi(marcFiles[0].createdRecordsId[1]);
Locations.deleteViaApi(testData.collegeLocation);
cy.deleteAlternativeTitleTypes(testData.alternativeTitleTypeIDCollege);
});

it(
'C411611 Search for Shared/Local records by "Title (all)" search option from "Central" tenant (consortia) (spitfire)',
{ tags: ['criticalPathECS', 'spitfire'] },
() => {
InventorySearchAndFilter.selectSearchOptions('Title (all)', searchValue);
InventorySearchAndFilter.verifySelectedSearchOption('title');
InventorySearchAndFilter.clickSearch();
InventorySearchAndFilter.verifySearchResult(sharedMarcTitle1);
InventorySearchAndFilter.verifySearchResult(sharedMarcTitle2);
InventorySearchAndFilter.verifySearchResult(sharedFOLIOInstancesFromCentral[0].title);
InventorySearchAndFilter.verifySearchResult(sharedFOLIOInstancesFromCentral[1].title);
},
);
});
});
1 change: 1 addition & 0 deletions cypress/fixtures/marcBibFileForC411611-Local.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
02576cam a22006018i 4500001001300000003000600013005001700019008004100036010001700077040014500094019005100239020003000290020002700320020002700347020003000374020002700404035009800431042000800529043001200537082002100549092001900570049000900589100003400598240003200632245004800664246003800712250001900750264005900769264001100828300005600839336002600895336003300921337002800954338002700982521005001009520014601059504004101205650006301246651005201309650005301361650007301414650005601487650008001543650004001623651005801663651006801721655004601789655003201835655002701867655002601894700004201920994001201962on1236091286OCoLC20220907043246.0210405t20212021nyua j 000 0 eng  a 2021015085 aDLCbengerdacDLCdBDXdYDXdOCLCOdOCLCFdUKMGBdOCLCOdOQXdGO3dOCOdNYPdEHHdILCdFSPdTCHdUAPdZ#6dJTHdOCLCOdIHXdDLCdTXHLSdMOU a1236091531a1290948810a1291451361a1292926713 a9780593305638q(hardback) a0593305639q(hardback) z9780593305652q(ebook) a9780593305645q(hardback) a0593305647q(hardback) a(OCoLC)1236091286z(OCoLC)1236091531z(OCoLC)1290948810z(OCoLC)1291451361z(OCoLC)1292926713 apcc an-us-ny00a782.1/409747223 a421.1bAL568bb aMOUC1 aAllman, John Robert,eauthor. aC411611 Alternative title 610aC411611 Instance 6 Local MARC with Holdings30aOnstage and backstage from A to Z aFirst edition. 1aNew York :bDoubleday Books for Young Readers,c[2021] 4c©2021 a47 unnumbered pages :bcolor illustrations ;c29 cm atextbtxt2rdacontent astill imagebsti2rdacontent aunmediatedbn2rdamedia avolumebnc2rdacarrier1 aAges 4-8.bDoubleday Books for Young Readers. a"An alphabetical celebration of American musical theater, featuring onstage stars and backstage creators and crew."--cProvided by publisher. aIncludes bibliographical references. 0aMusicalszNew York (State)zNew YorkvJuvenile literature. 0aBroadway (New York, N.Y.)vJuvenile literature. 0aEnglish languagexAlphabetvJuvenile literature. 7aJUVENILE NONFICTION / Performing Arts / Theater & Musicals.2bisacsh 7aJUVENILE NONFICTION / Concepts / Alphabet.2bisacsh 7aJUVENILE NONFICTION / Biography & Autobiography / Performing Arts.2bisacsh 7aMusicals.2fast0(OCoLC)fst01030814 7aNew York (State)zNew York.2fast0(OCoLC)fst01204333 7aNew York (State)zNew YorkzBroadway.2fast0(OCoLC)fst01316843 7aJuvenile works.2fast0(OCoLC)fst01411637 7aInformational works.2lcgft 7aAlphabet books.2lcgft 7aPicture books.2lcgft1 aEmmerich, Peter,d1973-eillustrator. aC0bMOU
1 change: 1 addition & 0 deletions cypress/fixtures/marcBibFileForC411611-Shared.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
02186cam a2200529 i 4500001001300000003000600013005001700019008004100036010001700077040005000094019007500144020003700219020001500256020003700271020001500308020002700323035013600350042000800486082001800494092002000512049000900532100003300541240003200574245003500606264003800641264001100679300004700690336002600737337002800763338002700791490003400818500008200852500002900934520009000963504006201053521004601115505017901161650003901340650003401379650004401413650003901457655004601496700003401542700003301576830003501609994001201644on1258218322OCoLC20220907043246.0210913s2022 nyuab j b 001 0 eng  a 2021044059 aDLCbengerdacDLCdFHPdOCLCFdLMJdCDSdMOU a1258219196a1287259197a1289261696a1289928374a1291626102a1308746037 a9781984893260q(trade paperback) a1984893262 a9781984893277q(library binding) a1984893270 z9781984893284q(ebook) a(OCoLC)1258218322z(OCoLC)1258219196z(OCoLC)1287259197z(OCoLC)1289261696z(OCoLC)1289928374z(OCoLC)1291626102z(OCoLC)1308746037 apcc00a599.75/55223 a599.7555bOs17s aMOUC1 aOsborne, Mary Pope,eauthor. aC411611 Alternative title 110aC411611 Instance 1 Shared MARC 1aNew York :bRandom House,c[2022] 4c©2022 a123 pages :billustrations, maps ;c20 cm. atextbtxt2rdacontent aunmediatedbn2rdamedia avolumebnc2rdacarrier1 aMagic tree house fact tracker aA nonfiction companion to Magic Tree House #36: Sunlight on the snow leopard. a"A Stepping Stone book." a"A nonfiction book about snow leopards and other wild cats"--cProvided by publisher. aIncludes bibliographical references (page 118) and index. aAges 7-10bRandom House Children's Books.0 aCats of the world -- Snow leopards -- Ghosts of the mountains -- Tigers -- African lions -- Leopards and jaguars -- Small wild cats -- Wild cats today -- Doing more research. 0aSnow leopardvJuvenile literature. 0aWildcatvJuvenile literature. 7aSnow leopard.2fast0(OCoLC)fst01121959 7aWildcat.2fast0(OCoLC)fst01175149 7aJuvenile works.2fast0(OCoLC)fst014116371 aLaird, Jenny,d1969-eauthor.1 aMones, Isidre,eillustrator. 0aMagic tree house fact tracker. aC0bMOU02419cam a22005658i 4500001001300000003000600013005001700019008004100036010001700077040009600094019001500190020003100205020002800236020003700264020003400301020002700335035004100362042001400403082001500417092001700432049000900449100002700458240003200485245004900517250001900566264005500585264001100640300006100651336002600712336003300738337002800771338002700799504004100826520027100867521004501138521004701183650004501230650005901275650007101334650006501405650006401470650007601534650003901610655004101649655004601690655002201736655003001758700005301788994001201841on1267401937OCoLC20220907043246.0210902t20222022nyua j b 000 0 eng  a 2021043162 aDLCbengerdacDLCdOCLCOdOCLCFdBDXdYDXdOCLCOdOCOdON8dIFKdUAHdOQXdTOHdTXHLSdMOU a1314389073 a9780593372463q(hardcover) a0593372468q(hardcover) a9780593372470q(library binding) a0593372476q(library binding) z9780593372487q(ebook) a(OCoLC)1267401937z(OCoLC)1314389073 apccalcac00a597.92223 a597.92bB69o aMOUC1 aBoxer, Elisa,eauthor. aC411611 Alternative title 210aC411611 Instance 2 Shared MARC with Holdings aFirst edition. 1aNew York :bCrown Books for Young Readers,c[2022] 4c©2022 a31 unnumbered pages :bcolor illustrations ;c24 X 29 cm atextbtxt2rdacontent astill imagebsti2rdacontent aunmediatedbn2rdamedia avolumebnc2rdacarrier aIncludes bibliographical references. a"Based on the viral video that set a movement in motion, this heartwrenching story of one turtle's rescue reminds us that even the smallest straw can hurt our ocean life--and that the smallest demand for change can grow into something big!"--cProvided by publisher. aAges 4-8bCrown Books for Young Readers. aGrades K-1bCrown Books for Young Readers. 0aTurtlesvAnecdotesvJuvenile literature. 0aMarine biodiversity conservationvJuvenile literature. 0aPlastic marine debrisxEnvironmental aspectsvJuvenile literature. 0aDrinking strawsxEnvironmental aspectsvJuvenile literature. 7aMarine biodiversity conservation.2fast0(OCoLC)fst01430716 7aPlastic marine debrisxEnvironmental aspects.2fast0(OCoLC)fst01066495 7aTurtles.2fast0(OCoLC)fst01159689 7aAnecdotes.2fast0(OCoLC)fst01423876 7aJuvenile works.2fast0(OCoLC)fst01411637 7aAnecdotes.2lcgft 7aIllustrated works.2lcgft1 aÁlvarez Miguéns, Marta,d1976-eillustrator. aC0bMOU
Loading