-
-
Notifications
You must be signed in to change notification settings - Fork 0
OBPIH-7539 perform putaway as manager user #77
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
10 commits
Select commit
Hold shift + click to select a range
61b716b
add page elements to complete putaway step
kkrawczyk123 b506235
fix typo
kkrawczyk123 13484d4
add test for perform putaway as manager user
kkrawczyk123 6495127
improve reliability of test
kkrawczyk123 cf11370
improve name of element
kkrawczyk123 2eced71
add refresh cashes utils
kkrawczyk123 368b723
update refresh cashes in all putaway tests
kkrawczyk123 b64d43c
improvements after review
kkrawczyk123 4379c94
remove unused type
kkrawczyk123 8e9b2a4
remove unused type
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
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
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,225 @@ | ||
| import Navbar from '@/components/Navbar'; | ||
| import AppConfig from '@/config/AppConfig'; | ||
| import { ShipmentType } from '@/constants/ShipmentType'; | ||
| import { expect, test } from '@/fixtures/fixtures'; | ||
| import CreatePutawayPage from '@/pages/putaway/CreatePutawayPage'; | ||
| import PutawayDetailsPage from '@/pages/putaway/putawayDetails/PutawayDetailsPage'; | ||
| import StockMovementShowPage from '@/pages/stockMovementShow/StockMovementShowPage'; | ||
| import { StockMovementResponse } from '@/types'; | ||
| import RefreshCachesUtils from '@/utils/RefreshCaches'; | ||
| import { getShipmentId, getShipmentItemId } from '@/utils/shipmentUtils'; | ||
|
|
||
| test.describe('Perform putaway as manager user', () => { | ||
| 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('3'); | ||
| const product = await productService.getProduct(); | ||
| productService.setProduct('4'); | ||
| const product2 = await productService.getProduct(); | ||
|
|
||
| await stockMovementService.addItemsToInboundStockMovement( | ||
| STOCK_MOVEMENT.id, | ||
| [ | ||
| { productId: product.id, quantity: 10 }, | ||
| { 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, | ||
| }, | ||
| { | ||
| shipmentItemId: getShipmentItemId(receipt, 0, 1), | ||
| quantityReceiving: 10, | ||
| binLocationName: receivingBin, | ||
| }, | ||
| ]); | ||
| await receivingService.completeReceipt(shipmentId); | ||
| } | ||
| ); | ||
|
|
||
| test.afterEach( | ||
| async ({ | ||
| stockMovementShowPage, | ||
| stockMovementService, | ||
| navbar, | ||
| transactionListPage, | ||
| oldViewShipmentPage, | ||
| }) => { | ||
| await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); | ||
| await navbar.configurationButton.click(); | ||
| await navbar.transactions.click(); | ||
| await transactionListPage.deleteTransaction(1); | ||
| await transactionListPage.deleteTransaction(1); | ||
kkrawczyk123 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); | ||
| await stockMovementShowPage.detailsListTable.oldViewShipmentPage.click(); | ||
| await oldViewShipmentPage.undoStatusChangeButton.click(); | ||
| await stockMovementShowPage.isLoaded(); | ||
| await stockMovementShowPage.rollbackButton.click(); | ||
|
|
||
| await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id); | ||
| } | ||
| ); | ||
kkrawczyk123 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| test('Perform putaway as manager user', async ({ | ||
| managerUserContext, | ||
| internalLocationService, | ||
| productService, | ||
| }) => { | ||
| const receivingBin = | ||
| AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; | ||
| productService.setProduct('3'); | ||
| const product = await productService.getProduct(); | ||
| productService.setProduct('4'); | ||
| const product2 = await productService.getProduct(); | ||
| const internalLocation = await internalLocationService.getLocation(); | ||
|
|
||
| const managerUserPage = await managerUserContext.newPage(); | ||
| const navbar = new Navbar(managerUserPage); | ||
| const stockMovementShowPage = new StockMovementShowPage(managerUserPage); | ||
| const createPutawayPage = new CreatePutawayPage(managerUserPage); | ||
| const putawayDetailsPage = new PutawayDetailsPage(managerUserPage); | ||
|
|
||
| await test.step('Go to create putaway page', async () => { | ||
| await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); | ||
| await stockMovementShowPage.isLoaded(); | ||
| await RefreshCachesUtils.refreshCaches({ | ||
| navbar, | ||
| }); | ||
| await navbar.inbound.click(); | ||
| await navbar.createPutaway.click(); | ||
| await createPutawayPage.isLoaded(); | ||
| }); | ||
|
|
||
| await test.step('Start putaway', async () => { | ||
| 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 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 bins to putaway', async () => { | ||
| await createPutawayPage.startStep.table.row(1).putawayBinSelect.click(); | ||
| await createPutawayPage.startStep.table | ||
| .row(1) | ||
| .getPutawayBin(internalLocation.name) | ||
| .click(); | ||
| await createPutawayPage.startStep.table.row(2).putawayBinSelect.click(); | ||
| await createPutawayPage.startStep.table | ||
| .row(2) | ||
| .getPutawayBin(internalLocation.name) | ||
| .click(); | ||
| }); | ||
|
|
||
| await test.step('Use edit button as manager user on both lines', async () => { | ||
| await createPutawayPage.startStep.table.row(1).editButton.click(); | ||
| await createPutawayPage.startStep.table.row(1).quantityInput.fill('5'); | ||
| await createPutawayPage.startStep.table.row(2).editButton.click(); | ||
| await createPutawayPage.startStep.table.row(2).quantityInput.fill('5'); | ||
| }); | ||
|
|
||
| await test.step('Go to complete step and assert qty after edit', async () => { | ||
| await createPutawayPage.startStep.nextButton.click(); | ||
| await createPutawayPage.completeStep.isLoaded(); | ||
| await expect( | ||
| createPutawayPage.completeStep.table.row(2).quantity | ||
| ).toContainText('5'); | ||
| await expect( | ||
| createPutawayPage.completeStep.table.row(3).quantity | ||
| ).toContainText('5'); | ||
| await expect(createPutawayPage.completeStep.table.rows).toHaveCount(4); | ||
| }); | ||
|
|
||
| await test.step('Go backward and use delete button as manager user', async () => { | ||
| await createPutawayPage.completeStep.editButton.click(); | ||
| await createPutawayPage.startStep.isLoaded(); | ||
| await expect(createPutawayPage.startStep.table.rows).toHaveCount(3); | ||
| await createPutawayPage.startStep.table.row(2).deleteButton.click(); | ||
| await expect(createPutawayPage.startStep.table.rows).toHaveCount(2); | ||
| }); | ||
|
|
||
| await test.step('Go to next page and assert displayed rows', async () => { | ||
| await createPutawayPage.startStep.nextButton.click(); | ||
| await createPutawayPage.completeStep.isLoaded(); | ||
| await expect(createPutawayPage.completeStep.table.rows).toHaveCount(3); | ||
| }); | ||
|
|
||
| await test.step('Complete putaway', async () => { | ||
| await createPutawayPage.completeStep.completePutawayButton.click(); | ||
| await expect( | ||
| createPutawayPage.completeStep.confirmPutawayDialog | ||
| ).toBeVisible(); | ||
| await expect( | ||
| createPutawayPage.completeStep.confirmPutawayDialog | ||
| ).toContainText( | ||
| /Qty5 of item .* is still in the receiving bin\. Do you want to continue\?/ | ||
kkrawczyk123 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ); | ||
| await expect( | ||
| createPutawayPage.completeStep.confirmPutawayDialog | ||
| ).toBeVisible(); | ||
| 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 qty still available to putaway on create putaway page', async () => { | ||
| await navbar.profileButton.click(); | ||
| await navbar.refreshCachesButton.click(); | ||
kkrawczyk123 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| await createPutawayPage.goToPage(); | ||
| 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 managerUserPage.close(); | ||
| }); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
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.