Skip to content

Commit

Permalink
Merge branch 'master' into FAT-15861
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherzod-Kenjaev authored Sep 25, 2024
2 parents ab4a71a + a347347 commit e412a92
Show file tree
Hide file tree
Showing 18 changed files with 447 additions and 104 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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';
Expand All @@ -18,6 +19,7 @@ const instanceUUIDsFileName = `instanceUUIDs-${getRandomPostfix()}.csv`;
const matchedRecordsFileName = `*-Matched-Records-${instanceUUIDsFileName}`;
const previewFileName = `*-Updates-Preview-${instanceUUIDsFileName}`;
const changedRecordsFileName = `*-Changed-Records-${instanceUUIDsFileName}`;
const errorsFromCommittingFileName = `*-Committing-changes-Errors-${instanceUUIDsFileName}`;
const folioItem = {
instanceName: `testBulkEdit_${getRandomPostfix()}`,
itemBarcode: `folioItem${getRandomPostfix()}`,
Expand All @@ -26,14 +28,14 @@ const marcInstance = {
instanceName: `testBulkEdit_${getRandomPostfix()}`,
itemBarcode: `folioItem${getRandomPostfix()}`,
};

const notes = {
dissertationNote: 'test instance note',
dissertationNoteStaffOnly: 'test instance note staff only',
dataQualityNote: 'data quality note',
exhibitionsNote: 'exhibitions note',
administrativeNote: 'administrative note',
};
const reasonForError = 'Bulk edit of instance notes is not supported for MARC Instances.';

describe('bulk-edit', () => {
describe('in-app approach', () => {
Expand Down Expand Up @@ -97,6 +99,7 @@ describe('bulk-edit', () => {
matchedRecordsFileName,
previewFileName,
changedRecordsFileName,
errorsFromCommittingFileName,
);
});

Expand Down Expand Up @@ -184,6 +187,10 @@ describe('bulk-edit', () => {
`${notes.exhibitionsNote} (staff only)`,
);

BulkEditSearchPane.verifyErrorLabelInErrorAccordion(instanceUUIDsFileName, 2, 2, 3);
BulkEditSearchPane.verifyNonMatchedResults(marcInstance.instanceId);
BulkEditSearchPane.verifyReasonForError(reasonForError);

BulkEditActions.openActions();
BulkEditActions.downloadChangedCSV();
ExportFile.verifyFileIncludes(previewFileName, [
Expand All @@ -196,6 +203,13 @@ describe('bulk-edit', () => {
]);
ExportFile.verifyFileIncludes(previewFileName, ['Dissertation note'], false);

BulkEditActions.downloadErrors();
BulkEditFiles.verifyCSVFileRows(errorsFromCommittingFileName, [
`${marcInstance.instanceId},${reasonForError}`,
`${marcInstance.instanceId},${reasonForError}`,
`${marcInstance.instanceId},${reasonForError}`,
]);

cy.visit(TopMenu.inventoryPath);
InventorySearchAndFilter.searchInstanceByTitle(folioItem.instanceName);
InventoryInstances.selectInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ describe('Inventory', () => {
InventorySearchAndFilter.switchToBrowseTab();
InventorySearchAndFilter.verifyBrowseOptions();
InventorySearchAndFilter.selectBrowseCallNumbers();
InventorySearchAndFilter.browseSubjectsSearch(item.callNumber);
InventorySearchAndFilter.selectFoundItem(item.callNumber, item.callNumberSuffix);
InventorySearchAndFilter.verifyShelvingOrder(item.shelvingOrderValue);
InventorySearchAndFilter.browseSubjectsSearch(item.itemCallNumber);
InventorySearchAndFilter.selectFoundItem(item.itemCallNumber);
InventorySearchAndFilter.verifyShelvingOrder(item.itemCallNumber);
InventorySearchAndFilter.verifyInstanceDisplayed(item.instanceName);

InventorySearchAndFilter.switchToBrowseTab();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ describe('MARC', () => {
describe('Edit Authority record', () => {
const testData = {
authority: {
title: 'C350572 Congress and foreign policy series',
searchOption: 'Uniform title',
title: 'C350572 Sprouse, Chris',
searchOption: 'Keyword',
newField: {
title: `Test authority ${getRandomPostfix()}`,
tag: '901',
Expand Down Expand Up @@ -67,14 +67,14 @@ describe('MARC', () => {
MarcAuthorities.searchBy(testData.authority.searchOption, testData.authority.title);
MarcAuthorities.selectFirst(testData.authority.title);
MarcAuthority.edit();
cy.reload();
MarcAuthority.addNewField(
5,
testData.authority.newField.tag,
`$a ${testData.authority.newField.content}`,
);
cy.wait(1000);
MarcAuthority.changeField('130', testData.authority.newField.title);
cy.wait(1000);
MarcAuthority.changeField('100', testData.authority.newField.title);
QuickMarcEditor.pressSaveAndClose();
cy.wait(1500);
MarcAuthority.clicksaveAndCloseButton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ describe('MARC', () => {
);
});
QuickMarcEditor.verifyEnabledLinkHeadingsButton();
QuickMarcEditor.updateExistingField(fields[14].tag, '$a Delaware $0 n84745425C389486');
QuickMarcEditor.updateExistingField(fields[11].tag, '$a Delaware $0 n84745425C389486');
cy.wait(1000);
QuickMarcEditor.clickLinkHeadingsButton();
QuickMarcEditor.checkCallout('Field 711 has been linked to MARC authority record(s).');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import SettingsMenu from '../../../../support/fragments/settingsMenu';
import TopMenu from '../../../../support/fragments/topMenu';
import Users from '../../../../support/fragments/users/users';
import getRandomPostfix from '../../../../support/utils/stringTools';
import InventoryInstances from '../../../../support/fragments/inventory/inventoryInstances';

describe('MARC', () => {
describe('MARC Bibliographic', () => {
Expand All @@ -24,32 +23,6 @@ describe('MARC', () => {
tag755: '755',
},
};
const jobProfileToRun = DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS;
const propertyName = 'instance';
const tagArray = [
'100',
'110',
'111',
'130',
'240',
'600',
'610',
'611',
'630',
'650',
'651',
'655',
'700',
'710',
'711',
'730',
'800',
'810',
'811',
'830',
];
let createdInstanceID;
let fileName;
const protectedFields = [
{
protectedField: '245',
Expand Down Expand Up @@ -93,33 +66,15 @@ describe('MARC', () => {
},
];

const marcFiles = [
{
marc: 'marcBibFileForC353526.mrc',
fileName: `testMarcFileC353526.${getRandomPostfix()}.mrc`,
jobProfileToRun: DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS,
propertyName: 'instance',
},
];
const marcFile = {
marc: 'marcBibFileForC353526.mrc',
fileName: `testMarcFileC353526.${getRandomPostfix()}.mrc`,
jobProfileToRun: DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS,
propertyName: 'instance',
};
let instanceIds;

before('Create test data', () => {
cy.getAdminToken();
marcFiles.forEach((marcFile) => {
DataImport.uploadFileViaApi(
marcFile.marc,
marcFile.fileName,
marcFile.jobProfileToRun,
).then((response) => {
response.forEach((record) => {
instanceIds = record[marcFile.propertyName].id;
});
});
});
});

beforeEach(() => {
fileName = `testMarcFile.${getRandomPostfix()}.mrc`;
cy.createTempUser([
Permissions.inventoryAll.gui,
Permissions.uiQuickMarcQuickMarcEditorDuplicate.gui,
Expand All @@ -134,24 +89,20 @@ describe('MARC', () => {
path: TopMenu.dataImportPath,
waiter: DataImport.waitLoading,
});
DataImport.uploadFileViaApi('marcFileForC360542.mrc', fileName, jobProfileToRun).then(
(response) => {
response.forEach((record) => {
createdInstanceID = record[propertyName].id;
});
},
);
Logs.waitFileIsImported(fileName);
Logs.checkJobStatus(fileName, 'Completed');
Logs.openFileDetails(fileName);
Logs.goToTitleLink(RECORD_STATUSES.CREATED);
DataImport.uploadFileViaApi(
marcFile.marc,
marcFile.fileName,
marcFile.jobProfileToRun,
).then((response) => {
response.forEach((record) => {
instanceIds = record[marcFile.propertyName].id;
});
});
});
});

afterEach(() => {
cy.getAdminToken();
if (createdInstanceID) InventoryInstance.deleteInstanceViaApi(createdInstanceID);
Users.deleteViaApi(testData.userProperties.userId);
Logs.waitFileIsImported(marcFile.fileName);
Logs.checkJobStatus(marcFile.fileName, 'Completed');
Logs.openFileDetails(marcFile.fileName);
Logs.goToTitleLink(RECORD_STATUSES.CREATED);
});

after('Delete test data', () => {
Expand All @@ -162,36 +113,13 @@ describe('MARC', () => {
MarcFieldProtection.delete(field.protectedField);
MarcFieldProtection.confirmDelete();
});
Users.deleteViaApi(testData.userProperties.userId);
});

it(
'C360541 Verify that "Link to MARC Authority record" icon displays next to MARC fields when editing Bib record (spitfire) (TaaS)',
{ tags: ['criticalPath', 'spitfire'] },
() => {
InventoryInstance.editMarcBibliographicRecord();
tagArray.forEach((tag) => {
QuickMarcEditor.checkLinkButtonExist(tag);
});
QuickMarcEditor.checkLinkButtonToolTipText('Link to MARC Authority record');
},
);

it(
'C360542 Verify that "Link to MARC Authority record" icon displays next to MARC fields when deriving Bib record (spitfire)',
{ tags: ['smoke', 'spitfire', 'shiftLeftBroken'] },
() => {
InventoryInstance.deriveNewMarcBib();
tagArray.forEach((tag) => {
QuickMarcEditor.checkLinkButtonExist(tag);
});
},
);

it(
'C353526 Protection of specified fields when editing "MARC Bibliographic" record (spitfire) (TaaS)',
{ tags: ['criticalPath', 'spitfire'] },
() => {
InventoryInstances.searchByTitle(instanceIds);
InventoryInstance.editMarcBibliographicRecord();
MarcAuthority.checkInfoButton('999');
MarcAuthority.addNewField(5, testData.tags.tag260, '$a London', '1', '1');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ describe('MARC', () => {

QuickMarcEditor.deletePenaltField().then((deletedTag) => {
const expectedUpdatedValue = QuickMarcEditor.updateExistingField();

QuickMarcEditor.pressSaveAndClose();
cy.wait(1500);
QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.deleteConfirmationPresented();
QuickMarcEditor.confirmDelete();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import { DEFAULT_JOB_PROFILE_NAMES, RECORD_STATUSES } from '../../../../support/constants';
import { Permissions } from '../../../../support/dictionary';
import DataImport from '../../../../support/fragments/data_import/dataImport';
import Logs from '../../../../support/fragments/data_import/logs/logs';
import InventoryInstance from '../../../../support/fragments/inventory/inventoryInstance';
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', () => {
describe('MARC Bibliographic', () => {
describe('Edit MARC bib', () => {
const testData = {};
const jobProfileToRun = DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS;
const propertyName = 'instance';
const tagArray = [
'100',
'110',
'111',
'130',
'240',
'600',
'610',
'611',
'630',
'650',
'651',
'655',
'700',
'710',
'711',
'730',
'800',
'810',
'811',
'830',
];
let createdInstanceID;
let fileName;

beforeEach(() => {
fileName = `C360541testMarcFile.${getRandomPostfix()}.mrc`;
cy.createTempUser([
Permissions.inventoryAll.gui,
Permissions.uiQuickMarcQuickMarcEditorDuplicate.gui,
Permissions.uiQuickMarcQuickMarcAuthorityLinkUnlink.gui,
Permissions.uiQuickMarcQuickMarcBibliographicEditorAll.gui,
Permissions.moduleDataImportEnabled.gui,
Permissions.settingsDataImportEnabled.gui,
]).then((createdUserProperties) => {
testData.userProperties = createdUserProperties;

cy.login(testData.userProperties.username, testData.userProperties.password, {
path: TopMenu.dataImportPath,
waiter: DataImport.waitLoading,
});
DataImport.uploadFileViaApi('marcFileForC360542.mrc', fileName, jobProfileToRun).then(
(response) => {
response.forEach((record) => {
createdInstanceID = record[propertyName].id;
});
},
);
Logs.waitFileIsImported(fileName);
Logs.checkJobStatus(fileName, 'Completed');
Logs.openFileDetails(fileName);
Logs.goToTitleLink(RECORD_STATUSES.CREATED);
});
});

afterEach(() => {
cy.getAdminToken();
if (createdInstanceID) InventoryInstance.deleteInstanceViaApi(createdInstanceID);
Users.deleteViaApi(testData.userProperties.userId);
});

it(
'C360541 Verify that "Link to MARC Authority record" icon displays next to MARC fields when editing Bib record (spitfire) (TaaS)',
{ tags: ['criticalPath', 'spitfire'] },
() => {
InventoryInstance.editMarcBibliographicRecord();
tagArray.forEach((tag) => {
QuickMarcEditor.checkLinkButtonExist(tag);
});
QuickMarcEditor.checkLinkButtonToolTipText('Link to MARC Authority record');
},
);

it(
'C360542 Verify that "Link to MARC Authority record" icon displays next to MARC fields when deriving Bib record (spitfire)',
{ tags: ['smoke', 'spitfire', 'shiftLeftBroken'] },
() => {
InventoryInstance.deriveNewMarcBib();
tagArray.forEach((tag) => {
QuickMarcEditor.checkLinkButtonExist(tag);
});
},
);
});
});
});
Loading

0 comments on commit e412a92

Please sign in to comment.