Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C399065 Verify that special characters in Item Barcode are NOT treated as wildcards for Bulk Edit (firebird) (TaaS) #2447

Merged
merged 5 commits into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-item-no-wildcard.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import TopMenu from '../../../support/fragments/topMenu';
import permissions from '../../../support/dictionary/permissions';
import BulkEditSearchPane from '../../../support/fragments/bulk-edit/bulk-edit-search-pane';
import InventoryInstances from '../../../support/fragments/inventory/inventoryInstances';
import getRandomPostfix from '../../../support/utils/stringTools';
import FileManager from '../../../support/utils/fileManager';
import Users from '../../../support/fragments/users/users';
import BulkEditActions from '../../../support/fragments/bulk-edit/bulk-edit-actions';
import ExportFile from '../../../support/fragments/data-export/exportFile';
import InventorySearchAndFilter from '../../../support/fragments/inventory/inventorySearchAndFilter';
import ItemRecordView from '../../../support/fragments/inventory/item/itemRecordView';

let user;

const firstItem = {
barcode: `firstItem-${getRandomPostfix()}`,
instanceName: `firstInstance-${getRandomPostfix()}`,
};
const secondItem = {
barcode: `secondItem-${getRandomPostfix()}`,
instanceName: `secondInstance-${getRandomPostfix()}`,
};
const thirdItem = {
barcode: `thirdItem-${getRandomPostfix()}`,
instanceName: `thirdInstance-${getRandomPostfix()}`,
};
const allBarcodes = [
firstItem.barcode,
`secondBarcode_${firstItem.barcode}`,
secondItem.barcode,
`secondBarcode_${secondItem.barcode}`,
thirdItem.barcode,
`secondBarcode_${thirdItem.barcode}`,
];
const newBarcodes = [
`1017625*-AMA${getRandomPostfix()}`,
`1017625345-AMA${getRandomPostfix()}`,
`101762534?-BBB${getRandomPostfix()}`,
`1017625345-BBB${getRandomPostfix()}`,
`1017625345^DDD${getRandomPostfix()}`,
`1017625345${getRandomPostfix()}`,
];
const itemsToEdit = [newBarcodes[0], newBarcodes[2], newBarcodes[4]];
const itemBarcodesFileName = `itemBarcodes_${getRandomPostfix()}.csv`;
const matchedRecordsFileName = `*Matched-Records-${itemBarcodesFileName}`;
const changedRecordsFileName = `*-Changed-Records-${itemBarcodesFileName}`;

describe('bulk-edit', () => {
describe('in-app approach', () => {
before('create test data', () => {
cy.createTempUser([
permissions.bulkEditEdit.gui,
permissions.uiInventoryViewCreateEditItems.gui,
]).then((userProperties) => {
// Create three instances with two barcodes each
[firstItem, secondItem, thirdItem].forEach(item => {
InventoryInstances.createInstanceViaApi(item.instanceName, item.barcode);
});

// Update all six items with new barcodes
for (let i = 0; i < allBarcodes.length; i++) {
cy.getItems({ limit: 1, expandAll: true, query: `"barcode"=="${allBarcodes[i]}"` }).then(
(res) => {
res.barcode = newBarcodes[i];
cy.updateItemViaApi(res);
},
);
}

// Put three item barcodes into file
FileManager.createFile(`cypress/fixtures/${itemBarcodesFileName}`,
`${newBarcodes[0]}\n${newBarcodes[2]}\n${newBarcodes[4]}`);

user = userProperties;
cy.login(user.username, user.password, {
path: TopMenu.bulkEditPath,
waiter: BulkEditSearchPane.waitLoading,
});
});
});

after('delete test data', () => {
itemsToEdit.forEach((item) => {
InventoryInstances.deleteInstanceAndHoldingRecordAndAllItemsViaApi(item);
});
Users.deleteViaApi(user.userId);
FileManager.deleteFile(`cypress/fixtures/${itemBarcodesFileName}`);
FileManager.deleteFileFromDownloadsByMask(matchedRecordsFileName);
FileManager.deleteFileFromDownloadsByMask(changedRecordsFileName);
});

it(
'C399065 Verify that special characters in Item Barcode are NOT treated as wildcards for Bulk Edit (firebird) (TaaS)',
{ tags: ['extendedPath', 'firebird'] },
() => {
BulkEditSearchPane.checkItemsRadio();
BulkEditSearchPane.selectRecordIdentifier('Item barcode');

BulkEditSearchPane.uploadFile(itemBarcodesFileName);
BulkEditSearchPane.waitFileUploading();
BulkEditSearchPane.verifyMatchedResults(newBarcodes[0], newBarcodes[2], newBarcodes[4]);
BulkEditActions.downloadMatchedResults();
ExportFile.verifyFileIncludes(matchedRecordsFileName, itemsToEdit);

BulkEditActions.openInAppStartBulkEditFrom();
BulkEditActions.replacePermanentLocation('Online (E)');
BulkEditActions.confirmChanges();
[newBarcodes[0], newBarcodes[2], newBarcodes[4]].forEach((barcode) => {
BulkEditActions.verifyChangesInAreYouSureForm('Barcode', [barcode]);
});
BulkEditActions.commitChanges();
BulkEditSearchPane.waitFileUploading();
BulkEditActions.openActions();
BulkEditActions.downloadChangedCSV();
ExportFile.verifyFileIncludes(changedRecordsFileName, itemsToEdit);

itemsToEdit.forEach((item) => {
cy.visit(TopMenu.inventoryPath);
InventorySearchAndFilter.switchToItem();
InventorySearchAndFilter.searchByParameter('Barcode', item);
ItemRecordView.waitLoading();
ItemRecordView.verifyPermanentLocation('Online');
});
}
);
});
});
Loading