Skip to content

Commit

Permalink
splited marc bib edit into two files. removed dependenceies between t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
eremv committed Sep 25, 2024
1 parent bad31b9 commit ae265ef
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 92 deletions.
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
@@ -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);
});
},
);
});
});
});

0 comments on commit ae265ef

Please sign in to comment.