-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
51 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters