From 8e9822e9d2d572b56c4684d4eec58b26b34a8ee5 Mon Sep 17 00:00:00 2001 From: Valery Pilko Date: Thu, 26 Feb 2026 15:41:14 +0400 Subject: [PATCH] FAT-22430 Add 003 control field in C503161, C503162, C503163 --- ...ty-with-local-control-fields-with-Sa.cy.js | 12 ++--- ...with-local-control-fields-without-Sa.cy.js | 12 ++--- .../edit-marc-auth-with-control-fields.cy.js | 52 +++++++++++++++---- cypress/fixtures/marcAuthFileForC503163.mrc | 2 +- 4 files changed, 55 insertions(+), 23 deletions(-) diff --git a/cypress/e2e/marc/marc-authority/create-marc-authority/create-authority-with-local-control-fields-with-Sa.cy.js b/cypress/e2e/marc/marc-authority/create-marc-authority/create-authority-with-local-control-fields-with-Sa.cy.js index d0c506b6de..16cf114f7e 100644 --- a/cypress/e2e/marc/marc-authority/create-marc-authority/create-authority-with-local-control-fields-with-Sa.cy.js +++ b/cypress/e2e/marc/marc-authority/create-marc-authority/create-authority-with-local-control-fields-with-Sa.cy.js @@ -40,7 +40,7 @@ describe('MARC', () => { const controlFieldContents = [ { tag: testData.tag002, content: '$a FOLIO23491' }, - // { tag: testData.tag003, content: 'FOLIO23492' }, uncoment after UIQM-787 is done + { tag: testData.tag003, content: '$a FOLIO23492' }, { tag: testData.tag004, content: '$a FOLIO23493' }, { tag: testData.tag009, content: '$a FOLIO23494' }, ]; @@ -52,9 +52,9 @@ describe('MARC', () => { const controlFieldContentsAfterSave = [ { tag: testData.tag002, content: controlFieldContents[0].content }, - // { tag: testData.tag003, content: controlFieldContents[1].content }, uncoment after UIQM-787 is done - { tag: testData.tag004, content: controlFieldContents[1].content }, - { tag: testData.tag009, content: controlFieldContents[2].content }, + { tag: testData.tag003, content: controlFieldContents[1].content }, + { tag: testData.tag004, content: controlFieldContents[2].content }, + { tag: testData.tag009, content: controlFieldContents[3].content }, ]; const expectedSourceControlFields = controlFieldContentsAfterSave.map( @@ -129,10 +129,10 @@ describe('MARC', () => { QuickMarcEditor.checkContent(field.content, 4 + index); }); regularFieldContents.forEach((field, index) => { - QuickMarcEditor.addNewField(field.tag, field.content, 6 + index); + QuickMarcEditor.addNewField(field.tag, field.content, 7 + index); }); regularFieldContents.forEach((field, index) => { - QuickMarcEditor.checkContent(field.content, 7 + index); + QuickMarcEditor.checkContent(field.content, 8 + index); }); // 5. Click on the "Save & close" button diff --git a/cypress/e2e/marc/marc-authority/create-marc-authority/create-authority-with-local-control-fields-without-Sa.cy.js b/cypress/e2e/marc/marc-authority/create-marc-authority/create-authority-with-local-control-fields-without-Sa.cy.js index 278d5d76d7..b90fb4fcca 100644 --- a/cypress/e2e/marc/marc-authority/create-marc-authority/create-authority-with-local-control-fields-without-Sa.cy.js +++ b/cypress/e2e/marc/marc-authority/create-marc-authority/create-authority-with-local-control-fields-without-Sa.cy.js @@ -39,7 +39,7 @@ describe('MARC', () => { const controlFieldContents = [ { tag: testData.tag002, content: 'FOLIO23491' }, - // { tag: testData.tag003, content: 'FOLIO23492' }, uncoment after UIQM-787 is done + { tag: testData.tag003, content: 'FOLIO23492' }, { tag: testData.tag004, content: 'FOLIO23493' }, { tag: testData.tag009, content: 'FOLIO23494' }, ]; @@ -51,9 +51,9 @@ describe('MARC', () => { const controlFieldContentsAfterSave = [ { tag: testData.tag002, content: controlFieldContents[0].content }, - // { tag: testData.tag003, content: controlFieldContents[1].content }, uncoment after UIQM-787 is done - { tag: testData.tag004, content: controlFieldContents[1].content }, - { tag: testData.tag009, content: controlFieldContents[2].content }, + { tag: testData.tag003, content: controlFieldContents[1].content }, + { tag: testData.tag004, content: controlFieldContents[2].content }, + { tag: testData.tag009, content: controlFieldContents[3].content }, ]; const expectedSourceControlFields = controlFieldContentsAfterSave.map( @@ -132,10 +132,10 @@ describe('MARC', () => { QuickMarcEditor.checkContent(field.content, 4 + index); }); regularFieldContents.forEach((field, index) => { - QuickMarcEditor.addNewField(field.tag, field.content, 6 + index); + QuickMarcEditor.addNewField(field.tag, field.content, 7 + index); }); regularFieldContents.forEach((field, index) => { - QuickMarcEditor.checkContent(field.content, 7 + index); + QuickMarcEditor.checkContent(field.content, 8 + index); }); // 5. Click on the "Save & close" button diff --git a/cypress/e2e/marc/marc-authority/edit-authority-record/edit-marc-auth-with-control-fields.cy.js b/cypress/e2e/marc/marc-authority/edit-authority-record/edit-marc-auth-with-control-fields.cy.js index bf3b09e6cb..c8c3802f56 100644 --- a/cypress/e2e/marc/marc-authority/edit-authority-record/edit-marc-auth-with-control-fields.cy.js +++ b/cypress/e2e/marc/marc-authority/edit-authority-record/edit-marc-auth-with-control-fields.cy.js @@ -1,4 +1,4 @@ -import { DEFAULT_JOB_PROFILE_NAMES } from '../../../../support/constants'; +import { APPLICATION_NAMES, DEFAULT_JOB_PROFILE_NAMES } from '../../../../support/constants'; import Permissions from '../../../../support/dictionary/permissions'; import DataImport from '../../../../support/fragments/data_import/dataImport'; import MarcAuthorities from '../../../../support/fragments/marcAuthority/marcAuthorities'; @@ -8,6 +8,9 @@ import TopMenu from '../../../../support/fragments/topMenu'; import Users from '../../../../support/fragments/users/users'; import getRandomPostfix from '../../../../support/utils/stringTools'; import { getAuthoritySpec } from '../../../../support/api/specifications-helper'; +import ExportFile from '../../../../support/fragments/data-export/exportFile'; +import TopMenuNavigation from '../../../../support/fragments/topMenuNavigation'; +import FileManager from '../../../../support/utils/fileManager'; describe('MARC', () => { describe('MARC Authority', () => { @@ -32,7 +35,7 @@ describe('MARC', () => { newContentFor110Field: '$a C503163 Edit MARC auth which has control fields with or without subfield Sa test', tag002: '002', - // tag003: '003', uncoment after UIQM-787 is done (and update the .mrc file) + tag003: '003', tag004: '004', tag009: '009', editMarcHeader: /Edit .*MARC authority record/, @@ -44,16 +47,16 @@ describe('MARC', () => { const controlFieldWithoutIndicator = [ { tag: testData.tag002, content: 'FOLIO23491', rowIndex: 3 }, - // { tag: testData.tag003, content: 'FOLIO23492' }, uncoment after UIQM-787 is done - { tag: testData.tag004, content: 'FOLIO23493', rowIndex: 4 }, - { tag: testData.tag009, content: 'FOLIO23494', rowIndex: 5 }, + { tag: testData.tag003, content: 'FOLIO23492', rowIndex: 4 }, + { tag: testData.tag004, content: 'FOLIO23493', rowIndex: 5 }, + { tag: testData.tag009, content: 'FOLIO23494', rowIndex: 6 }, ]; const controlFieldWithIndicator = [ { tag: testData.tag002, content: '$a FOLIO23491', rowIndex: 3 }, - // { tag: testData.tag003, content: '$a FOLIO23492' }, uncoment after UIQM-787 is done - { tag: testData.tag004, content: '$a FOLIO23491', rowIndex: 4 }, - { tag: testData.tag009, content: '$a FOLIO23491', rowIndex: 5 }, + { tag: testData.tag003, content: '$a FOLIO23492', rowIndex: 4 }, + { tag: testData.tag004, content: '$a FOLIO23491', rowIndex: 5 }, + { tag: testData.tag009, content: '$a FOLIO23491', rowIndex: 6 }, ]; const expectedSourceControlFieldsWithoutIndicator = controlFieldWithoutIndicator.map( @@ -64,6 +67,9 @@ describe('MARC', () => { (field) => `${field.tag}\t${field.content}`, ); + const csvFile = `C503163 exportedCSVFile${getRandomPostfix()}.csv`; + const exportedMarcFile = `C503163 exportedMarcFile${getRandomPostfix()}.mrc`; + before('Creating data', () => { cy.getAdminToken(); MarcAuthorities.deleteMarcAuthorityByTitleViaAPI('C503163*'); @@ -73,6 +79,8 @@ describe('MARC', () => { Permissions.uiQuickMarcQuickMarcAuthoritiesEditorAll.gui, Permissions.specificationStorageGetSpecificationFields.gui, Permissions.specificationStorageCreateSpecificationField.gui, + Permissions.dataExportUploadExportDownloadFileViewLogs.gui, + Permissions.dataExportViewAddUpdateProfiles.gui, ]).then((createdUserProperties) => { testData.userProperties = createdUserProperties; @@ -105,6 +113,9 @@ describe('MARC', () => { after('Deleting data', () => { cy.getAdminToken(); + FileManager.deleteFolder(Cypress.config('downloadsFolder')); + FileManager.deleteFile(`cypress/fixtures/${exportedMarcFile}`); + FileManager.deleteFile(`cypress/fixtures/${csvFile}`); if (createdAuthorityID) MarcAuthority.deleteViaAPI(createdAuthorityID); Users.deleteViaApi(testData.userProperties.userId); if (localFieldId) { @@ -130,8 +141,8 @@ describe('MARC', () => { }); // 2. Update any field, ex.: add test in the "110" field - QuickMarcEditor.updateExistingFieldContent(10, testData.newContentFor110Field); // update index +1 after UIQM-787 - QuickMarcEditor.checkContent(testData.newContentFor110Field, 10); + QuickMarcEditor.updateExistingFieldContent(11, testData.newContentFor110Field); + QuickMarcEditor.checkContent(testData.newContentFor110Field, 11); // 3. Click on the "Save & close" button. MarcAuthority.clickSaveAndCloseButton(); @@ -187,6 +198,27 @@ describe('MARC', () => { controlFieldWithoutIndicator.forEach((field, index) => { QuickMarcEditor.checkContent(field.content, 3 + index); }); + + // 10. Export edited record + QuickMarcEditor.closeAuthorityEditorPane(); + MarcAuthorities.checkSelectAuthorityRecordCheckbox(testData.title); + MarcAuthorities.checkSelectAuthorityRecordCheckboxChecked(testData.title); + MarcAuthorities.verifyTextOfPaneHeaderMarcAuthority('1 record selected'); + MarcAuthorities.exportSelected(); + cy.wait(1000); + ExportFile.downloadCSVFile(csvFile, 'QuickAuthorityExport*'); + + // 11. Go to "Data export" app and download exported ".mrc" file + TopMenuNavigation.navigateToApp(APPLICATION_NAMES.DATA_EXPORT); + ExportFile.uploadFile(csvFile); + ExportFile.exportWithDefaultJobProfile(csvFile, 'Default authority', 'Authorities'); + ExportFile.downloadExportedMarcFile(exportedMarcFile); + ExportFile.verifyFileIncludes(exportedMarcFile, [ + 'FOLIO23491', + 'FOLIO23492', + 'FOLIO23493', + 'FOLIO23494', + ]); }, ); }); diff --git a/cypress/fixtures/marcAuthFileForC503163.mrc b/cypress/fixtures/marcAuthFileForC503163.mrc index 4d3f826475..14c1258a14 100644 --- a/cypress/fixtures/marcAuthFileForC503163.mrc +++ b/cypress/fixtures/marcAuthFileForC503163.mrc @@ -1 +1 @@ -00492cz a2200169n 45000010008000000020011000080040011000190090011000300050017000410080041000580350023000990400032001220420009001541100080001634100049002436700030002926531319FOLIO23491FOLIO23493FOLIO2349420081202071231.0050504n| acannaabn |a ana  a(OCoLC)oca06624973 aSaPrNLbengcSaPrNLdSaPrNL asanb2 aC503163 Edit MARC auth which has control fields with or without subfield Sa2 aDC Talk (Musical group).tFanaties vir Jesus aFanaties vir Jesus, 2001. \ No newline at end of file +00515cz a2200181n 45000010008000000020011000080030011000190040011000300090011000410050017000520080041000690350023001100400032001330420009001651100080001744100049002546700030003036531319FOLIO23491FOLIO23492FOLIO23493FOLIO2349420081202071231.0050504n| acannaabn |a ana  a(OCoLC)oca06624973 aSaPrNLbengcSaPrNLdSaPrNL asanb2 aC503163 Edit MARC auth which has control fields with or without subfield Sa2 aDC Talk (Musical group).tFanaties vir Jesus aFanaties vir Jesus, 2001. \ No newline at end of file