Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdanihor committed Apr 18, 2024
2 parents 9168dee + f9ac05d commit a4e661c
Show file tree
Hide file tree
Showing 17 changed files with 859 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ describe('bulk-edit', () => {
electronicAccess: [
{
linkText: textWithSpecialCharacters,
// relationshipId: electronicAccessRelationshipId.RESOURCE,
uri: 'uri.com',
},
],
Expand Down Expand Up @@ -89,7 +88,7 @@ describe('bulk-edit', () => {
BulkEditActions.verifyOptionsDropdown();
BulkEditActions.isSelectActionAbsent();
BulkEditActions.selectOption('Link text');
let possibleActions = ['Clear field', 'Find', 'Replace with'];
let possibleActions = ['Clear field', 'Find (full field search)', 'Replace with'];
BulkEditActions.verifyPossibleActions(possibleActions);
BulkEditActions.selectSecondAction('Clear field');
BulkEditActions.addNewBulkEditFilterString();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
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 HoldingsRecordView from '../../../support/fragments/inventory/holdingsRecordView';
import InventoryInstances from '../../../support/fragments/inventory/inventoryInstances';
import InventorySearchAndFilter from '../../../support/fragments/inventory/inventorySearchAndFilter';
import TopMenu from '../../../support/fragments/topMenu';
import Users from '../../../support/fragments/users/users';
import FileManager from '../../../support/utils/fileManager';
import getRandomPostfix from '../../../support/utils/stringTools';
import ExportFile from '../../../support/fragments/data-export/exportFile';

let user;
const item = {
instanceName: `testBulkEdit_${getRandomPostfix()}`,
itemBarcode: getRandomPostfix(),
};
const publicNote = 'publicNote';
const newPublicNote = 'new publicNote';
const holdingUUIDsFileName = `holdingUUIDs_${getRandomPostfix()}.csv`;
const matchedRecordsFileName = `*-Matched-Records-${holdingUUIDsFileName}`;
const previewFileName = `*-Updates-Preview-${holdingUUIDsFileName}`;
const changedRecordsFileName = `*-Changed-Records-${holdingUUIDsFileName}`;

describe('bulk-edit', () => {
describe('in-app approach', () => {
before('create test data', () => {
cy.createTempUser([
permissions.bulkEditView.gui,
permissions.bulkEditEdit.gui,
permissions.inventoryAll.gui,
]).then((userProperties) => {
user = userProperties;

item.instanceId = InventoryInstances.createInstanceViaApi(
item.instanceName,
item.itemBarcode,
);
cy.getHoldings({ limit: 1, query: `"instanceId"="${item.instanceId}"` }).then(
(holdings) => {
item.holdingsHRID = holdings[0].hrid;
FileManager.createFile(`cypress/fixtures/${holdingUUIDsFileName}`, holdings[0].id);
cy.updateHoldingRecord(holdings[0].id, {
...holdings[0],
electronicAccess: [
{
publicNote,
uri: 'uri.com',
},
],
});
},
);
cy.login(user.username, user.password, {
path: TopMenu.bulkEditPath,
waiter: BulkEditSearchPane.waitLoading,
});
});
});

after('delete test data', () => {
cy.getAdminToken();
InventoryInstances.deleteInstanceAndHoldingRecordAndAllItemsViaApi(item.itemBarcode);
FileManager.deleteFile(`cypress/fixtures/${holdingUUIDsFileName}`);
FileManager.deleteFileFromDownloadsByMask(
matchedRecordsFileName,
changedRecordsFileName,
previewFileName,
);
Users.deleteViaApi(user.userId);
});

it(
'C422240 Verify Bulk Edit for Holding populated with "URL public note" in electronic access (firebird)',
{ tags: ['criticalPath', 'firebird'] },
() => {
BulkEditSearchPane.checkHoldingsRadio();
BulkEditSearchPane.selectRecordIdentifier('Holdings UUIDs');
BulkEditSearchPane.uploadFile(holdingUUIDsFileName);
BulkEditSearchPane.checkForUploading(holdingUUIDsFileName);
BulkEditSearchPane.waitFileUploading();
BulkEditActions.downloadMatchedResults();
BulkEditSearchPane.changeShowColumnCheckboxIfNotYet('Electronic access');
BulkEditSearchPane.verifySpecificItemsMatched(publicNote);
ExportFile.verifyFileIncludes(matchedRecordsFileName, [publicNote]);
BulkEditActions.openInAppStartBulkEditFrom();
BulkEditActions.verifyRowIcons();
BulkEditActions.verifyOptionsDropdown();
BulkEditActions.isSelectActionAbsent();
BulkEditActions.selectOption('URL public note');
let possibleActions = ['Clear field', 'Find (full field search)', 'Replace with'];
BulkEditActions.verifyPossibleActions(possibleActions);
BulkEditActions.selectSecondAction('Clear field');
BulkEditActions.addNewBulkEditFilterString();
BulkEditActions.verifyNewBulkEditRow();
BulkEditActions.verifyOptionAbsentInNewRow('URL public note');
BulkEditActions.deleteRow(1);
BulkEditActions.selectSecondAction('Replace with');
BulkEditActions.fillInSecondTextArea(publicNote);
BulkEditSearchPane.isConfirmButtonDisabled(false);
BulkEditActions.findValue('URL public note');
possibleActions = ['Replace with', 'Remove'];
BulkEditActions.verifyPossibleActions(possibleActions);
BulkEditSearchPane.isConfirmButtonDisabled(true);
BulkEditActions.selectSecondAction('Replace with');
BulkEditSearchPane.isConfirmButtonDisabled(true);
BulkEditActions.fillInFirstTextArea(publicNote);
BulkEditActions.fillInSecondTextArea(newPublicNote);
BulkEditSearchPane.isConfirmButtonDisabled(false);
BulkEditActions.selectSecondAction('Remove');
BulkEditActions.confirmChanges();
BulkEditSearchPane.verifyInputLabel(
'1 records will be changed if the Commit changes button is clicked. You may choose Download preview to review all changes prior to saving.',
);
BulkEditSearchPane.verifyElectronicAccessElementByIndex(4, '');
BulkEditActions.downloadPreview();
ExportFile.verifyFileIncludes(previewFileName, [';uri.com;;;"']);
BulkEditActions.commitChanges();
BulkEditSearchPane.waitFileUploading();
BulkEditSearchPane.verifyElectronicAccessElementByIndex(4, '');
BulkEditActions.openActions();
BulkEditActions.downloadChangedCSV();
ExportFile.verifyFileIncludes(changedRecordsFileName, [';uri.com;;;"']);

cy.visit(TopMenu.inventoryPath);
InventorySearchAndFilter.switchToHoldings();
InventorySearchAndFilter.searchByParameter('Holdings HRID', item.holdingsHRID);
InventorySearchAndFilter.selectSearchResultItem();
InventorySearchAndFilter.selectViewHoldings();
HoldingsRecordView.verifyElectronicAccessByElementIndex(4, '-');
},
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('bulk-edit', () => {
BulkEditSearchPane.changeShowColumnCheckboxIfNotYet('Electronic access');
BulkEditActions.openInAppStartBulkEditFrom();
BulkEditActions.selectOption('URI');
const possibleActions = ['Clear field', 'Find', 'Replace with'];
const possibleActions = ['Clear field', 'Find (full field search)', 'Replace with'];
BulkEditActions.verifyPossibleActions(possibleActions);
BulkEditActions.selectAction('Clear field');
BulkEditActions.addNewBulkEditFilterString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('bulk-edit', () => {
BulkEditActions.verifyOptionsDropdown();
BulkEditActions.isSelectActionAbsent();
BulkEditActions.selectOption('URL Relationship');
let possibleActions = ['Clear field', 'Find', 'Replace with'];
let possibleActions = ['Clear field', 'Find (full field search)', 'Replace with'];
BulkEditActions.verifyPossibleActions(possibleActions);
BulkEditActions.selectSecondAction('Clear field');
BulkEditActions.addNewBulkEditFilterString();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import Permissions from '../../../../support/dictionary/permissions';
import MarcAuthority from '../../../../support/fragments/marcAuthority/marcAuthority';
import QuickMarcEditor from '../../../../support/fragments/quickMarcEditor';
import TopMenu from '../../../../support/fragments/topMenu';
import Users from '../../../../support/fragments/users/users';
import MarcAuthorities from '../../../../support/fragments/marcAuthority/marcAuthorities';
import ManageAuthorityFiles from '../../../../support/fragments/settings/marc-authority/manageAuthorityFiles';
import { DEFAULT_FOLIO_AUTHORITY_FILES } from '../../../../support/constants';

describe('MARC', () => {
describe('MARC Authority', () => {
describe('Create MARC Authority', () => {
const headerText = 'Create a new MARC authority record';
const newField010 = {
rowIndex: 3,
tag: '010',
content: '$a n000232',
};
const newField100 = {
rowIndex: 4,
tag: '100',
content: '$a C423509 999 multiple test',
};
const newField999 = {
rowIndex: 6,
tag: '999',
content: '$s 999test $i multiple999',
indicator0: 'f',
indicator1: 'f',
};
const users = {};
let createdAuthorityId;

before('Create users, data', () => {
cy.getAdminToken();
cy.createTempUser([
Permissions.uiMarcAuthoritiesAuthorityRecordView.gui,
Permissions.uiQuickMarcQuickMarcAuthorityCreate.gui,
Permissions.uiMarcAuthoritiesAuthorityRecordCreate.gui,
])
.then((userProperties) => {
users.userProperties = userProperties;

ManageAuthorityFiles.setAllDefaultFOLIOFilesToActiveViaAPI();
})
.then(() => {
cy.login(users.userProperties.username, users.userProperties.password, {
path: TopMenu.marcAuthorities,
waiter: MarcAuthorities.waitLoading,
});
});
});

after('Delete users, data', () => {
cy.getAdminToken();
Users.deleteViaApi(users.userProperties.userId);
MarcAuthority.deleteViaAPI(createdAuthorityId);
ManageAuthorityFiles.unsetAllDefaultFOLIOFilesAsActiveViaAPI();
});

it(
'C423509 Create a new MARC authority record with multiple "999" field (spitfire)',
{ tags: ['criticalPath', 'spitfire'] },
() => {
// 1 Click on "Actions" button in second pane >> Select "+ New" option
MarcAuthorities.clickNewAuthorityButton();
QuickMarcEditor.checkPaneheaderContains(headerText);

// 2 Click on "Authority file look-up" hyperlink
// Click on the "Select authority file" placeholder in "Authority file name" dropdown
// Select any option
// Click on the "Save & close" button in "Select authority file" modal
QuickMarcEditor.clickAuthorityLookUpButton();
QuickMarcEditor.selectAuthorityFile(DEFAULT_FOLIO_AUTHORITY_FILES.LC_NAME_AUTHORITY_FILE);
QuickMarcEditor.clickSaveAndCloseInModal();
QuickMarcEditor.checkPaneheaderContains(headerText);

// 3 Add 2 new fields by clicking on "+" icon and fill them as specified:
// 010 \\ "$a <<enter a value in format <Prefix><Value> in accordance to selected authority file>>", ex.: "n000232"
// 100 \\ "$a 999 multiple test"
MarcAuthority.addNewField(newField010.rowIndex, newField010.tag, newField010.content);
MarcAuthority.addNewField(newField100.rowIndex, newField100.tag, newField100.content);
QuickMarcEditor.checkContentByTag(newField010.tag, newField010.content);
QuickMarcEditor.checkContentByTag(newField100.tag, newField100.content);

// 4 Click on the "+" icon next to any field
QuickMarcEditor.addEmptyFields(5);

// 5 Fill in the added field with following values (fill in in following sequence):
// 4th box - "$s 999test $i multiple999"
// 3rd box - "f"
// 2nd box - "f"
// 1st box - "999"
QuickMarcEditor.fillInFieldValues(
newField999.rowIndex,
newField999.tag,
newField999.content,
newField999.indicator0,
newField999.indicator1,
);
QuickMarcEditor.checkContent(newField999.content, newField999.rowIndex);
QuickMarcEditor.verifyAllBoxesInARowAreDisabled(newField999.rowIndex);

// 6 Click on the "Save & close" button
QuickMarcEditor.pressSaveAndClose();
MarcAuthority.verifyAfterSaveAndClose();
QuickMarcEditor.verifyPaneheaderWithContentAbsent(headerText);
MarcAuthorities.verifyViewPaneContentExists();
MarcAuthority.getId().then((id) => {
createdAuthorityId = id;

MarcAuthorities.checkFieldAndContentExistence(
newField999.tag,
`${newField999.indicator0} ${newField999.indicator1}`,
);
MarcAuthorities.checkFieldAndContentExistence(newField999.tag, '$s');
MarcAuthorities.checkFieldAndContentExistence(
newField999.tag,
`$i ${createdAuthorityId}`,
);
MarcAuthorities.verifyViewPaneContentAbsent(newField999.content);
});
},
);
});
});
});
Loading

0 comments on commit a4e661c

Please sign in to comment.