OBPIH-7609 Putaway - assert receiving bins on create putaway page#79
OBPIH-7609 Putaway - assert receiving bins on create putaway page#79kkrawczyk123 wants to merge 3 commits intomainfrom
Conversation
alannadolny
left a comment
There was a problem hiding this comment.
+ Can you create a factory for (as an example) received stock movement?
Those "after each" are really big and started to be problematic for future maintenance. So if you can, it would be good to create a factor. I mean:
async function createReceivedStockMovement({
productId,
quantity,
lot,
expDate,
}) {
// code
return {
stockMovement,
receivingBin,
shipmentId,
};
}
And you there are a lot of repeated code for creating inbounds, etc., so it's not DRY
| return this.page.getByRole('cell', { name: 'Choose where stock is being' }); | ||
| } | ||
|
|
||
| async getLocation(locationName: string) { |
There was a problem hiding this comment.
Shouldn't it be selectLocation?
| await expect( | ||
| this.page.getByRole('dialog', { name: 'Transfer Stock' }) | ||
| ).toBeVisible(); | ||
| } |
There was a problem hiding this comment.
Add a getter for the dialog and use it here (and in the transferStockButton)
| return this.row | ||
| .getByTestId('table-cell') | ||
| .getByText(binLocation); | ||
| return this.row.getByTestId('table-cell').getByText(binLocation); |
There was a problem hiding this comment.
You can create a getter for the cell and use it in the getters below
| let STOCK_MOVEMENT: StockMovementResponse; | ||
| let STOCK_MOVEMENT_OTHER: StockMovementResponse; |
There was a problem hiding this comment.
I prefer to call them primary stock movement and secondary stock movement
| await test.step('Create 2nd stock movement and receive it', async () => { | ||
| STOCK_MOVEMENT_OTHER = await stockMovementService.createInbound({ | ||
| originId: supplierLocation.id, | ||
| }); | ||
|
|
||
| productService.setProduct('5'); | ||
| const product = await productService.getProduct(); | ||
|
|
||
| await stockMovementService.addItemsToInboundStockMovement( | ||
| STOCK_MOVEMENT_OTHER.id, | ||
| [{ productId: product.id, quantity: 10 }] | ||
| ); | ||
|
|
||
| await stockMovementService.sendInboundStockMovement( | ||
| STOCK_MOVEMENT_OTHER.id, | ||
| { | ||
| shipmentType: ShipmentType.AIR, | ||
| } | ||
| ); | ||
|
|
||
| const { data: stockMovement } = | ||
| await stockMovementService.getStockMovement(STOCK_MOVEMENT_OTHER.id); | ||
| const shipmentId = getShipmentId(stockMovement); | ||
| const { data: receipt } = await receivingService.getReceipt(shipmentId); | ||
| const receivingBin2 = | ||
| AppConfig.instance.receivingBinPrefix + | ||
| STOCK_MOVEMENT_OTHER.identifier; | ||
|
|
||
| await receivingService.createReceivingBin(shipmentId, receipt); | ||
|
|
||
| await receivingService.updateReceivingItems(shipmentId, [ | ||
| { | ||
| shipmentItemId: getShipmentItemId(receipt, 0, 0), | ||
| quantityReceiving: 10, | ||
| binLocationName: receivingBin2, | ||
| }, | ||
| ]); | ||
| await receivingService.completeReceipt(shipmentId); | ||
| }); | ||
| } |
There was a problem hiding this comment.
Those steps are too wide (this one and the rest)
The step should do one thing, like: 'add items to stock movement', 'move to receiving bin', 'receive'
added: