From 82200febf23e1d0d9c089126e03396981a0c5fc2 Mon Sep 17 00:00:00 2001 From: Katarzyna Date: Tue, 31 Mar 2026 14:31:46 +0200 Subject: [PATCH 1/5] fix file name in test --- .../createInbound/downloadDocsFromSendPage.test.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/tests/inbound/createInbound/downloadDocsFromSendPage.test.ts b/src/tests/inbound/createInbound/downloadDocsFromSendPage.test.ts index 3804b5a..0427dcf 100644 --- a/src/tests/inbound/createInbound/downloadDocsFromSendPage.test.ts +++ b/src/tests/inbound/createInbound/downloadDocsFromSendPage.test.ts @@ -15,11 +15,7 @@ test.describe('Download documents from inbound send page', () => { const uniqueIdentifier = new UniqueIdentifier(); test.beforeEach( - async ({ - productService, - mainUserService, - supplierLocationService, - }) => { + async ({ productService, mainUserService, supplierLocationService }) => { productService.setProduct('1'); const PRODUCT_ONE = await productService.getProduct(); USER = await mainUserService.getUser(); @@ -225,7 +221,7 @@ test.describe('Download documents from inbound send page', () => { ]); expect(download.suggestedFilename()).toMatch( - /^Packing List - .*\.xls(x)?$/ + /^Packing List_.*\.xls(x)?$/ ); await popup.close(); }); From 9ee99e0cd636b5ec5f174ec509ed12d012663f71 Mon Sep 17 00:00:00 2001 From: Katarzyna Date: Tue, 31 Mar 2026 14:32:32 +0200 Subject: [PATCH 2/5] add elements to putaway pages --- src/pages/putaway/components/SplitModalTable.ts | 10 +++++++++- src/pages/putaway/components/StartPutawayTable.ts | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/pages/putaway/components/SplitModalTable.ts b/src/pages/putaway/components/SplitModalTable.ts index 90fe399..8d399e9 100644 --- a/src/pages/putaway/components/SplitModalTable.ts +++ b/src/pages/putaway/components/SplitModalTable.ts @@ -1,4 +1,4 @@ -import { Locator, Page } from '@playwright/test'; +import { expect, Locator, Page } from '@playwright/test'; import BasePageModel from '@/pages/BasePageModel'; @@ -55,6 +55,14 @@ class Row extends BasePageModel { get putawayBinField() { return this.row.getByTestId('bin-select').getByRole('textbox'); } + + get tooltip() { + return this.page.getByRole('tooltip'); + } + + assertValidationOnQtyField = async (errorContent: string) => { + await expect(this.tooltip).toContainText(errorContent); + }; } export default SplitModalTable; diff --git a/src/pages/putaway/components/StartPutawayTable.ts b/src/pages/putaway/components/StartPutawayTable.ts index 90fcb4b..2a8d767 100644 --- a/src/pages/putaway/components/StartPutawayTable.ts +++ b/src/pages/putaway/components/StartPutawayTable.ts @@ -1,4 +1,4 @@ -import { Locator, Page } from '@playwright/test'; +import { expect, Locator, Page } from '@playwright/test'; import BasePageModel from '@/pages/BasePageModel'; @@ -68,12 +68,20 @@ class Row extends BasePageModel { } get quantityInput() { - return this.row.getByTestId('quantity-input') + return this.row.getByTestId('quantity-input'); } get splitLineInPutawayBin() { return this.row.getByTestId('open-modal'); } + + get tooltip() { + return this.page.getByRole('tooltip'); + } + + assertValidationOnQtyField = async (errorContent: string) => { + await expect(this.tooltip).toContainText(errorContent); + }; } export default StartPutawayTable; From 220ef71c58f78e34bf5769a67497990a8fac67c7 Mon Sep 17 00:00:00 2001 From: Katarzyna Date: Tue, 31 Mar 2026 14:33:09 +0200 Subject: [PATCH 3/5] add test for qty validations in putaways --- .../putaway/qtyValidationsInPutaways.test.ts | 274 ++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100644 src/tests/putaway/qtyValidationsInPutaways.test.ts diff --git a/src/tests/putaway/qtyValidationsInPutaways.test.ts b/src/tests/putaway/qtyValidationsInPutaways.test.ts new file mode 100644 index 0000000..4630b6c --- /dev/null +++ b/src/tests/putaway/qtyValidationsInPutaways.test.ts @@ -0,0 +1,274 @@ +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 qty validations in putaways', () => { + 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 product = await productService.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 ({ + putawayListPage, + stockMovementShowPage, + stockMovementService, + oldViewShipmentPage, + }) => { + await putawayListPage.goToPage(); + await putawayListPage.table.row(1).actionsButton.click(); + await putawayListPage.table.clickDeleteOrderButton(1); + await putawayListPage.emptyPutawayList.isVisible(); + + 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 qty validations in putaways', async ({ + stockMovementShowPage, + navbar, + createPutawayPage, + internalLocationService, + productService, + }) => { + productService.setProduct('5'); + const internalLocation = await internalLocationService.getLocation(); + await test.step('Go to stock movement show page and assert received status', async () => { + await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); + await stockMovementShowPage.isLoaded(); + await expect(stockMovementShowPage.statusTag).toHaveText('Received'); + await navbar.profileButton.click(); + await navbar.refreshCachesButton.click(); + }); + + await test.step('Go to create putaway page', async () => { + 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('Try to edit qty to higher and assert validations', async () => { + await createPutawayPage.startStep.table.row(0).editButton.click(); + await createPutawayPage.startStep.table.row(0).quantityInput.fill('20'); + await createPutawayPage.startStep.table.row(0).quantityInput.hover(); + await createPutawayPage.startStep.table + .row(0) + .assertValidationOnQtyField( + 'Quantity cannot be greater than original putaway item quantity' + ); + await expect(createPutawayPage.startStep.nextButton).toBeDisabled(); + await expect(createPutawayPage.startStep.saveButton).toBeDisabled(); + }); + + await test.step('Try to edit qty to 0 and assert validation', async () => { + await createPutawayPage.startStep.table.row(0).editButton.click(); + await createPutawayPage.startStep.table.row(0).quantityInput.fill('0'); + await createPutawayPage.startStep.table.row(0).quantityInput.hover(); + await createPutawayPage.startStep.table + .row(0) + .assertValidationOnQtyField('Quantity cannot be less than 1'); + await expect(createPutawayPage.startStep.nextButton).toBeDisabled(); + await expect(createPutawayPage.startStep.saveButton).toBeDisabled(); + }); + + await test.step('Try to edit qty to negative and assert validation', async () => { + await createPutawayPage.startStep.table.row(0).editButton.click(); + await createPutawayPage.startStep.table.row(0).quantityInput.fill('-2'); + await createPutawayPage.startStep.table.row(0).quantityInput.hover(); + await createPutawayPage.startStep.table + .row(0) + .assertValidationOnQtyField('Quantity cannot be less than 1'); + await expect(createPutawayPage.startStep.nextButton).toBeDisabled(); + await expect(createPutawayPage.startStep.saveButton).toBeDisabled(); + }); + + await test.step('Edit ptaway qty back to original value', async () => { + await createPutawayPage.startStep.table.row(0).editButton.click(); + await createPutawayPage.startStep.table.row(0).quantityInput.fill('10'); + await expect(createPutawayPage.startStep.nextButton).toBeEnabled(); + await expect(createPutawayPage.startStep.saveButton).toBeEnabled(); + }); + + await test.step('Open split line modal', async () => { + await createPutawayPage.startStep.table.row(0).splitLineButton.click(); + await createPutawayPage.startStep.splitModal.isLoaded(); + await createPutawayPage.startStep.splitModal.table + .row(1) + .getPutawayBin(internalLocation.name); + }); + + await test.step('Try to edit qty to higher on split line modal', async () => { + await createPutawayPage.startStep.splitModal.table + .row(1) + .quantityField.fill('20'); + await createPutawayPage.startStep.splitModal.table + .row(1) + .quantityField.hover(); + await createPutawayPage.startStep.splitModal.table + .row(1) + .assertValidationOnQtyField( + 'Sum of all split items quantities cannot be higher than original putaway item quantity' + ); + await expect( + createPutawayPage.startStep.splitModal.saveButton + ).toBeDisabled(); + }); + + await test.step('Try to edit qty to 0 and assert validation on split line modal', async () => { + await createPutawayPage.startStep.splitModal.table + .row(1) + .quantityField.fill('0'); + await createPutawayPage.startStep.splitModal.table + .row(1) + .quantityField.hover(); + await createPutawayPage.startStep.splitModal.table + .row(1) + .assertValidationOnQtyField('Items quantity cannot be less than 1'); + await expect( + createPutawayPage.startStep.splitModal.saveButton + ).toBeDisabled(); + }); + + await test.step('Try to edit qty to negative and assert validation on split line modal', async () => { + await createPutawayPage.startStep.splitModal.table + .row(1) + .quantityField.fill('-1'); + await createPutawayPage.startStep.splitModal.table + .row(1) + .quantityField.hover(); + await createPutawayPage.startStep.splitModal.table + .row(1) + .assertValidationOnQtyField('Items quantity cannot be less than 1'); + await expect( + createPutawayPage.startStep.splitModal.saveButton + ).toBeDisabled(); + }); + + await test.step('Edit qty back to original value', async () => { + await createPutawayPage.startStep.splitModal.table + .row(1) + .quantityField.fill('10'); + await expect( + createPutawayPage.startStep.splitModal.saveButton + ).toBeEnabled(); + }); + + await test.step('Add new line on split line modal and assert empty qty on newly added line', async () => { + await createPutawayPage.startStep.splitModal.addLineButton.click(); + await createPutawayPage.startStep.splitModal.table + .row(2) + .getPutawayBin(internalLocation.name); + await createPutawayPage.startStep.splitModal.table + .row(2) + .quantityField.hover(); + await createPutawayPage.startStep.splitModal.table + .row(2) + .assertValidationOnQtyField('Items quantity cannot be less than 1'); + }); + + await test.step('Try to input higher qty on newly added line', async () => { + await createPutawayPage.startStep.splitModal.table + .row(2) + .quantityField.fill('5'); + await createPutawayPage.startStep.splitModal.table + .row(1) + .quantityField.hover(); + await createPutawayPage.startStep.splitModal.table + .row(1) + .assertValidationOnQtyField( + 'Sum of all split items quantities cannot be higher than original putaway item quantity' + ); + await createPutawayPage.startStep.splitModal.table + .row(2) + .quantityField.hover(); + await createPutawayPage.startStep.splitModal.table + .row(2) + .assertValidationOnQtyField( + 'Sum of all split items quantities cannot be higher than original putaway item quantity' + ); + }); + + await test.step('Try to input 0 on newly added line', async () => { + await createPutawayPage.startStep.splitModal.table + .row(2) + .quantityField.fill('0'); + await createPutawayPage.startStep.splitModal.table + .row(2) + .quantityField.hover(); + await createPutawayPage.startStep.splitModal.table + .row(2) + .assertValidationOnQtyField('Items quantity cannot be less than 1'); + }); + + await test.step('Try to input negative qty on newly added line', async () => { + await createPutawayPage.startStep.splitModal.table + .row(2) + .quantityField.fill('-5'); + await createPutawayPage.startStep.splitModal.table + .row(2) + .quantityField.hover(); + await createPutawayPage.startStep.splitModal.table + .row(2) + .assertValidationOnQtyField('Items quantity cannot be less than 1'); + }); + + await test.step('Leave split modal', async () => { + await createPutawayPage.startStep.splitModal.cancelButton.click(); + }); + }); +}); From a466b816651769e22a114ed82854f65a96f844a1 Mon Sep 17 00:00:00 2001 From: Katarzyna Date: Wed, 1 Apr 2026 14:23:58 +0200 Subject: [PATCH 4/5] fix tooltip --- .../putaway/components/SplitModalTable.ts | 16 ++-- .../putaway/components/StartPutawayTable.ts | 16 ++-- .../putaway/qtyValidationsInPutaways.test.ts | 74 +++++++++---------- 3 files changed, 49 insertions(+), 57 deletions(-) diff --git a/src/pages/putaway/components/SplitModalTable.ts b/src/pages/putaway/components/SplitModalTable.ts index 8d399e9..9c8c59f 100644 --- a/src/pages/putaway/components/SplitModalTable.ts +++ b/src/pages/putaway/components/SplitModalTable.ts @@ -18,6 +18,14 @@ class SplitModalTable extends BasePageModel { row(index: number) { return new Row(this.page, this.rows.nth(index)); } + + get qtyValidationTooltip() { + return this.page.getByRole('tooltip'); + } + + assertValidationOnQtyField = async (errorContent: string) => { + await expect(this.qtyValidationTooltip).toContainText(errorContent); + }; } class Row extends BasePageModel { @@ -55,14 +63,6 @@ class Row extends BasePageModel { get putawayBinField() { return this.row.getByTestId('bin-select').getByRole('textbox'); } - - get tooltip() { - return this.page.getByRole('tooltip'); - } - - assertValidationOnQtyField = async (errorContent: string) => { - await expect(this.tooltip).toContainText(errorContent); - }; } export default SplitModalTable; diff --git a/src/pages/putaway/components/StartPutawayTable.ts b/src/pages/putaway/components/StartPutawayTable.ts index 2a8d767..b716d61 100644 --- a/src/pages/putaway/components/StartPutawayTable.ts +++ b/src/pages/putaway/components/StartPutawayTable.ts @@ -18,6 +18,14 @@ class StartPutawayTable extends BasePageModel { row(index: number) { return new Row(this.page, this.rows.nth(index)); } + + get qtyValidationTooltip() { + return this.page.getByRole('tooltip'); + } + + assertValidationOnQtyField = async (errorContent: string) => { + await expect(this.qtyValidationTooltip).toContainText(errorContent); + }; } class Row extends BasePageModel { @@ -74,14 +82,6 @@ class Row extends BasePageModel { get splitLineInPutawayBin() { return this.row.getByTestId('open-modal'); } - - get tooltip() { - return this.page.getByRole('tooltip'); - } - - assertValidationOnQtyField = async (errorContent: string) => { - await expect(this.tooltip).toContainText(errorContent); - }; } export default StartPutawayTable; diff --git a/src/tests/putaway/qtyValidationsInPutaways.test.ts b/src/tests/putaway/qtyValidationsInPutaways.test.ts index 4630b6c..0b18bb1 100644 --- a/src/tests/putaway/qtyValidationsInPutaways.test.ts +++ b/src/tests/putaway/qtyValidationsInPutaways.test.ts @@ -106,11 +106,9 @@ test.describe('Assert qty validations in putaways', () => { await createPutawayPage.startStep.table.row(0).editButton.click(); await createPutawayPage.startStep.table.row(0).quantityInput.fill('20'); await createPutawayPage.startStep.table.row(0).quantityInput.hover(); - await createPutawayPage.startStep.table - .row(0) - .assertValidationOnQtyField( - 'Quantity cannot be greater than original putaway item quantity' - ); + await createPutawayPage.startStep.table.assertValidationOnQtyField( + 'Quantity cannot be greater than original putaway item quantity' + ); await expect(createPutawayPage.startStep.nextButton).toBeDisabled(); await expect(createPutawayPage.startStep.saveButton).toBeDisabled(); }); @@ -119,9 +117,9 @@ test.describe('Assert qty validations in putaways', () => { await createPutawayPage.startStep.table.row(0).editButton.click(); await createPutawayPage.startStep.table.row(0).quantityInput.fill('0'); await createPutawayPage.startStep.table.row(0).quantityInput.hover(); - await createPutawayPage.startStep.table - .row(0) - .assertValidationOnQtyField('Quantity cannot be less than 1'); + await createPutawayPage.startStep.table.assertValidationOnQtyField( + 'Quantity cannot be less than 1' + ); await expect(createPutawayPage.startStep.nextButton).toBeDisabled(); await expect(createPutawayPage.startStep.saveButton).toBeDisabled(); }); @@ -130,9 +128,9 @@ test.describe('Assert qty validations in putaways', () => { await createPutawayPage.startStep.table.row(0).editButton.click(); await createPutawayPage.startStep.table.row(0).quantityInput.fill('-2'); await createPutawayPage.startStep.table.row(0).quantityInput.hover(); - await createPutawayPage.startStep.table - .row(0) - .assertValidationOnQtyField('Quantity cannot be less than 1'); + await createPutawayPage.startStep.table.assertValidationOnQtyField( + 'Quantity cannot be less than 1' + ); await expect(createPutawayPage.startStep.nextButton).toBeDisabled(); await expect(createPutawayPage.startStep.saveButton).toBeDisabled(); }); @@ -159,11 +157,9 @@ test.describe('Assert qty validations in putaways', () => { await createPutawayPage.startStep.splitModal.table .row(1) .quantityField.hover(); - await createPutawayPage.startStep.splitModal.table - .row(1) - .assertValidationOnQtyField( - 'Sum of all split items quantities cannot be higher than original putaway item quantity' - ); + await createPutawayPage.startStep.splitModal.table.assertValidationOnQtyField( + 'Sum of all split items quantities cannot be higher than original putaway item quantity' + ); await expect( createPutawayPage.startStep.splitModal.saveButton ).toBeDisabled(); @@ -176,9 +172,9 @@ test.describe('Assert qty validations in putaways', () => { await createPutawayPage.startStep.splitModal.table .row(1) .quantityField.hover(); - await createPutawayPage.startStep.splitModal.table - .row(1) - .assertValidationOnQtyField('Items quantity cannot be less than 1'); + await createPutawayPage.startStep.splitModal.table.assertValidationOnQtyField( + 'Items quantity cannot be less than 1' + ); await expect( createPutawayPage.startStep.splitModal.saveButton ).toBeDisabled(); @@ -191,9 +187,9 @@ test.describe('Assert qty validations in putaways', () => { await createPutawayPage.startStep.splitModal.table .row(1) .quantityField.hover(); - await createPutawayPage.startStep.splitModal.table - .row(1) - .assertValidationOnQtyField('Items quantity cannot be less than 1'); + await createPutawayPage.startStep.splitModal.table.assertValidationOnQtyField( + 'Items quantity cannot be less than 1' + ); await expect( createPutawayPage.startStep.splitModal.saveButton ).toBeDisabled(); @@ -216,9 +212,9 @@ test.describe('Assert qty validations in putaways', () => { await createPutawayPage.startStep.splitModal.table .row(2) .quantityField.hover(); - await createPutawayPage.startStep.splitModal.table - .row(2) - .assertValidationOnQtyField('Items quantity cannot be less than 1'); + await createPutawayPage.startStep.splitModal.table.assertValidationOnQtyField( + 'Items quantity cannot be less than 1' + ); }); await test.step('Try to input higher qty on newly added line', async () => { @@ -228,19 +224,15 @@ test.describe('Assert qty validations in putaways', () => { await createPutawayPage.startStep.splitModal.table .row(1) .quantityField.hover(); - await createPutawayPage.startStep.splitModal.table - .row(1) - .assertValidationOnQtyField( - 'Sum of all split items quantities cannot be higher than original putaway item quantity' - ); + await createPutawayPage.startStep.splitModal.table.assertValidationOnQtyField( + 'Sum of all split items quantities cannot be higher than original putaway item quantity' + ); await createPutawayPage.startStep.splitModal.table .row(2) .quantityField.hover(); - await createPutawayPage.startStep.splitModal.table - .row(2) - .assertValidationOnQtyField( - 'Sum of all split items quantities cannot be higher than original putaway item quantity' - ); + await createPutawayPage.startStep.splitModal.table.assertValidationOnQtyField( + 'Sum of all split items quantities cannot be higher than original putaway item quantity' + ); }); await test.step('Try to input 0 on newly added line', async () => { @@ -250,9 +242,9 @@ test.describe('Assert qty validations in putaways', () => { await createPutawayPage.startStep.splitModal.table .row(2) .quantityField.hover(); - await createPutawayPage.startStep.splitModal.table - .row(2) - .assertValidationOnQtyField('Items quantity cannot be less than 1'); + await createPutawayPage.startStep.splitModal.table.assertValidationOnQtyField( + 'Items quantity cannot be less than 1' + ); }); await test.step('Try to input negative qty on newly added line', async () => { @@ -262,9 +254,9 @@ test.describe('Assert qty validations in putaways', () => { await createPutawayPage.startStep.splitModal.table .row(2) .quantityField.hover(); - await createPutawayPage.startStep.splitModal.table - .row(2) - .assertValidationOnQtyField('Items quantity cannot be less than 1'); + await createPutawayPage.startStep.splitModal.table.assertValidationOnQtyField( + 'Items quantity cannot be less than 1' + ); }); await test.step('Leave split modal', async () => { From fbfecdffeb569890ebd4b54e850c391004ce541f Mon Sep 17 00:00:00 2001 From: Katarzyna Date: Wed, 1 Apr 2026 15:42:17 +0200 Subject: [PATCH 5/5] remove unused lines --- src/tests/putaway/qtyValidationsInPutaways.test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/tests/putaway/qtyValidationsInPutaways.test.ts b/src/tests/putaway/qtyValidationsInPutaways.test.ts index 0b18bb1..d786ead 100644 --- a/src/tests/putaway/qtyValidationsInPutaways.test.ts +++ b/src/tests/putaway/qtyValidationsInPutaways.test.ts @@ -78,9 +78,7 @@ test.describe('Assert qty validations in putaways', () => { navbar, createPutawayPage, internalLocationService, - productService, }) => { - productService.setProduct('5'); const internalLocation = await internalLocationService.getLocation(); await test.step('Go to stock movement show page and assert received status', async () => { await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);