Skip to content

Commit

Permalink
added test C407654 (#2956)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherzod-Kenjaev committed Jan 5, 2024
1 parent 2a3e32c commit f608fac
Show file tree
Hide file tree
Showing 6 changed files with 234 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import DataImport from '../../support/fragments/data_import/dataImport';
import Logs from '../../support/fragments/data_import/logs/logs';
import JobProfiles from '../../support/fragments/data_import/job_profiles/jobProfiles';

describe('MARC -> MARC Bibliographic -> Create new MARC bib -> Consortia', () => {
describe('MARC -> MARC Bibliographic -> Create new MARC bib -> Manual linking -> Consortia', () => {
const testData = {
tags: {
tag245: '245',
Expand Down
214 changes: 214 additions & 0 deletions cypress/e2e/consortia/update-local-linked-marc-auth-in-member.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
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 getRandomPostfix from '../../support/utils/stringTools';
import InventoryInstance from '../../support/fragments/inventory/inventoryInstance';
import DataImport from '../../support/fragments/data_import/dataImport';
import { JOB_STATUS_NAMES } from '../../support/constants';
import JobProfiles from '../../support/fragments/data_import/job_profiles/jobProfiles';
import Logs from '../../support/fragments/data_import/logs/logs';
import QuickMarcEditor from '../../support/fragments/quickMarcEditor';
import ConsortiumManager from '../../support/fragments/settings/consortium-manager/consortium-manager';
import MarcAuthority from '../../support/fragments/marcAuthority/marcAuthority';
import MarcAuthorities from '../../support/fragments/marcAuthority/marcAuthorities';
import InventorySearchAndFilter from '../../support/fragments/inventory/inventorySearchAndFilter';

describe('MARC -> MARC Authority -> Edit linked Authority record -> Consortia', () => {
const testData = {
authorityTitle: 'C407654 Lentz Local M1',
tag100: '100',
instanceTitle: 'C407654 Instance Local M1',
updated100FieldValue: 'C407654 Lentz Local M1 (Updated in M1)',
authoritySearchOption: 'Keyword',
instanceSearchOption: 'Keyword (title, contributor, identifier, HRID, UUID)',
};

const linkingTagAndValues = {
authorityHeading: 'C407654 Lentz Local M1',
rowIndex: 16,
tag: '100',
secondBox: '1',
thirdBox: '\\',
content: '$a C407654 Lentz Local M1 (Updated in M1)',
eSubfield: '',
zeroSubfield: '$0 id.loc.gov/authorities/names/n2011049161407654',
seventhBox: '',
};

const users = {};

const marcFiles = [
{
marc: 'marcBibFileForC407654.mrc',
fileNameImported: `testMarcFileC397343.${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create instance and SRS MARC Bib',
},
{
marc: 'marcAuthFileForC407654.mrc',
fileNameImported: `testMarcFileC397343.${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create SRS MARC Authority',
},
];

const createdRecordIDs = [];

before('Create users, data', () => {
cy.getAdminToken();

cy.createTempUser([
Permissions.inventoryAll.gui,
Permissions.uiMarcAuthoritiesAuthorityRecordView.gui,
Permissions.uiMarcAuthoritiesAuthorityRecordEdit.gui,
Permissions.uiQuickMarcQuickMarcAuthoritiesEditorAll.gui,
Permissions.uiQuickMarcQuickMarcBibliographicEditorAll.gui,
])
.then((userProperties) => {
users.userProperties = userProperties;
})
.then(() => {
cy.assignAffiliationToUser(Affiliations.University, users.userProperties.userId);
cy.assignAffiliationToUser(Affiliations.College, users.userProperties.userId);
cy.setTenant(Affiliations.University);
cy.assignPermissionsToExistingUser(users.userProperties.userId, [
Permissions.inventoryAll.gui,
Permissions.uiMarcAuthoritiesAuthorityRecordView.gui,
Permissions.uiMarcAuthoritiesAuthorityRecordEdit.gui,
Permissions.uiQuickMarcQuickMarcAuthoritiesEditorAll.gui,
Permissions.uiQuickMarcQuickMarcBibliographicEditorAll.gui,
Permissions.moduleDataImportEnabled.gui,
Permissions.uiCanLinkUnlinkAuthorityRecordsToBibRecords.gui,
]);
})
.then(() => {
cy.setTenant(Affiliations.College);
cy.assignPermissionsToExistingUser(users.userProperties.userId, [
Permissions.inventoryAll.gui,
Permissions.uiMarcAuthoritiesAuthorityRecordView.gui,
Permissions.uiMarcAuthoritiesAuthorityRecordEdit.gui,
Permissions.uiQuickMarcQuickMarcAuthoritiesEditorAll.gui,
Permissions.uiQuickMarcQuickMarcBibliographicEditorAll.gui,
]);
})
.then(() => {
cy.resetTenant();
cy.login(users.userProperties.username, users.userProperties.password, {
path: TopMenu.inventoryPath,
waiter: InventoryInstances.waitContentLoading,
}).then(() => {
ConsortiumManager.switchActiveAffiliation(tenantNames.university);
InventoryInstances.waitContentLoading();
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.university);
});
marcFiles.forEach((marcFile) => {
cy.visit(TopMenu.dataImportPath);
DataImport.verifyUploadState();
DataImport.uploadFileAndRetry(marcFile.marc, marcFile.fileNameImported);
JobProfiles.waitLoadingList();
JobProfiles.search(marcFile.jobProfileToRun);
JobProfiles.runImportFile();
JobProfiles.waitFileIsImported(marcFile.fileNameImported);
Logs.checkStatusOfJobProfile(JOB_STATUS_NAMES.COMPLETED);
Logs.openFileDetails(marcFile.fileNameImported);
Logs.getCreatedItemsID().then((link) => {
createdRecordIDs.push(link.split('/')[5]);
});
});

cy.visit(TopMenu.inventoryPath).then(() => {
InventoryInstances.waitContentLoading();
InventoryInstance.searchByTitle(createdRecordIDs[0]);
InventoryInstances.selectInstance();
InventoryInstance.editMarcBibliographicRecord();
QuickMarcEditor.clickLinkIconInTagField(linkingTagAndValues.rowIndex);
MarcAuthorities.switchToSearch();
InventoryInstance.verifySelectMarcAuthorityModal();
InventoryInstance.verifySearchOptions();
InventoryInstance.searchResults(linkingTagAndValues.authorityHeading);
InventoryInstance.clickLinkButton();
QuickMarcEditor.verifyAfterLinkingUsingRowIndex(
linkingTagAndValues.tag,
linkingTagAndValues.rowIndex,
);
QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.checkAfterSaveAndClose();
});
});
});

after('Delete users, data', () => {
cy.resetTenant();
cy.getAdminToken();
Users.deleteViaApi(users.userProperties.userId);
cy.setTenant(Affiliations.University);
InventoryInstance.deleteInstanceViaApi(createdRecordIDs[0]);
MarcAuthority.deleteViaAPI(createdRecordIDs[1]);
});

it(
'C407654 Update local linked "MARC Authority" record in member tenant (consortia) (spitfire)',
{ tags: ['criticalPath', 'spitfire'] },
() => {
cy.visit(TopMenu.marcAuthorities);
MarcAuthorities.searchBy(testData.authoritySearchOption, testData.authorityTitle);
MarcAuthorities.selectTitle(testData.authorityTitle);
MarcAuthority.edit();
QuickMarcEditor.updateExistingField(testData.tag100, testData.updated100FieldValue);
QuickMarcEditor.checkContent(testData.updated100FieldValue, 8);
QuickMarcEditor.checkButtonsEnabled();
// if clicked too fast, delete modal might not appear
cy.wait(1000);
QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.verifyUpdateLinkedBibsKeepEditingModal(1);
QuickMarcEditor.confirmUpdateLinkedBibsKeepEditing(1);
cy.visit(TopMenu.inventoryPath);
InventoryInstance.searchByTitle(createdRecordIDs[0]);
InventoryInstances.selectInstance();
InventoryInstance.editMarcBibliographicRecord();
QuickMarcEditor.verifyTagFieldAfterLinking(
linkingTagAndValues.rowIndex,
linkingTagAndValues.tag,
linkingTagAndValues.secondBox,
linkingTagAndValues.thirdBox,
linkingTagAndValues.content,
linkingTagAndValues.eSubfield,
linkingTagAndValues.zeroSubfield,
linkingTagAndValues.seventhBox,
);
QuickMarcEditor.closeEditorPane();

ConsortiumManager.switchActiveAffiliation(tenantNames.central);
InventoryInstances.waitContentLoading();
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.central);
InventorySearchAndFilter.searchByParameter(
testData.instanceSearchOption,
testData.instanceTitle,
);
InventoryInstance.verifyNoResultFoundMessage(
`No results found for "${testData.instanceTitle}". Please check your spelling and filters.`,
);
cy.visit(TopMenu.marcAuthorities);
MarcAuthorities.searchBy(testData.authoritySearchOption, testData.updated100FieldValue);
MarcAuthorities.checkNoResultsMessage(
`No results found for "${testData.updated100FieldValue}". Please check your spelling and filters.`,
);

cy.visit(TopMenu.inventoryPath);
ConsortiumManager.switchActiveAffiliation(tenantNames.college);
InventoryInstances.waitContentLoading();
InventorySearchAndFilter.searchByParameter(
testData.instanceSearchOption,
testData.instanceTitle,
);
InventoryInstance.verifyNoResultFoundMessage(
`No results found for "${testData.instanceTitle}". Please check your spelling and filters.`,
);
cy.visit(TopMenu.marcAuthorities);
MarcAuthorities.searchBy(testData.authoritySearchOption, testData.updated100FieldValue);
MarcAuthorities.checkNoResultsMessage(
`No results found for "${testData.updated100FieldValue}". Please check your spelling and filters.`,
);
},
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Logs from '../../support/fragments/data_import/logs/logs';
import QuickMarcEditor from '../../support/fragments/quickMarcEditor';
import ConsortiumManager from '../../support/fragments/settings/consortium-manager/consortium-manager';

describe('MARC Bibliographic -> Manual linking -> Consortia', () => {
describe('MARC -> MARC Bibliographic -> Edit MARC bib -> Consortia', () => {
const testData = {
sharedBibSourcePaheheaderText: 'Shared MARC bibliographic record',
tag245: '245',
Expand Down
1 change: 1 addition & 0 deletions cypress/fixtures/marcAuthFileForC407654.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
00541cz a2200145n 4500001000800000005001700008008004100025010002200066035002300088040003300111046002100144100002700165670007600192670012700268870998020201031070045.0110721n| azannaabn |n aaa  an2011049161407654 a(OCoLC)oca08921677 aDLCbengcDLCerdadDLCdMvI f1977-10-112edtf1 aC407654 Lentz Local M1 aCity indians in Spain's American empire, c2012:bECIP t.p. (Mark Lentz) aMurder in Mérida, 1792, 2018 :bpre-publication galley title page (Mark W. Lentz) data from publisher (b. Oct. 11, 1977)
1 change: 1 addition & 0 deletions cypress/fixtures/marcBibFileForC407654.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
03448cam a2200505 i 45000010011000000030006000110050017000170080041000340100017000750400054000920200030001460200015001760200027001910200015002180350022002330420008002550430012002630500021002750820016002960840023003121000018003352450030003532500019003832640057004023000052004593360026005113370028005373380027005654900020005925050449006125201027010615200099020885040067021876000067022546510055023216510065023766500045024416500045024866500049025316510056025806480020026366550039026567760162026959800085028571031041933OCoLC20180524122107.0180223s2018 nmu b 001 0 eng  a 2017049081 aDLCbengerdacDLCdOCLCOdBDXdOCLCQdOCLCFdIQU a9780826359605q(hardback) a0826359604 a9780826359612q(paper) a0826359612 a(OCoLC)1031041933 apcc an-mx---00aF1376b.L46 201800a972/.65223 aHIS0250002bisacsh1 aC407654 Lentz10aC407654 Instance Local M1 aFirst edition. 1aAlbuqerque :bUniversity of New Mexico Press,c2018. axvi, 312 pages :billustrations, maps ;c23 cm. atextbtxt2rdacontent aunmediatedbn2rdamedia avolumebnc2rdacarrier0 aDialogos series0 aA Province at risk -- The intendant's enemies: Chronicle of an assassination foretold -- The suspects of 1792: Prosecuting the powerless -- Neither free nor family: Criados and slaves in Spanish households -- Into the countryside: Outsiders, intermediaries, and the Maya world -- A stratified cah, united by language: Cabildos, church auxiliaries, and Indios Hidalgos -- Divided at the top: Politics of the personal -- A strange turn of events. a"During the summer of 1792, a man wearing the rough garb of a vaquero stepped out of the night shadows of Mérida, Yucatan, and murdered the province's top royal official, don Lucas de Galvez. This book recounts the mystery of the Galvez murder and its resolution, an event that captured contemporaries imaginations throughout the Hispanic world and caused consternation on the part of authorities in both Mexico and Madrid. In this work Lentz further provides a readable introduction to the Bourbon Reforms as well as new insights on late colonial Yucatecan society through the vast depictions of the cross-section of Yucatecan people questioned during the decade it took to uncover the assassin's identity. These suspects and witnesses, from all walks of life, reveal the interconnected layers found in colonial Yucatecan society and the social networks of Mérida's urban underclass as well as their unexpected ties to the creole elites and rural Mayas that have previously been unexplored."--cProvided by publisher. a"Yucatan; Bourbon Reforms; creoles; underclass; trial; independence"--cProvided by publisher. aIncludes bibliographical references (pages 289-304) and index.10aGálvez y Montes de Oca, Lucas de,d1739-1792xAssassination. 0aYucatán (Mexico : State)xHistoryy18th century. 0aYucatán (Mexico : State)xSocial conditionsy18th century. 7aHISTORYzLatin AmericaxMexico.2bisacsh 7aAssassination.2fast0(OCoLC)fst00818962 7aSocial conditions.2fast0(OCoLC)fst01919811 7aMexicozYucatán (State)2fast0(OCoLC)fst01330523 7a1700-17992fast 7aHistory.2fast0(OCoLC)fst0141162808iOnline version:aLentz, Mark.tMurder in Mérida, 1792.bFirst edition.dAlbuqerque : University of New Mexico Press, 2018z9780826359629w(DLC) 2018016955 a40028235808bHLA2cGendJRLeYBPg509530h606315i180611lPaperm29.95q1j29.95
16 changes: 16 additions & 0 deletions cypress/support/fragments/quickMarcEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ const continueWithSaveButton = Modal().find(
const restoreDeletedFieldsBtn = Modal().find(
Button({ id: 'clickable-quick-marc-confirm-modal-cancel' }),
);
const keepEditingButton = updateLinkedBibFieldsModal.find(
Button({ id: 'clickable-quick-marc-update-linked-bib-fields-cancel' }),
);
const quickMarcEditorRowContent = HTML({ className: including('quickMarcEditorRowContent') });
const instanceDetailsPane = Pane({ id: 'pane-instancedetails' });
const unlinkModal = Modal({ id: 'quick-marc-confirm-unlink-modal' });
Expand Down Expand Up @@ -1721,4 +1724,17 @@ export default {
.has({ value: content }),
);
},

verifyUpdateLinkedBibsKeepEditingModal(linkedRecordsNumber) {
cy.expect(updateLinkedBibFieldsModal.exists());
cy.expect(
updateLinkedBibFieldsModal.has({
content: including(
`${linkedRecordsNumber} bibliographic record is linked to this authority record and will be updated by clicking the Save button.`,
),
}),
);
cy.expect(saveButton.exists());
cy.expect(keepEditingButton.exists());
},
};

0 comments on commit f608fac

Please sign in to comment.