Skip to content

Commit

Permalink
Stabilize test cases (#3169)
Browse files Browse the repository at this point in the history
  • Loading branch information
sviatlana-stsiapanava committed Feb 6, 2024
1 parent d53acba commit bee44e2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const testData = {
fileName: `testMarcFileC375205.${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create instance and SRS MARC Bib',
instanceTitle: 'The Journal of ecclesiastical history.',
LDRValue: '01330cas\\a2200409\\\\\\4500',
LDRValue: '01338cas\\a2200409\\\\\\4500',
updateLDRValue: '01338cas\\a2200409\\\\\\450',
searchOption: 'Keyword (title, contributor, identifier, HRID, UUID)',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ describe('MARC', () => {
'C353612 Verify "LDR" validation rules with invalid data for editable (06, 07) and non-editable positions when editing/deriving record (spitfire)',
{ tags: ['smoke', 'spitfire'] },
() => {
const checkLdrErrors = () => {
const initialLDRValue = InventoryInstance.validOCLC.ldrValue;
const checkLdrErrors = (initialLDRValue) => {
const positions6Error =
'Record cannot be saved. Please enter a valid Leader 06. Valid values are listed at https://loc.gov/marc/bibliographic/bdleader.html';
const position7Error =
Expand Down Expand Up @@ -130,47 +129,49 @@ describe('MARC', () => {
InventoryInstance.checkExpectedMARCSource();
InventoryInstance.goToEditMARCBiblRecord();
QuickMarcEditor.waitLoading();
cy.reload();
checkLdrErrors();
QuickMarcEditor.closeWithoutSavingAfterChange();
InventoryInstance.deriveNewMarcBib();
QuickMarcEditor.check008FieldsAbsent('Type', 'Blvl');
checkLdrErrors();
QuickMarcEditor.getRegularTagContent('LDR').then((initialLDRValue) => {
cy.reload();
checkLdrErrors(initialLDRValue);
QuickMarcEditor.closeWithoutSavingAfterChange();
InventoryInstance.deriveNewMarcBib();
QuickMarcEditor.check008FieldsAbsent('Type', 'Blvl');
checkLdrErrors(initialLDRValue);
});
},
);

it(
'C353610 Verify "LDR" validation rules with valid data for positions 06 and 07 when editing record (spitfire)',
{ tags: ['smoke', 'spitfire'] },
() => {
const initialLDRValue = '01799cam\\a22004094a\\4500';
const changesIn06 = ['c', 'd', 'e', 'f', 'g', 'i', 'j', 'k', 'm', 'o', 'p', 'r', 't'];
const changesIn07 = ['a', 'b', 'c', 'd', 'i', 'm', 's'];

InventoryInstance.checkExpectedMARCSource();

InventoryInstance.goToEditMARCBiblRecord();
QuickMarcEditor.waitLoading();
QuickMarcEditor.updateExistingField('LDR', replaceByIndex(initialLDRValue, 6, 'b'));
QuickMarcEditor.check008FieldsAbsent('DtSt', 'Ctry');
QuickMarcEditor.closeWithoutSavingAfterChange();
QuickMarcEditor.getRegularTagContent('LDR').then((initialLDRValue) => {
QuickMarcEditor.updateExistingField('LDR', replaceByIndex(initialLDRValue, 6, 'b'));
QuickMarcEditor.check008FieldsAbsent('DtSt', 'Ctry');
QuickMarcEditor.closeWithoutSavingAfterChange();

const checkCorrectUpdate = (subfieldIndex, values) => {
values.forEach((specialValue) => {
InventoryInstance.goToEditMARCBiblRecord();
QuickMarcEditor.waitLoading();
QuickMarcEditor.updateExistingField(
'LDR',
replaceByIndex(initialLDRValue, subfieldIndex, specialValue),
);
QuickMarcEditor.checkSubfieldsPresenceInTag008();
QuickMarcEditor.pressSaveAndClose();
InventoryInstance.waitLoading();
});
};
const checkCorrectUpdate = (subfieldIndex, values) => {
values.forEach((specialValue) => {
InventoryInstance.goToEditMARCBiblRecord();
QuickMarcEditor.waitLoading();
QuickMarcEditor.updateExistingField(
'LDR',
replaceByIndex(initialLDRValue, subfieldIndex, specialValue),
);
QuickMarcEditor.checkSubfieldsPresenceInTag008();
QuickMarcEditor.pressSaveAndClose();
InventoryInstance.waitLoading();
});
};

checkCorrectUpdate(6, changesIn06);
checkCorrectUpdate(7, changesIn07);
checkCorrectUpdate(6, changesIn06);
checkCorrectUpdate(7, changesIn07);
});
},
);
});
Expand Down
1 change: 1 addition & 0 deletions cypress/support/fragments/inventory/inventoryInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ export default {

goToEditMARCBiblRecord: () => {
cy.do(actionsButton.click());
cy.expect(actionsButton.has({ ariaExpanded: 'true' }));
cy.do(editMARCBibRecordButton.click());
},

Expand Down

0 comments on commit bee44e2

Please sign in to comment.