-
-
Notifications
You must be signed in to change notification settings - Fork 0
OBPIH-7535 Putaway - assert attempt to edit completed putaway #69
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 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { expect, Page } from '@playwright/test'; | ||
|
|
||
| import BasePageModel from '@/pages/BasePageModel'; | ||
|
|
||
| import SplitModalTable from './SplitModalTable'; | ||
|
|
||
| class SplitModal extends BasePageModel { | ||
| table: SplitModalTable; | ||
|
|
||
| constructor(page: Page) { | ||
| super(page); | ||
| this.table = new SplitModalTable(page); | ||
| } | ||
|
|
||
| get modal() { | ||
| return this.page.locator('.ReactModal__Content'); | ||
| } | ||
|
|
||
| async isLoaded() { | ||
| await expect(this.modal).toBeVisible(); | ||
| } | ||
|
|
||
| get saveButton() { | ||
| return this.modal.getByTestId('save-button'); | ||
| } | ||
|
|
||
| get cancelButton() { | ||
| return this.modal.getByTestId('cancel-button'); | ||
| } | ||
|
|
||
| get addLineButton() { | ||
| return this.modal.getByTestId('add-line-button'); | ||
| } | ||
| } | ||
|
|
||
| export default SplitModal; |
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,52 @@ | ||
| import { Locator, Page } from '@playwright/test'; | ||
|
|
||
| import BasePageModel from '@/pages/BasePageModel'; | ||
|
|
||
| class SplitModalTable extends BasePageModel { | ||
| constructor(page: Page) { | ||
| super(page); | ||
| } | ||
|
|
||
| get table() { | ||
| return this.page.getByRole('table'); | ||
| } | ||
|
|
||
| get rows() { | ||
| return this.table.getByRole('row'); | ||
| } | ||
|
|
||
| row(index: number) { | ||
| return new Row(this.page, this.rows.nth(index)); | ||
| } | ||
| } | ||
|
|
||
| class Row extends BasePageModel { | ||
| row: Locator; | ||
|
|
||
| constructor(page: Page, row: Locator) { | ||
| super(page); | ||
| this.row = row; | ||
| } | ||
|
|
||
| get deleteButton() { | ||
| return this.row.getByTestId('delete-button'); | ||
| } | ||
|
|
||
| async getPutawayBin(putawayBin: string) { | ||
| await this.row | ||
| .getByTestId('bin-select') | ||
| .getByRole('textbox') | ||
| .fill(putawayBin); | ||
| await this.page | ||
| .getByTestId('custom-select-dropdown-menu') | ||
| .locator('.react-select__option') | ||
| .nth(0) | ||
| .click(); | ||
| } | ||
|
|
||
| get quantityField() { | ||
| return this.row.getByRole('cell').getByTestId('quantity-input'); | ||
| } | ||
| } | ||
|
|
||
| export default SplitModalTable; |
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
202 changes: 202 additions & 0 deletions
202
src/tests/putaway/assertAttemptToEditCompletedPutaway.test.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,202 @@ | ||
| import AppConfig from '@/config/AppConfig'; | ||
| import { ShipmentType } from '@/constants/ShipmentType'; | ||
| import { expect, test } from '@/fixtures/fixtures'; | ||
| import { StockMovementResponse } from '@/types'; | ||
| import { getShipmentId, getShipmentItemId } from '@/utils/shipmentUtils'; | ||
|
|
||
| test.describe('Assert attempt to edit completed putaway', () => { | ||
| let STOCK_MOVEMENT: StockMovementResponse; | ||
|
|
||
| test.beforeEach( | ||
| async ({ | ||
| supplierLocationService, | ||
| stockMovementService, | ||
| fifthProductService, | ||
| receivingService, | ||
| }) => { | ||
| const supplierLocation = await supplierLocationService.getLocation(); | ||
| STOCK_MOVEMENT = await stockMovementService.createInbound({ | ||
| originId: supplierLocation.id, | ||
| }); | ||
|
|
||
| const product = await fifthProductService.getProduct(); | ||
|
|
||
| await stockMovementService.addItemsToInboundStockMovement( | ||
| STOCK_MOVEMENT.id, | ||
| [{ productId: product.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(); | ||
| await transactionListPage.table.row(1).actionsButton.click(); | ||
| await transactionListPage.table.deleteButton.click(); | ||
| await expect(transactionListPage.successMessage).toBeVisible(); | ||
| await transactionListPage.table.row(1).actionsButton.click(); | ||
| await transactionListPage.table.deleteButton.click(); | ||
| await expect(transactionListPage.successMessage).toBeVisible(); | ||
|
|
||
| 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); | ||
| } | ||
| ); | ||
|
|
||
| test('Assert attempt to edit completed putaway', async ({ | ||
| stockMovementShowPage, | ||
| navbar, | ||
| createPutawayPage, | ||
| internalLocationService, | ||
| putawayDetailsPage, | ||
| putawayListPage, | ||
| page, | ||
| }) => { | ||
| await test.step('Go to create putaway page', async () => { | ||
| await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); | ||
| await stockMovementShowPage.isLoaded(); | ||
| await navbar.profileButton.click(); | ||
| await navbar.refreshCachesButton.click(); | ||
| await navbar.inbound.click(); | ||
| await navbar.createPutaway.click(); | ||
| await createPutawayPage.isLoaded(); | ||
| }); | ||
|
|
||
| await test.step('Start putaway', async () => { | ||
| await createPutawayPage.table.row(0).checkbox.click(); | ||
| await createPutawayPage.startPutawayButton.click(); | ||
| await createPutawayPage.startStep.isLoaded(); | ||
| }); | ||
|
|
||
| await test.step('Select bin to putaway', async () => { | ||
| const internalLocation = await internalLocationService.getLocation(); | ||
| await createPutawayPage.startStep.table.row(0).putawayBinSelect.click(); | ||
| await createPutawayPage.startStep.table | ||
| .row(0) | ||
| .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(); | ||
| }); | ||
|
|
||
| await test.step('Assert completing putaway', async () => { | ||
| await putawayDetailsPage.isLoaded(); | ||
| await expect(putawayDetailsPage.statusTag).toHaveText('Completed'); | ||
| }); | ||
|
|
||
| await test.step('Assert try to edit completed putaway', async () => { | ||
| await putawayDetailsPage.assertClickOnEditButtonWhenPutawayCompleted(); | ||
| }); | ||
|
|
||
| await test.step('Assert delete button is not visible for completed putaway', async () => { | ||
| await putawayDetailsPage.summaryActionsButton.click(); | ||
| await expect(putawayDetailsPage.actionsDeleteButton).toBeHidden(); | ||
| }); | ||
|
|
||
| await test.step('Go backward in browser', async () => { | ||
| await page.goBack(); | ||
| await createPutawayPage.startStep.isLoaded(); | ||
| }); | ||
|
|
||
| await test.step('Assert attemps to edit in completed putaway', async () => { | ||
| await createPutawayPage.startStep.saveButton.click(); | ||
| await expect( | ||
| createPutawayPage.startStep.validationOnEditCompletedPutaway | ||
| ).toBeVisible(); | ||
| await createPutawayPage.startStep.closeDisplayedError(); | ||
| await createPutawayPage.startStep.nextButton.click(); | ||
| await expect( | ||
| createPutawayPage.startStep.validationOnEditCompletedPutaway | ||
| ).toBeVisible(); | ||
| await createPutawayPage.startStep.closeDisplayedError(); | ||
| await createPutawayPage.startStep.generatePutawayListButton.click(); | ||
| await expect( | ||
| createPutawayPage.startStep.validationOnEditCompletedPutaway | ||
| ).toBeVisible(); | ||
| await createPutawayPage.startStep.closeDisplayedError(); | ||
| await createPutawayPage.startStep.sortByCurrentBinButton.click(); | ||
| await expect( | ||
| createPutawayPage.startStep.validationOnEditCompletedPutaway | ||
| ).toBeVisible(); | ||
| await createPutawayPage.startStep.closeDisplayedError(); | ||
| }); | ||
|
|
||
| await test.step('Assert attemps to edit item in completed putaway', async () => { | ||
| await createPutawayPage.startStep.isLoaded(); | ||
| await createPutawayPage.startStep.table.row(0).deleteButton.click(); | ||
| await expect( | ||
| createPutawayPage.startStep.validationOnDeleteItemFromCompletedPutaway | ||
| ).toBeVisible(); | ||
| await createPutawayPage.startStep.closeDisplayedError(); | ||
| await createPutawayPage.startStep.table.row(0).splitLineButton.click(); | ||
| await createPutawayPage.startStep.splitModal.isLoaded(); | ||
| await createPutawayPage.startStep.splitModal.addLineButton.click(); | ||
| const internalLocation = await internalLocationService.getLocation(); | ||
| await createPutawayPage.startStep.splitModal.table | ||
| .row(1) | ||
| .getPutawayBin(internalLocation.name); | ||
| await createPutawayPage.startStep.splitModal.table | ||
| .row(1) | ||
| .quantityField.fill('5'); | ||
| await createPutawayPage.startStep.splitModal.table | ||
| .row(2) | ||
| .getPutawayBin(internalLocation.name); | ||
| await createPutawayPage.startStep.splitModal.table | ||
| .row(2) | ||
| .quantityField.fill('5'); | ||
| await createPutawayPage.startStep.splitModal.saveButton.click(); | ||
| await expect( | ||
| createPutawayPage.startStep.validationOnEditCompletedPutaway | ||
| ).toBeVisible(); | ||
| await createPutawayPage.startStep.closeDisplayedError(); | ||
| await createPutawayPage.startStep.table.row(0).editButton.click(); | ||
| await createPutawayPage.startStep.table.row(0).quantityField.fill('20'); | ||
| await expect(createPutawayPage.startStep.nextButton).toBeDisabled(); | ||
| await expect(createPutawayPage.startStep.saveButton).toBeDisabled(); | ||
| }); | ||
|
|
||
| await test.step('Go putaway list page and assert pending putaway is not created', async () => { | ||
| await putawayListPage.goToPage(); | ||
| await putawayListPage.isLoaded(); | ||
| await putawayListPage.emptyPutawayList.isVisible(); | ||
| }); | ||
| }); | ||
| }); |
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.