Skip to content

Commit

Permalink
Merge branch 'master' into FAT-11016
Browse files Browse the repository at this point in the history
  • Loading branch information
re-jas committed Mar 15, 2024
2 parents d8ba578 + f556086 commit 52af4da
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('bulk-edit', () => {
permissions.bulkEditEdit.gui,
permissions.uiInventoryViewCreateEditItems.gui,
]).then((userProperties) => {
ItemNoteTypes.createNoteTypeViaApi(noteType).then((noteId) => {
ItemNoteTypes.createItemNoteTypeViaApi(noteType).then((noteId) => {
noteTypeId = noteId;
});
InventoryInstances.createInstanceViaApi(item.instanceName, item.barcode);
Expand Down Expand Up @@ -61,7 +61,7 @@ describe('bulk-edit', () => {

after('delete test data', () => {
cy.getAdminToken();
ItemNoteTypes.deleteNoteTypeViaApi(noteTypeId);
ItemNoteTypes.deleteItemNoteTypeViaApi(noteTypeId);
InventoryInstances.deleteInstanceAndHoldingRecordAndAllItemsViaApi(item.barcode);
Users.deleteViaApi(user.userId);
FileManager.deleteFile(`cypress/fixtures/${itemBarcodesFileName}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('bulk-edit', () => {
FileManager.createFile(`cypress/fixtures/${itemHRIDsFileName}`, item.hrid);
},
);
ItemNoteTypes.createNoteTypeViaApi(noteType).then((noteId) => {
ItemNoteTypes.createItemNoteTypeViaApi(noteType).then((noteId) => {
noteTypeId = noteId;
});
cy.login(user.username, user.password, {
Expand Down Expand Up @@ -104,7 +104,7 @@ describe('bulk-edit', () => {
ItemRecordView.checkItemNote(itemNote, 'No', noteType);

cy.getAdminToken();
ItemNoteTypes.deleteNoteTypeViaApi(noteTypeId);
ItemNoteTypes.deleteItemNoteTypeViaApi(noteTypeId);

cy.getToken(user.username, user.password);
cy.visit(TopMenu.bulkEditPath);
Expand Down
24 changes: 12 additions & 12 deletions cypress/e2e/bulk-edit/in-app/bulk-edit-in-app-items.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ let user;
const item = {
instanceName: `testBulkEdit_${getRandomPostfix()}`,
itemBarcode: getRandomPostfix(),
accessionNumber: getRandomPostfix(),
};
const invalidItemBarcodesFileName = `invalidItemBarcodes_${getRandomPostfix()}.csv`;
const validItemBarcodesFileName = `validItemBarcodes_${getRandomPostfix()}.csv`;
Expand All @@ -30,23 +29,24 @@ describe('bulk-edit', () => {
]).then((userProperties) => {
user = userProperties;

InventoryInstances.createInstanceViaApi(
item.instanceName,
item.itemBarcode,
null,
'1',
'2',
item.accessionNumber,
);
InventoryInstances.createInstanceViaApi(item.instanceName, item.itemBarcode);

FileManager.createFile(
`cypress/fixtures/${invalidItemBarcodesFileName}`,
`${item.itemBarcode}\r\n${invalidBarcode}`,
);
FileManager.createFile(`cypress/fixtures/${validItemBarcodesFileName}`, item.itemBarcode);
FileManager.createFile(
`cypress/fixtures/${validItemAccessionNumbersFileName}`,
item.accessionNumber,

cy.getItems({ limit: 1, expandAll: true, query: `"barcode"=="${item.itemBarcode}"` }).then(
(res) => {
const itemData = res;
itemData.accessionNumber = `testBulkEditAccessionNumber_${getRandomPostfix()}`;
cy.updateItemViaApi(itemData);
FileManager.createFile(
`cypress/fixtures/${validItemAccessionNumbersFileName}`,
itemData.accessionNumber,
);
},
);
cy.login(user.username, user.password, {
path: TopMenu.bulkEditPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ describe('Bulk Edit - Logs', () => {
cy.getInstanceById(item.instanceId).then((body) => {
body.discoverySuppress = true;
cy.updateInstance(body);
item.instanceHRID = body.hrid;
FileManager.createFile(`cypress/fixtures/${instanceHRIDFileName}`, item.instanceHRID);
});
cy.getInstance({ limit: 1, expandAll: true, query: `"id"=="${item.instanceId}"` }).then(
(instance) => {
item.instanceHRID = instance.hrid;
FileManager.createFile(`cypress/fixtures/${instanceHRIDFileName}`, item.instanceHRID);
},
);
cy.login(user.username, user.password, {
path: TopMenu.bulkEditPath,
waiter: BulkEditSearchPane.waitLoading,
Expand Down
11 changes: 6 additions & 5 deletions cypress/e2e/marc/marc-holdings/moving-items.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import InventoryInstances from '../../../support/fragments/inventory/inventoryIn
import InventorySearchAndFilter from '../../../support/fragments/inventory/inventorySearchAndFilter';
import InventorySteps from '../../../support/fragments/inventory/inventorySteps';
import InventoryViewSource from '../../../support/fragments/inventory/inventoryViewSource';
import ItemRecordView from '../../../support/fragments/inventory/item/itemRecordView';
import Z3950TargetProfiles from '../../../support/fragments/settings/inventory/integrations/z39.50TargetProfiles';
import ServicePoints from '../../../support/fragments/settings/tenant/servicePoints/servicePoints';
import TopMenu from '../../../support/fragments/topMenu';
Expand All @@ -25,6 +24,7 @@ describe('MARC', () => {
let firstHolding = '';
let secondHolding = '';
let ITEM_BARCODE;
const instanceTitle = `Barcode search test ${Number(new Date())}`;

before(() => {
cy.getAdminToken().then(() => {
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('MARC', () => {
cy.createInstance({
instance: {
instanceTypeId: Cypress.env('instanceTypes')[0].id,
title: `Barcode search test ${Number(new Date())}`,
title: instanceTitle,
},
holdings: [
{
Expand All @@ -98,6 +98,9 @@ describe('MARC', () => {
],
],
});
cy.wait(5000);
cy.login(userProperties.username, userProperties.password);
cy.visit(TopMenu.inventoryPath);
});
});
});
Expand All @@ -122,9 +125,7 @@ describe('MARC', () => {
{ tags: ['smoke', 'firebird'] },
() => {
InventorySearchAndFilter.switchToItem();
InventorySearchAndFilter.searchByParameter('Barcode', ITEM_BARCODE);
InventorySearchAndFilter.selectSearchResultItem();
ItemRecordView.closeDetailView();
InventorySearchAndFilter.byKeywords(instanceTitle);
InventoryInstance.openMoveItemsWithinAnInstance();

InventoryInstance.moveItemToAnotherHolding({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import uuid from 'uuid';
import { REQUEST_METHOD } from '../../../../constants';
import {
Button,
Expand All @@ -12,17 +13,31 @@ export const reasonsActions = {
};

export default {
createNoteTypeViaApi: (body) => {
return cy
.okapiRequest({
method: REQUEST_METHOD.POST,
path: 'item-note-types',
body,
})
.then((response) => response.body.id);
createItemNoteTypeViaApi: (bodyOrName) => {
if (Cypress.env('ecsEnabled')) {
return cy
.okapiRequest({
method: REQUEST_METHOD.POST,
path: 'item-note-types',
bodyOrName,
})
.then((response) => response.body.id);
} else {
return cy
.okapiRequest({
method: REQUEST_METHOD.POST,
path: 'item-note-types',
body: {
id: uuid(),
name: bodyOrName,
source: 'local',
},
})
.then((response) => response.body.id);
}
},

deleteNoteTypeViaApi: (noteTypeId) => {
deleteItemNoteTypeViaApi: (noteTypeId) => {
return cy.okapiRequest({
method: REQUEST_METHOD.DELETE,
path: `item-note-types/${noteTypeId}`,
Expand Down
7 changes: 6 additions & 1 deletion cypress/support/fragments/users/userEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ export default {
},

openSelectPermissionsModal() {
cy.do(permissionsAccordion.clickHeader());
cy.get('#permissions').then(($accordion) => {
if ($accordion.attr('expanded') !== 'true') {
cy.wait(2000);
cy.do(permissionsAccordion.clickHeader());
}
});
cy.do(addPermissionsButton.click());
cy.expect(selectPermissionsModal.exists());
},
Expand Down

0 comments on commit 52af4da

Please sign in to comment.