-
-
Notifications
You must be signed in to change notification settings - Fork 0
OBPIH 7784 Putaway - putaway item with empty lot #85
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
02b14fc
add new product and inventory
kkrawczyk123 f8c3cd1
add edit dialog to InStochTab
kkrawczyk123 72eb1d1
add edit item dialog
kkrawczyk123 c554fd5
add test for putaway item with spaces in lot
kkrawczyk123 b3b173c
improvements after review
kkrawczyk123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/pages/product/productShow/sections/components/EditItemDialog.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { expect } from '@playwright/test'; | ||
|
|
||
| import BasePageModel from '@/pages/BasePageModel'; | ||
|
|
||
| class EditItemDialog extends BasePageModel { | ||
| get editItemDialog() { | ||
| return this.page.getByRole('dialog', { name: 'Edit Item' }); | ||
| } | ||
|
|
||
| async isLoaded() { | ||
| await expect(this.editItemDialog).toBeVisible(); | ||
| } | ||
|
|
||
| get lotField() { | ||
| return this.editItemDialog.locator('#lotNumber'); | ||
| } | ||
|
|
||
| get saveButton() { | ||
| return this.editItemDialog.getByRole('button', { | ||
| name: 'Save', | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| export default EditItemDialog; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,216 @@ | ||
| import AppConfig from '@/config/AppConfig'; | ||
| import { ShipmentType } from '@/constants/ShipmentType'; | ||
| import { expect, test } from '@/fixtures/fixtures'; | ||
| import { StockMovementResponse } from '@/types'; | ||
| import RefreshCachesUtils from '@/utils/RefreshCaches'; | ||
| import { | ||
| deleteReceivedShipment, | ||
| getShipmentId, | ||
| getShipmentItemId, | ||
| } from '@/utils/shipmentUtils'; | ||
|
|
||
| test.describe('Putaway item with empty lot', () => { | ||
| let STOCK_MOVEMENT: StockMovementResponse; | ||
|
|
||
| test.beforeEach( | ||
| async ({ | ||
| supplierLocationService, | ||
| stockMovementService, | ||
| productService, | ||
| receivingService, | ||
| }) => { | ||
| const supplierLocation = await supplierLocationService.getLocation(); | ||
| STOCK_MOVEMENT = await stockMovementService.createInbound({ | ||
| originId: supplierLocation.id, | ||
| }); | ||
|
|
||
| productService.setProduct('5'); | ||
| const product2 = await productService.getProduct(); | ||
|
|
||
| await stockMovementService.addItemsToInboundStockMovement( | ||
| STOCK_MOVEMENT.id, | ||
| [{ productId: product2.id, quantity: 10 }] | ||
| ); | ||
|
|
||
| await stockMovementService.sendInboundStockMovement(STOCK_MOVEMENT.id, { | ||
| shipmentType: ShipmentType.AIR, | ||
| }); | ||
|
|
||
| const { data: stockMovement } = | ||
| await stockMovementService.getStockMovement(STOCK_MOVEMENT.id); | ||
| const shipmentId = getShipmentId(stockMovement); | ||
| const { data: receipt } = await receivingService.getReceipt(shipmentId); | ||
| const receivingBin = | ||
| AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; | ||
|
|
||
| await receivingService.createReceivingBin(shipmentId, receipt); | ||
|
|
||
| await receivingService.updateReceivingItems(shipmentId, [ | ||
| { | ||
| shipmentItemId: getShipmentItemId(receipt, 0, 0), | ||
| quantityReceiving: 10, | ||
| binLocationName: receivingBin, | ||
| }, | ||
| ]); | ||
| await receivingService.completeReceipt(shipmentId); | ||
| } | ||
| ); | ||
|
|
||
| test.afterEach( | ||
| async ({ | ||
| stockMovementShowPage, | ||
| stockMovementService, | ||
| navbar, | ||
| transactionListPage, | ||
| oldViewShipmentPage, | ||
| }) => { | ||
| await navbar.configurationButton.click(); | ||
| await navbar.transactions.click(); | ||
| for (let n = 1; n < 7; n++) { | ||
| await transactionListPage.deleteTransaction(1); | ||
| } | ||
| await deleteReceivedShipment({ | ||
| stockMovementShowPage, | ||
| oldViewShipmentPage, | ||
| stockMovementService, | ||
| STOCK_MOVEMENT, | ||
| }); | ||
| await RefreshCachesUtils.refreshCaches({ | ||
| navbar, | ||
| }); | ||
| } | ||
| ); | ||
|
|
||
| test('Putaway item with empty lot', async ({ | ||
| mainLocationService, | ||
| navbar, | ||
| createPutawayPage, | ||
| internalLocationService, | ||
| productShowPage, | ||
| putawayDetailsPage, | ||
| productService, | ||
| }) => { | ||
| const receivingBin = | ||
| AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; | ||
| const currentLocation = await mainLocationService.getLocation(); | ||
| const internalLocation = await internalLocationService.getLocation(); | ||
| productService.setProduct('6'); | ||
| const product = await productService.getProduct(); | ||
| productService.setProduct('5'); | ||
| const product2 = await productService.getProduct(); | ||
|
|
||
| await test.step('Go to stockcard', async () => { | ||
| await productShowPage.goToPage(product.id); | ||
| await productShowPage.inStockTab.click(); | ||
| await productShowPage.inStockTabSection.isLoaded(); | ||
| }); | ||
|
|
||
| await test.step('Edit item lot to spaces', async () => { | ||
| await productShowPage.inStockTabSection.row(1).actionsButton.click(); | ||
| await productShowPage.inStockTabSection.editItem.click(); | ||
| await productShowPage.inStockTabSection.editItemDialog.isLoaded(); | ||
| await productShowPage.inStockTabSection.editItemDialog.lotField.fill( | ||
| ' ' | ||
| ); | ||
| await productShowPage.inStockTabSection.editItemDialog.saveButton.click(); | ||
| }); | ||
|
|
||
| await test.step('Open transfer stock dialog the inventory', async () => { | ||
| await productShowPage.inStockTabSection.row(1).actionsButton.click(); | ||
| await productShowPage.inStockTabSection.stockTransferButton.click(); | ||
| await productShowPage.inStockTabSection.stockTransferDialog.isLoaded(); | ||
| }); | ||
|
|
||
| await test.step('Perform Stock Transfer of inventory to receiving bin', async () => { | ||
| await productShowPage.inStockTabSection.stockTransferDialog.locationSelect.click(); | ||
| await productShowPage.inStockTabSection.stockTransferDialog.selectLocation( | ||
| currentLocation.name | ||
| ); | ||
| await productShowPage.inStockTabSection.stockTransferDialog.binLocationSelect.click(); | ||
| await productShowPage.inStockTabSection.stockTransferDialog.selectLocation( | ||
| receivingBin | ||
| ); | ||
| await productShowPage.inStockTabSection.stockTransferDialog.transferStockButton.click(); | ||
| await productShowPage.inStockTab.click(); | ||
| await productShowPage.inStockTabSection.isLoaded(); | ||
| await expect( | ||
| productShowPage.inStockTabSection.row(1).binLocation | ||
| ).toHaveText(receivingBin); | ||
| await RefreshCachesUtils.refreshCaches({ | ||
| navbar, | ||
| }); | ||
| }); | ||
|
|
||
| await test.step('Go to create putaway page and assert data', async () => { | ||
| await navbar.inbound.click(); | ||
| await navbar.createPutaway.click(); | ||
| await createPutawayPage.isLoaded(); | ||
| await expect(createPutawayPage.table.row(0).receivingBin).toContainText( | ||
| receivingBin | ||
| ); | ||
| await createPutawayPage.table | ||
| .row(0) | ||
| .getExpandBinLocation(receivingBin) | ||
| .click(); | ||
| await expect( | ||
| createPutawayPage.table.row(1).getProductName(product2.name) | ||
| ).toBeVisible(); | ||
| await expect( | ||
| createPutawayPage.table.row(2).getProductName(product.name) | ||
| ).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('Start putaway', async () => { | ||
| await createPutawayPage.table.row(1).checkbox.click(); | ||
| await createPutawayPage.table.row(2).checkbox.click(); | ||
| await createPutawayPage.startPutawayButton.click(); | ||
| await createPutawayPage.startStep.isLoaded(); | ||
| }); | ||
|
|
||
| await test.step('Select bin to putaway', async () => { | ||
| await createPutawayPage.startStep.table.row(1).putawayBinSelect.click(); | ||
| await createPutawayPage.startStep.table | ||
| .row(0) | ||
| .getPutawayBin(internalLocation.name) | ||
| .click(); | ||
| await createPutawayPage.startStep.table.row(2).putawayBinSelect.click(); | ||
| await createPutawayPage.startStep.table | ||
| .row(1) | ||
| .getPutawayBin(internalLocation.name) | ||
| .click(); | ||
| await createPutawayPage.startStep.nextButton.click(); | ||
| }); | ||
|
|
||
| await test.step('Go to next page and complete putaway', async () => { | ||
| await createPutawayPage.completeStep.isLoaded(); | ||
| await createPutawayPage.completeStep.completePutawayButton.click(); | ||
| }); | ||
|
|
||
| const ifConfirmDialogVisible = | ||
| await createPutawayPage.completeStep.confirmPutawayDialog.isVisible(); | ||
|
|
||
| // eslint-disable-next-line playwright/no-conditional-in-test | ||
| if (ifConfirmDialogVisible) { | ||
| await test.step('Accept dialog if visible', async () => { | ||
| await createPutawayPage.completeStep.yesButtonOnConfirmPutawayDialog | ||
| .last() | ||
| .click(); | ||
| }); | ||
| } | ||
|
|
||
| await test.step('Assert completing putaway', async () => { | ||
| await putawayDetailsPage.isLoaded(); | ||
| await expect(putawayDetailsPage.statusTag).toHaveText('Completed'); | ||
| }); | ||
|
|
||
| await test.step('Assert putaway bin on stock card', async () => { | ||
| await putawayDetailsPage.summaryTab.click(); | ||
| await productShowPage.goToPage(product.id); | ||
| await productShowPage.inStockTab.click(); | ||
| await productShowPage.inStockTabSection.isLoaded(); | ||
| await expect( | ||
| productShowPage.inStockTabSection.row(1).binLocation | ||
| ).toHaveText(internalLocation.name); | ||
| }); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.