Skip to content

Commit

Permalink
FIX C735 (#824)
Browse files Browse the repository at this point in the history
* FIX C735

* FIX C735

* FIX C735
  • Loading branch information
IhorBohdan authored Feb 1, 2023
1 parent 934d7d3 commit d78a5a4
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 22 deletions.
58 changes: 38 additions & 20 deletions cypress/e2e/orders/receive-piece-from-order.cy.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,85 @@
import permissions from '../../support/dictionary/permissions';
import devTeams from '../../support/dictionary/devTeams';
import testType from '../../support/dictionary/testTypes';
import NewOrder from '../../support/fragments/orders/newOrder';
import BasicOrderLine from '../../support/fragments/orders/basicOrderLine';
import testType from '../../support/dictionary/testTypes';
import Orders from '../../support/fragments/orders/orders';
import Receiving from '../../support/fragments/receiving/receiving';
import TopMenu from '../../support/fragments/topMenu';
import Helper from '../../support/fragments/finance/financeHelper';
import InventorySearchAndFilter from '../../support/fragments/inventory/inventorySearchAndFilter';
import InventoryInstance from '../../support/fragments/inventory/inventoryInstance';
import InteractorsTools from '../../support/utils/interactorsTools';
import OrdersHelper from '../../support/fragments/orders/ordersHelper';
import Organizations from '../../support/fragments/organizations/organizations';
import devTeams from '../../support/dictionary/devTeams';
import NewOrganization from '../../support/fragments/organizations/newOrganization';
import OrderLines from '../../support/fragments/orders/orderLines';
import Users from '../../support/fragments/users/users';
import ItemRecordView from '../../support/fragments/inventory/itemRecordView';

describe('orders: Receive piece from Order', () => {
const order = { ...NewOrder.defaultOneTimeOrder };
const orderLine = { ...BasicOrderLine.defaultOrderLine };
const order = {
...NewOrder.defaultOneTimeOrder,
approved: true,
};
const organization = { ...NewOrganization.defaultUiOrganizations };
const orderLineTitle = BasicOrderLine.defaultOrderLine.titleOrPackage;
let orderNumber;
let user;

before(() => {
cy.getAdminToken();
Organizations.createOrganizationViaApi(organization)
.then(response => {
organization.id = response;
order.vendor = response;
orderLine.physical.materialSupplier = response;
orderLine.eresource.accessProvider = response;
});
cy.getLocations({ query: `name="${OrdersHelper.mainLibraryLocation}"` })
.then(location => { orderLine.locations[0].locationId = location.id; });
cy.getMaterialTypes({ query: 'name="book"' })
.then(materialType => { orderLine.physical.materialType = materialType.id; });
cy.login(Cypress.env('diku_login'), Cypress.env('diku_password'));
cy.createOrderApi(order)
.then((orderResponse) => {
orderNumber = orderResponse.body.poNumber;
cy.loginAsAdmin({ path:TopMenu.ordersPath, waiter: Orders.waitLoading });
Orders.searchByParameter('PO number', orderNumber);
Orders.selectFromResultsList(orderNumber);
OrderLines.addPOLine();
OrderLines.POLineInfodorPhysicalMaterial(orderLineTitle);
});
cy.createTempUser([
permissions.uiOrdersView.gui,
permissions.uiOrdersApprovePurchaseOrders.gui,
permissions.uiOrdersReopenPurchaseOrders.gui,
permissions.uiInventoryViewInstances.gui,
permissions.uiReceivingViewEditCreate.gui,

])
.then(userProperties => {
user = userProperties;
cy.login(userProperties.username, userProperties.password, { path:TopMenu.ordersPath, waiter: Orders.waitLoading });
});
});

after(() => {
Orders.deleteOrderApi(order.id);

Organizations.deleteOrganizationViaApi(organization.id);

Users.deleteViaApi(user.userId);
});

// FAT-4047 Requarements is changed. Test case need review.
it('C735 Receiving pieces from an order for physical material that is set to create Items in inventory (thunderjet)', { tags: [testType.smoke, devTeams.thunderjet] }, () => {
// TODO: update test case in test rail to reflect business actions
const barcode = Helper.getRandomBarcode();
const caption = 'autotestCaption';
Orders.createOrderWithOrderLineViaApi(order, orderLine)
.then(orderNumber => {
cy.visit(TopMenu.ordersPath);
Orders.searchByParameter('PO number', orderNumber);
Orders.selectFromResultsList(orderNumber);
Orders.openOrder();
InteractorsTools.checkCalloutMessage(`The Purchase order - ${orderNumber} has been successfully opened`);
Orders.receiveOrderViaActions();
// Receiving part
Receiving.selectPOLInReceive(orderLine.titleOrPackage);
Receiving.selectPOLInReceive(orderLineTitle);
Receiving.receivePiece(0, caption, barcode);
Receiving.checkReceivedPiece(0, caption, barcode);
// inventory part
cy.visit(TopMenu.inventoryPath);
InventorySearchAndFilter.switchToItem();
InventorySearchAndFilter.searchByParameter('Barcode', barcode);
InventoryInstance.checkHoldingsTable(OrdersHelper.mainLibraryLocation, 0, caption, barcode, 'In process');
});
ItemRecordView.checkItemDetails(OrdersHelper.onlineLibraryLocation, barcode, 'In process');
});
});
12 changes: 11 additions & 1 deletion cypress/support/fragments/inventory/itemRecordView.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ export default {
cy.expect(Accordion('Administrative data').find(KeyValue('Item barcode')).has({ value: barcode }));
},

checkStatus:(status) => {
cy.expect(Accordion('Loan and availability').find(KeyValue('Item status')).has({ value: status }));
},

edit() {
cy.do([
actionsButton.click(),
Expand All @@ -129,5 +133,11 @@ export default {
checkCalloutMessage: () => {
cy.expect(Callout({ textContent: including('The item - HRID has been successfully saved.') })
.exists());
}
},

checkItemDetails(location, barcode, status) {
this.checkEffectiveLocation(location);
this.checkBarcode(barcode);
this.checkStatus(status);
},
};
2 changes: 1 addition & 1 deletion cypress/support/fragments/orders/orderLines.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export default {
orderFormatSelect.choose('Physical resource'),
acquisitionMethodButton.click(),
SelectionOption('Depository').click(),
receivingWorkflowSelect.choose('Independent order and receipt quantity'),
receivingWorkflowSelect.choose('Synchronized order and receipt quantity'),
physicalUnitPriceTextField.fillIn(physicalUnitPrice),
quantityPhysicalTextField.fillIn(quantityPhysical),
materialTypeSelect.choose('book'),
Expand Down
1 change: 1 addition & 0 deletions cypress/support/fragments/orders/ordersHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import dateTools from '../../utils/dateTools';

export default {
mainLibraryLocation: 'Main Library',
onlineLibraryLocation: 'Online',

verifyOrderDateOpened:() => {
cy.do(Section({ id:'purchaseOrder' }).find(KeyValue('Date opened')).perform(element => {
Expand Down

0 comments on commit d78a5a4

Please sign in to comment.