Skip to content

Commit

Permalink
Merge branch 'master' into FAT-C375088
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-soft-engineer committed Dec 4, 2023
2 parents 35de092 + 378dcaa commit c52b56a
Show file tree
Hide file tree
Showing 11 changed files with 612 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import Permissions from '../../../../support/dictionary/permissions';
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 InventoryInstance from '../../../../support/fragments/inventory/inventoryInstance';
import InventoryInstances from '../../../../support/fragments/inventory/inventoryInstances';
import QuickMarcEditor from '../../../../support/fragments/quickMarcEditor';
import TopMenu from '../../../../support/fragments/topMenu';
import Users from '../../../../support/fragments/users/users';
import getRandomPostfix from '../../../../support/utils/stringTools';
import InventorySteps from '../../../../support/fragments/inventory/inventorySteps';
import DateTools from '../../../../support/utils/dateTools';

describe('MARC -> MARC Bibliographic -> Edit MARC bib', () => {
const testData = {
createdRecordIDs: [],
tag245: '245',
tag245content:
'$aWicked :$bthe life and times of the wicked witch of the West : a novel /$cGregory Maguire ; illustrations by Douglas Smith. TEST',
tag245RowIndex: 12,
tag008: '008',
tag008RowIndex: 3,
tag00: '00',
expected008BoxesSets: [
'DtSt',
'Start date',
'End date',
'Ctry',
'Ills',
'Audn',
'Form',
'Cont',
'GPub',
'Conf',
'Fest',
'Indx',
'LitF',
'Biog',
'Lang',
'MRec',
'Srce',
],
tag008BoxValues: ['', '', '', '', '', '', '', '', '', '', '', '', '', '', ''],
calloutMessage:
'This record has successfully saved and is in process. Changes may not appear immediately.',
errorCalloutMessage: 'Record cannot be saved without 008 field',
initial008EnteredValue: DateTools.getCurrentDateYYMMDD(),
};
const marcFile = {
marc: 'marcBibFileForC387451.mrc',
fileName: `testMarcFile${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create instance and SRS MARC Bib',
numOfRecords: 1,
};

before('Creating user and data', () => {
cy.createTempUser([
Permissions.inventoryAll.gui,
Permissions.uiQuickMarcQuickMarcBibliographicEditorAll.gui,
Permissions.moduleDataImportEnabled.gui,
]).then((createdUserProperties) => {
testData.userProperties = createdUserProperties;

cy.loginAsAdmin({ path: TopMenu.dataImportPath, waiter: DataImport.waitLoading }).then(() => {
DataImport.verifyUploadState();
DataImport.uploadFileAndRetry(marcFile.marc, marcFile.fileName);
JobProfiles.waitFileIsUploaded();
JobProfiles.search(marcFile.jobProfileToRun);
JobProfiles.runImportFile();
JobProfiles.waitFileIsImported(marcFile.fileName);
Logs.checkStatusOfJobProfile('Completed');
Logs.openFileDetails(marcFile.fileName);
for (let i = 0; i < marcFile.numOfRecords; i++) {
Logs.getCreatedItemsID(i).then((link) => {
testData.createdRecordIDs.push(link.split('/')[5]);
});
}
});

cy.login(testData.userProperties.username, testData.userProperties.password, {
path: TopMenu.inventoryPath,
waiter: InventoryInstances.waitContentLoading,
});
});
});

after('Deleting created user and data', () => {
cy.getAdminToken().then(() => {
Users.deleteViaApi(testData.userProperties.userId);
InventoryInstance.deleteInstanceViaApi(testData.createdRecordIDs[0]);
});
});

it(
'C387451 "008" field existence validation when edit imported "MARC bib" (spitfire) (TaaS)',
{ tags: ['extendedPath', 'spitfire'] },
() => {
InventoryInstances.waitContentLoading();
InventoryInstance.searchByTitle(testData.createdRecordIDs[0]);
InventoryInstances.selectInstance();
InventoryInstance.editMarcBibliographicRecord();
QuickMarcEditor.checkEditableQuickMarcFormIsOpened();
QuickMarcEditor.updateExistingFieldContent(testData.tag245RowIndex, testData.tag245content);
QuickMarcEditor.checkButtonsEnabled();
QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.checkCallout(testData.errorCalloutMessage);
QuickMarcEditor.closeCallout();
QuickMarcEditor.clickSaveAndKeepEditingButton();
QuickMarcEditor.checkCallout(testData.errorCalloutMessage);
QuickMarcEditor.closeCallout();
QuickMarcEditor.addNewField(testData.tag008, '', testData.tag008RowIndex);
QuickMarcEditor.check008FieldLabels(testData.expected008BoxesSets);
QuickMarcEditor.updateExistingTagValue(4, testData.tag00);
QuickMarcEditor.verifyTagValue(4, testData.tag00);
QuickMarcEditor.checkContent('', 4);
QuickMarcEditor.checkDeleteButtonExist(4);
QuickMarcEditor.updateExistingTagValue(4, testData.tag008);
QuickMarcEditor.pressSaveAndKeepEditing(testData.calloutMessage);
QuickMarcEditor.checkEditableQuickMarcFormIsOpened();
QuickMarcEditor.check008FieldContent();
QuickMarcEditor.updateValuesIn008Boxes(testData.tag008BoxValues);
QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.checkAfterSaveAndClose();
InventorySteps.verifyHiddenFieldValueIn008(
testData.createdRecordIDs[0],
'Entered',
testData.initial008EnteredValue,
);
},
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import { Permissions } from '../../../../../support/dictionary';
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 InventoryInstance from '../../../../../support/fragments/inventory/inventoryInstance';
import InventoryInstances from '../../../../../support/fragments/inventory/inventoryInstances';
import InventoryViewSource from '../../../../../support/fragments/inventory/inventoryViewSource';
import MarcAuthorities from '../../../../../support/fragments/marcAuthority/marcAuthorities';
import MarcAuthority from '../../../../../support/fragments/marcAuthority/marcAuthority';
import QuickMarcEditor from '../../../../../support/fragments/quickMarcEditor';
import TopMenu from '../../../../../support/fragments/topMenu';
import Users from '../../../../../support/fragments/users/users';
import getRandomPostfix from '../../../../../support/utils/stringTools';

describe('MARC -> MARC Bibliographic -> Edit MARC bib -> Manual linking', () => {
const testData = {
tag630: '630',
authorityMarkedValue: 'C375069 Marvel comics',
subjectValue: 'C375069 Marvel comics ComiCon--Periodicals.--United States',
authorityIconText: 'Linked to MARC authority',
accordion: 'Subject',
};

const marcFiles = [
{
marc: 'marcBibFileForC375069.mrc',
fileName: `testMarcBibFileC375071.${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create instance and SRS MARC Bib',
},
{
marc: 'marcAuthFileForC375069.mrc',
fileName: `testMarcAuthFileC375071.${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create SRS MARC Authority',
authorityHeading: 'C375069 Marvel comics ComiCon',
},
];

const createdRecordIDs = [];
const bib630InitialFieldValues = [
23,
testData.tag630,
'0',
'7',
'$a C375069 Marvel comics. $2 fast $0 (OCoLC)fst01373594 $v Periodicals. $z United States $w 830',
];
const bib630UnlinkedFieldValues = [
23,
testData.tag630,
'0',
'7',
'$a C375069 Marvel comics $t ComiCon $v Periodicals. $z United States $w 830 $0 80026955 $2 fast',
];
const bib630LinkedFieldValues = [
23,
testData.tag630,
'0',
'7',
'$a C375069 Marvel comics $t ComiCon',
'$v Periodicals. $z United States $w 830',
'$0 80026955',
'$2 fast',
];

before('Creating user', () => {
cy.createTempUser([
Permissions.inventoryAll.gui,
Permissions.uiMarcAuthoritiesAuthorityRecordView.gui,
Permissions.uiQuickMarcQuickMarcBibliographicEditorAll.gui,
Permissions.uiQuickMarcQuickMarcAuthorityLinkUnlink.gui,
]).then((createdUserProperties) => {
testData.userProperties = createdUserProperties;

cy.loginAsAdmin().then(() => {
marcFiles.forEach((marcFile) => {
cy.visit(TopMenu.dataImportPath);
DataImport.verifyUploadState();
DataImport.uploadFileAndRetry(marcFile.marc, marcFile.fileName);
JobProfiles.waitLoadingList();
JobProfiles.search(marcFile.jobProfileToRun);
JobProfiles.runImportFile();
JobProfiles.waitFileIsImported(marcFile.fileName);
Logs.checkStatusOfJobProfile('Completed');
Logs.openFileDetails(marcFile.fileName);
Logs.getCreatedItemsID().then((link) => {
createdRecordIDs.push(link.split('/')[5]);
});
});
});

cy.login(testData.userProperties.username, testData.userProperties.password, {
path: TopMenu.inventoryPath,
waiter: InventoryInstances.waitContentLoading,
});
});
});

after('Deleting created user', () => {
cy.getAdminToken();
Users.deleteViaApi(testData.userProperties.userId);
createdRecordIDs.forEach((id, index) => {
if (index) MarcAuthority.deleteViaAPI(id);
else InventoryInstance.deleteInstanceViaApi(id);
});
});

it(
'C375069 Link the "630" of "MARC Bib" field with "130" field of "MARC Authority" record. (spitfire) (TaaS)',
{ tags: ['extendedPath', 'spitfire'] },
() => {
InventoryInstance.searchByTitle(createdRecordIDs[0]);
InventoryInstances.selectInstance();
InventoryInstance.editMarcBibliographicRecord();
QuickMarcEditor.verifyTagFieldAfterUnlinking(...bib630InitialFieldValues);
InventoryInstance.verifyAndClickLinkIcon(testData.tag630);
MarcAuthorities.switchToSearch();
InventoryInstance.verifySelectMarcAuthorityModal();
InventoryInstance.searchResults(marcFiles[1].authorityHeading);
MarcAuthorities.clickLinkButton();
QuickMarcEditor.verifyAfterLinkingAuthority(testData.tag630);
QuickMarcEditor.verifyTagFieldAfterLinking(...bib630LinkedFieldValues);
QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.checkAfterSaveAndClose();
InventoryInstance.verifyInstanceSubject(
2,
0,
`${testData.authorityIconText}${testData.subjectValue}`,
);
InventoryInstance.checkExistanceOfAuthorityIconInInstanceDetailPane(testData.accordion);
InventoryInstance.clickViewAuthorityIconDisplayedInInstanceDetailsPane(testData.accordion);
MarcAuthorities.checkDetailViewIncludesText(testData.authorityMarkedValue);
InventoryInstance.goToPreviousPage();
// Wait for the content to be loaded.
cy.wait(6000);
InventoryInstance.waitLoading();
InventoryInstance.viewSource();
InventoryInstance.checkExistanceOfAuthorityIconInMarcViewPane();
InventoryInstance.clickViewAuthorityIconDisplayedInMarcViewPane();
MarcAuthorities.checkDetailViewIncludesText(testData.authorityMarkedValue);
InventoryInstance.goToPreviousPage();
// Wait for the content to be loaded.
cy.wait(6000);
InventoryViewSource.waitLoading();
InventoryViewSource.close();
InventoryInstance.waitLoading();
InventoryInstance.editMarcBibliographicRecord();
QuickMarcEditor.verifyTagFieldAfterLinking(...bib630LinkedFieldValues);
QuickMarcEditor.clickUnlinkIconInTagField(bib630UnlinkedFieldValues[0]);
QuickMarcEditor.confirmUnlinkingField();
QuickMarcEditor.verifyTagFieldAfterUnlinking(...bib630UnlinkedFieldValues);
QuickMarcEditor.verifyIconsAfterUnlinking(bib630UnlinkedFieldValues[0]);
QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.checkAfterSaveAndClose();
InventoryInstance.checkAbsenceOfAuthorityIconInInstanceDetailPane(testData.accordion);
InventoryInstance.viewSource();
InventoryInstance.checkAbsenceOfAuthorityIconInMarcViewPane();
},
);
});

0 comments on commit c52b56a

Please sign in to comment.