From 42af47d46ea68937e1bd09e4b9c46ba8164fe683 Mon Sep 17 00:00:00 2001 From: Sviatlana Stsiapanava <152482600+sviatlana-stsiapanava@users.noreply.github.com> Date: Mon, 13 Jan 2025 20:37:48 +0500 Subject: [PATCH] FAT-17417 Support automated tests (#4625) * Stabilize test cases --- ...umn-names-under-show-columns-section.cy.js | 2 +- ...perties-columns-in-are-you-sure-form.cy.js | 2 +- ...perties-columns-in-are-you-sure-form.cy.js | 9 +- ...-item-notes-remove-all-add-same-type.cy.js | 85 +++++++++++++++---- ...app-items-staff-only-for-added-notes.cy.js | 73 +++++++++++++--- .../bulk-edit-in-app-user-toggles.cy.js | 2 +- ...ulk-edit-logs-in-app-instances-uuids.cy.js | 4 +- cypress/support/constants.js | 3 + 8 files changed, 145 insertions(+), 35 deletions(-) diff --git a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-column-names-under-show-columns-section.cy.js b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-column-names-under-show-columns-section.cy.js index 8827771cc3..02a3d54823 100644 --- a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-column-names-under-show-columns-section.cy.js +++ b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-column-names-under-show-columns-section.cy.js @@ -136,7 +136,7 @@ describe('bulk-edit', () => { const defaultColumnHeaders = Object.values( BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS, - ); + ).slice(0, -2); BulkEditFiles.verifyColumnHeaderExistsInCsvFile( matchedRecordsFileName, diff --git a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-only-updated-properties-columns-in-are-you-sure-form.cy.js b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-only-updated-properties-columns-in-are-you-sure-form.cy.js index 5fcde19984..d9a9af7249 100644 --- a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-only-updated-properties-columns-in-are-you-sure-form.cy.js +++ b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-only-updated-properties-columns-in-are-you-sure-form.cy.js @@ -226,7 +226,7 @@ describe('bulk-edit', () => { const arrayOfColumnHeaders = Object.values( BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS, - ); + ).slice(0, -2); BulkEditActions.downloadPreview(); ExportFile.verifyFileIncludes(previewFileName, [ diff --git a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-properties-columns-in-are-you-sure-form.cy.js b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-properties-columns-in-are-you-sure-form.cy.js index 9fae16ecae..086a151bde 100644 --- a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-properties-columns-in-are-you-sure-form.cy.js +++ b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-holdings-properties-columns-in-are-you-sure-form.cy.js @@ -215,9 +215,14 @@ describe('bulk-edit', () => { BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS.ELECTRONIC_ACCESS, [newURI], ); + + const holdingFieldHeaders = Object.values( + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS, + ).slice(0, -2); + BulkEditActions.downloadPreview(); ExportFile.verifyFileIncludes(previewFileName, [ - Object.values(BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS), + holdingFieldHeaders, electronicAccessValue, ...editedValueSets, ]); @@ -240,7 +245,7 @@ describe('bulk-edit', () => { BulkEditActions.openActions(); BulkEditActions.downloadChangedCSV(); ExportFile.verifyFileIncludes(changedRecordsFileName, [ - Object.values(BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_HOLDINGS), + holdingFieldHeaders, electronicAccessValue, ...editedValueSets, ]); diff --git a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-item-notes-remove-all-add-same-type.cy.js b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-item-notes-remove-all-add-same-type.cy.js index 848ef3f27e..8cf8544e4a 100644 --- a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-item-notes-remove-all-add-same-type.cy.js +++ b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-item-notes-remove-all-add-same-type.cy.js @@ -1,7 +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 ExportFile from '../../../support/fragments/data-export/exportFile'; +import BulkEditFiles from '../../../support/fragments/bulk-edit/bulk-edit-files'; import InventoryInstances from '../../../support/fragments/inventory/inventoryInstances'; import InventorySearchAndFilter from '../../../support/fragments/inventory/inventorySearchAndFilter'; import ItemRecordView from '../../../support/fragments/inventory/item/itemRecordView'; @@ -10,7 +10,11 @@ import TopMenuNavigation from '../../../support/fragments/topMenuNavigation'; import Users from '../../../support/fragments/users/users'; import FileManager from '../../../support/utils/fileManager'; import getRandomPostfix from '../../../support/utils/stringTools'; -import { ITEM_NOTES, MATERIAL_TYPE_IDS } from '../../../support/constants'; +import { + BULK_EDIT_TABLE_COLUMN_HEADERS, + ITEM_NOTES, + MATERIAL_TYPE_IDS, +} from '../../../support/constants'; let user; @@ -99,11 +103,30 @@ describe('bulk-edit', () => { BulkEditSearchPane.waitFileUploading(); BulkEditSearchPane.verifyMatchedResults(item.barcode); BulkEditActions.downloadMatchedResults(); - ExportFile.verifyFileIncludes(matchedRecordsFileName, [ - `,${notes.admin},dvd,`, - `,${notes.copy},${notes.electronicBookplate}`, - `,${notes.checkIn},${notes.checkOut},`, - ]); + BulkEditFiles.verifyHeaderValueInRowByIdentifier( + matchedRecordsFileName, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.BARCODE, + item.barcode, + [ + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.ADMINISTRATIVE_NOTE, + value: notes.admin, + }, + { header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.COPY_NOTE, value: notes.copy }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.ELECTRONIC_BOOKPLATE_NOTE, + value: notes.electronicBookplate, + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.CHECK_IN_NOTE, + value: notes.checkIn, + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.CHECK_OUT_NOTE, + value: notes.checkOut, + }, + ], + ); BulkEditSearchPane.changeShowColumnCheckboxIfNotYet( 'Administrative note', 'Copy note', @@ -128,11 +151,37 @@ describe('bulk-edit', () => { notes.electronicBookplate, ]); BulkEditActions.downloadPreview(); - ExportFile.verifyFileIncludes(previewFileName, [ - ',,dvd,', - `,${notes.action},,,`, - 'Available,,,', - ]); + + const editedHeaderValues = [ + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.ADMINISTRATIVE_NOTE, + value: '', + }, + { header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.COPY_NOTE, value: '' }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.ELECTRONIC_BOOKPLATE_NOTE, + value: notes.electronicBookplate, + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.CHECK_IN_NOTE, + value: '', + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.CHECK_OUT_NOTE, + value: '', + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.ACTION_NOTE, + value: notes.action, + }, + ]; + + BulkEditFiles.verifyHeaderValueInRowByIdentifier( + previewFileName, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.BARCODE, + item.barcode, + editedHeaderValues, + ); BulkEditActions.commitChanges(); BulkEditSearchPane.waitFileUploading(); BulkEditSearchPane.verifyExactChangesUnderColumns('Administrative note', ''); @@ -146,11 +195,13 @@ describe('bulk-edit', () => { BulkEditSearchPane.verifyExactChangesUnderColumns('Check out note', ''); BulkEditActions.openActions(); BulkEditActions.downloadChangedCSV(); - ExportFile.verifyFileIncludes(changedRecordsFileName, [ - ',,dvd,', - `,${notes.action},,,`, - 'Available,,,', - ]); + + BulkEditFiles.verifyHeaderValueInRowByIdentifier( + changedRecordsFileName, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.BARCODE, + item.barcode, + editedHeaderValues, + ); TopMenuNavigation.navigateToApp('Inventory'); InventorySearchAndFilter.switchToItem(); diff --git a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-items-staff-only-for-added-notes.cy.js b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-items-staff-only-for-added-notes.cy.js index 4591728062..53c5ee1bef 100644 --- a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-items-staff-only-for-added-notes.cy.js +++ b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-items-staff-only-for-added-notes.cy.js @@ -9,8 +9,14 @@ import FileManager from '../../../support/utils/fileManager'; import getRandomPostfix from '../../../support/utils/stringTools'; import ExportFile from '../../../support/fragments/data-export/exportFile'; import ItemRecordView from '../../../support/fragments/inventory/item/itemRecordView'; -import { APPLICATION_NAMES, ITEM_NOTES, MATERIAL_TYPE_IDS } from '../../../support/constants'; +import { + APPLICATION_NAMES, + BULK_EDIT_TABLE_COLUMN_HEADERS, + ITEM_NOTES, + MATERIAL_TYPE_IDS, +} from '../../../support/constants'; import TopMenuNavigation from '../../../support/fragments/topMenuNavigation'; +import BulkEditFiles from '../../../support/fragments/bulk-edit/bulk-edit-files'; let user; const item = { @@ -221,21 +227,66 @@ describe('bulk-edit', () => { `${notes.reproduction} (staff only)`, ); BulkEditActions.downloadPreview(); - ExportFile.verifyFileIncludes(previewFileName, [ - `${notes.action},${notes.binding} (staff only),${notes.copy} (staff only),,${notes.note} (staff only),${notes.provenance},${notes.reproduction} (staff only)`, - `Available,${notes.checkIn},${notes.checkOut} (staff only),`, - `,${notes.admin},dvd,`, - ]); + + const addedNoteHeaderValues = [ + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.ADMINISTRATIVE_NOTE, + value: notes.admin, + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.PROVENANCE_NOTE, + value: notes.provenance, + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.REPRODUCTION_NOTE, + value: `${notes.reproduction} (staff only)`, + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.NOTE, + value: `${notes.note} (staff only)`, + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.ACTION_NOTE, + value: notes.action, + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.BINDING_NOTE, + value: `${notes.binding} (staff only)`, + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.COPY_NOTE, + value: `${notes.copy} (staff only)`, + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.ELECTRONIC_BOOKPLATE_NOTE, + value: '', + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.CHECK_IN_NOTE, + value: notes.checkIn, + }, + { + header: BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.CHECK_OUT_NOTE, + value: `${notes.checkOut} (staff only)`, + }, + ]; + BulkEditFiles.verifyHeaderValueInRowByIdentifier( + previewFileName, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.BARCODE, + item.itemBarcode, + addedNoteHeaderValues, + ); BulkEditActions.commitChanges(); BulkEditSearchPane.waitFileUploading(); BulkEditActions.openActions(); BulkEditSearchPane.changeShowColumnCheckboxIfNotYet('Check out note', 'Check in note'); BulkEditActions.downloadChangedCSV(); - ExportFile.verifyFileIncludes(changedRecordsFileName, [ - `${notes.action},${notes.binding} (staff only),${notes.copy} (staff only),,${notes.note} (staff only),${notes.provenance},${notes.reproduction} (staff only)`, - `Available,${notes.checkIn},${notes.checkOut} (staff only),`, - `,${notes.admin},dvd,`, - ]); + BulkEditFiles.verifyHeaderValueInRowByIdentifier( + changedRecordsFileName, + BULK_EDIT_TABLE_COLUMN_HEADERS.INVENTORY_ITEMS.BARCODE, + item.itemBarcode, + addedNoteHeaderValues, + ); BulkEditSearchPane.verifyExactChangesUnderColumns('Administrative note', notes.admin); BulkEditSearchPane.verifyExactChangesUnderColumns( 'Check out note', diff --git a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-user-toggles.cy.js b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-user-toggles.cy.js index fc98a49d35..cdc1951b93 100644 --- a/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-user-toggles.cy.js +++ b/cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-user-toggles.cy.js @@ -76,7 +76,7 @@ describe('bulk-edit', () => { BulkEditLogs.resetAll(); BulkEditLogs.verifyLogsPane(); BulkEditSearchPane.openIdentifierSearch(); - cy.wait(2000); + cy.wait(12000); BulkEditSearchPane.verifyMatchedResults(user.username); BulkEditSearchPane.openIdentifierSearch(); BulkEditSearchPane.verifyMatchedResults(user.username); diff --git a/cypress/e2e/bulk-edit/logs/in-app/bulk-edit-logs-in-app-instances-uuids.cy.js b/cypress/e2e/bulk-edit/logs/in-app/bulk-edit-logs-in-app-instances-uuids.cy.js index f32fa9908a..db604410fc 100644 --- a/cypress/e2e/bulk-edit/logs/in-app/bulk-edit-logs-in-app-instances-uuids.cy.js +++ b/cypress/e2e/bulk-edit/logs/in-app/bulk-edit-logs-in-app-instances-uuids.cy.js @@ -124,7 +124,7 @@ describe('bulk-edit', () => { `${folioItem.instanceId},false,true,`, `${marcInstances[0].instanceId},false,true,`, `${unsuppressedFolioItem.instanceId},false,false,`, - `${marcInstances[1].instanceId},false,,`, + `${marcInstances[1].instanceId},false,false`, ]); BulkEditActions.openStartBulkEditInstanceForm(); BulkEditActions.verifyModifyLandingPageBeforeModifying(); @@ -187,7 +187,7 @@ describe('bulk-edit', () => { `${folioItem.instanceId},false,true,`, `${marcInstances[0].instanceId},false,true,`, `${unsuppressedFolioItem.instanceId},false,false,`, - `${marcInstances[1].instanceId},false,,`, + `${marcInstances[1].instanceId},false,false`, ]); BulkEditLogs.downloadFileWithProposedChanges(); diff --git a/cypress/support/constants.js b/cypress/support/constants.js index 76145ac619..babbaaba05 100644 --- a/cypress/support/constants.js +++ b/cypress/support/constants.js @@ -995,6 +995,9 @@ export const BULK_EDIT_TABLE_COLUMN_HEADERS = { SUPPRESS_FROM_DISCOVERY: 'Suppress from discovery', PERMANENT_LOAN_TYPE: 'Permanent loan type', TEMPORARY_LOAN_TYPE: 'Temporary loan type', + COPY_NOTE: 'Copy note', + REPRODUCTION_NOTE: 'Reproduction note', + NOTE: 'Note', }, };