Skip to content

Commit

Permalink
Add steps to the test case C374161 (#3517)
Browse files Browse the repository at this point in the history
  • Loading branch information
sviatlana-stsiapanava committed Apr 22, 2024
1 parent abdec98 commit 8248fce
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('MARC', () => {

// 4 Click on the "Save & close" button
QuickMarcEditor.clickSaveAndCloseInModal();
QuickMarcEditor.checkFourthBoxDisabled(1);
QuickMarcEditor.checkFourthBoxEditable(1, false);
QuickMarcEditor.checkContentByTag(
tag001,
`${localAuthFile.prefix}${localAuthFile.startWithNumber}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('MARC', () => {
// 4 Click on the "Save & close" button
QuickMarcEditor.clickSaveAndCloseInModal();
QuickMarcEditor.checkContentByTag('001', '');
QuickMarcEditor.checkFourthBoxDisabled(1);
QuickMarcEditor.checkFourthBoxEditable(1, false);

// 5 Add 2 new fields by clicking on "+" icon and fill it as specified:
// 010 \\ "$a <prefix value of default authority file which does NOT match the selected option><identifier value>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ describe('MARC', () => {
describe('MARC Authority', () => {
describe('Edit linked Authority record', () => {
let userData = {};

const testData = {
tag010: '010',
tag100: '100',
Expand All @@ -39,9 +38,10 @@ describe('MARC', () => {
'$0 http://id.loc.gov/authorities/names/n91074080',
'',
],
colloutMessage: 'Cannot delete 010. It is required.',
calloutMessageError: 'Cannot delete 010. It is required.',
calloutMessageSuccessfulSaving:
'This record has successfully saved and is in process. Changes may not appear immediately.',
};

const marcFiles = [
{
marc: 'marcBibFileForC374161.mrc',
Expand All @@ -56,7 +56,6 @@ describe('MARC', () => {
propertyName: 'authority',
},
];

const createdRecordIDs = [];

before('Create test data', () => {
Expand Down Expand Up @@ -131,6 +130,7 @@ describe('MARC', () => {
});
});
});

after('Delete test data', () => {
cy.getAdminToken();
Users.deleteViaApi(userData.userId);
Expand Down Expand Up @@ -163,10 +163,10 @@ describe('MARC', () => {
QuickMarcEditor.verifySaveAndKeepEditingButtonEnabled();

QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.checkCallout(testData.colloutMessage);
QuickMarcEditor.checkCallout(testData.calloutMessageError);
QuickMarcEditor.closeCallout();

QuickMarcEditor.pressSaveAndKeepEditing(testData.colloutMessage);
QuickMarcEditor.pressSaveAndKeepEditing(testData.calloutMessageError);
QuickMarcEditor.closeCallout();

QuickMarcEditor.pressCancel();
Expand All @@ -186,6 +186,42 @@ describe('MARC', () => {
QuickMarcEditor.checkEditableQuickMarcFormIsOpened();
QuickMarcEditor.verifyUnlinkAndViewAuthorityButtons(testData.tag700RowIndex);
QuickMarcEditor.verifyTagFieldAfterLinking(...testData.linked700Field);

QuickMarcEditor.clickUnlinkIconInTagField(testData.tag700RowIndex);
QuickMarcEditor.confirmUnlinkingField(testData.tag700RowIndex);
QuickMarcEditor.verifyIconsAfterUnlinking(testData.tag700RowIndex);
QuickMarcEditor.verifyTagFieldAfterUnlinking(
testData.tag700RowIndex,
testData.tag700,
testData.linked700Field[2],
testData.linked700Field[3],
`${testData.linked700Field[4]} ${testData.linked700Field[5]} ${testData.linked700Field[6]}`,
);
QuickMarcEditor.checkFourthBoxEditable(testData.tag700RowIndex, true);

QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.checkCallout(testData.calloutMessageSuccessfulSaving);
InventoryInstance.waitInventoryLoading();

cy.visit(TopMenu.marcAuthorities);
MarcAuthorities.waitLoading();
MarcAuthorities.searchByParameter(testData.searchOption, testData.searchValue);
MarcAuthorities.selectTitle(testData.authorityTitle);
MarcAuthorities.verifyViewPaneContentExists();

MarcAuthority.edit();
QuickMarcEditor.checkContent(testData.field010Value, testData.tag010RowIndex);
QuickMarcEditor.checkDeleteButtonExist(testData.tag010RowIndex);

QuickMarcEditor.deleteField(testData.tag010RowIndex);
QuickMarcEditor.afterDeleteNotification(testData.tag010);
QuickMarcEditor.verifySaveAndKeepEditingButtonEnabled();
QuickMarcEditor.verifySaveAndCloseButtonEnabled();

QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.constinueWithSaveAndCheck();
MarcAuthorities.waitLoading();
MarcAuthorities.verifyViewPaneContentAbsent(testData.tag010);
},
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('MARC', () => {
QuickMarcEditor.updateExistingField('', testData.fieldContents.tag001Content);

QuickMarcEditor.updateTagNameToLockedTag(5, testData.tags.tag001);
QuickMarcEditor.checkFourthBoxDisabled(5);
QuickMarcEditor.checkFourthBoxEditable(5, false);

QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.checkAfterSaveAndClose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('MARC', () => {

// #7 Fill in the new input field with the "001" MARC tag.
QuickMarcEditor.updateTagNameToLockedTag(6, '001');
QuickMarcEditor.checkFourthBoxDisabled(6);
QuickMarcEditor.checkFourthBoxEditable(6, false);

// #8 Click on the "Save & close" button.
QuickMarcEditor.pressSaveAndClose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('MARC', () => {

QuickMarcEditor.updateExistingField('', testData.tag001Content);
QuickMarcEditor.updateTagNameToLockedTag(5, testData.tag001);
QuickMarcEditor.checkFourthBoxDisabled(5);
QuickMarcEditor.checkFourthBoxEditable(5, false);

QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.checkAfterSaveAndClose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ describe('MARC', () => {
QuickMarcEditor.updateExistingTagValue(14, testData.tag245);
QuickMarcEditor.updateExistingTagValue(16, '');
QuickMarcEditor.updateTagNameToLockedTag(16, testData.tag001);
QuickMarcEditor.checkFourthBoxDisabled(16);
QuickMarcEditor.checkFourthBoxEditable(16, false);
QuickMarcEditor.clickSaveAndKeepEditingButton();
QuickMarcEditor.verifyMultiple001TagCallout();
QuickMarcEditor.verifyTagValue(16, testData.tag001);
QuickMarcEditor.checkFourthBoxDisabled(16);
QuickMarcEditor.checkFourthBoxEditable(16, false);
QuickMarcEditor.closeWithoutSavingAfterChange();
InventoryInstance.waitLoading();
InventoryInstance.checkInstanceTitle(testData.instanceTitle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('MARC', () => {
QuickMarcEditor.checkEmptyFieldAdded(6);
QuickMarcEditor.updateExistingField('', testData.tag001value);
QuickMarcEditor.updateTagNameToLockedTag(6, '001');
QuickMarcEditor.checkFourthBoxDisabled(6);
QuickMarcEditor.checkFourthBoxEditable(6, false);
QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.checkAfterSaveHoldings();
HoldingsRecordView.editInQuickMarc();
Expand Down
40 changes: 14 additions & 26 deletions cypress/support/fragments/quickMarcEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1445,18 +1445,6 @@ export default {
.join('');
},

updateAllDefaultValuesIn008TagInAuthority() {
validRecord.tag008AuthorityBytesProperties.getAllProperties().forEach((byteProperty) => {
cy.do(
QuickMarcEditorRow({ tagValue: '008' })
.find(byteProperty.interactor)
.fillIn(byteProperty.newValue),
);
});
QuickMarcEditor.pressSaveAndClose();
return validRecord.tag008AuthorityBytesProperties.getNewValueSourceLine();
},

clearTag008Holdings() {
tag008HoldingsBytesProperties.getUsualProperties().forEach((byteProperty) => {
cy.do(
Expand Down Expand Up @@ -1625,14 +1613,6 @@ export default {
]);
},

checkLDRValue(ldrValue = validRecord.ldrValue) {
cy.expect(
getRowInteractorByTagName('LDR')
.find(TextArea({ ariaLabel: 'Subfield' }))
.has({ textContent: ldrValue }),
);
},

checkAuthority008SubfieldsLength() {
validRecord.tag008AuthorityBytesProperties
.getAllProperties()
Expand Down Expand Up @@ -1761,12 +1741,20 @@ export default {
cy.expect(calloutAfterSaveAndClose.absent());
},

checkFourthBoxDisabled(rowIndex) {
cy.expect(
getRowInteractorByRowNumber(rowIndex)
.find(TextArea({ ariaLabel: 'Subfield' }))
.has({ disabled: true }),
);
checkFourthBoxEditable(rowIndex, isEditable = true) {
if (isEditable) {
cy.expect(
getRowInteractorByRowNumber(rowIndex)
.find(TextArea({ ariaLabel: 'Subfield' }))
.has({ disabled: !isEditable }),
);
} else {
cy.expect(
getRowInteractorByRowNumber(rowIndex)
.find(TextArea({ ariaLabel: 'Subfield' }))
.has({ disabled: !isEditable }),
);
}
},

verifyNoFieldWithContent(content) {
Expand Down

0 comments on commit 8248fce

Please sign in to comment.