diff --git a/src/pages/location/createLocation/tabs/LocationDetailsTabSection.ts b/src/pages/location/createLocation/tabs/LocationDetailsTabSection.ts index b5338a7..8b72e19 100644 --- a/src/pages/location/createLocation/tabs/LocationDetailsTabSection.ts +++ b/src/pages/location/createLocation/tabs/LocationDetailsTabSection.ts @@ -51,6 +51,10 @@ class LocationDetailsTabSection extends BasePageModel { getZoneLocation(name: string) { return this.page.getByRole('listitem').getByText(name, { exact: true }); } + + get clearZoneLocation() { + return this.zoneLocationSelect.locator('.search-choice-close'); + } } export default LocationDetailsTabSection; diff --git a/src/pages/putaway/components/CompletePutawayTable.ts b/src/pages/putaway/components/CompletePutawayTable.ts index a8c5f2c..c796485 100644 --- a/src/pages/putaway/components/CompletePutawayTable.ts +++ b/src/pages/putaway/components/CompletePutawayTable.ts @@ -35,6 +35,14 @@ class Row extends BasePageModel { get quantity() { return this.row.getByTestId('table-cell').nth(7); } + + get preferredBin() { + return this.row.getByTestId('table-cell').nth(8); + } + + get currentBin() { + return this.row.getByTestId('table-cell').nth(9); + } } export default CompletePutawayTable; diff --git a/src/pages/putaway/components/SplitModalTable.ts b/src/pages/putaway/components/SplitModalTable.ts index 9c8c59f..3045f4f 100644 --- a/src/pages/putaway/components/SplitModalTable.ts +++ b/src/pages/putaway/components/SplitModalTable.ts @@ -63,6 +63,17 @@ class Row extends BasePageModel { get putawayBinField() { return this.row.getByTestId('bin-select').getByRole('textbox'); } + + get expandPutawayBinSelect() { + return this.row.locator('[class*="react-select__dropdown-indicator"]'); + } + + getZoneLocation(zoneLocation: string) { + return this.page + .getByTestId('custom-select-dropdown-menu') + .locator('.css-5ih5ya-group react-select__group-heading') + .getByText(zoneLocation, { exact: true }); + } } export default SplitModalTable; diff --git a/src/pages/putaway/components/StartPutawayTable.ts b/src/pages/putaway/components/StartPutawayTable.ts index 3357603..70acacf 100644 --- a/src/pages/putaway/components/StartPutawayTable.ts +++ b/src/pages/putaway/components/StartPutawayTable.ts @@ -73,6 +73,10 @@ class Row extends BasePageModel { return this.row.getByTestId('select-bin'); } + get expandPutawayBinSelect() { + return this.putawayBinSelect.locator('.react-select__dropdown-indicator'); + } + getPutawayBin(putawayBin: string) { return this.page .getByTestId('custom-select-dropdown-menu') @@ -88,6 +92,10 @@ class Row extends BasePageModel { return this.row.getByTestId('table-cell').nth(8); } + get currentdBin() { + return this.row.getByTestId('table-cell').nth(9); + } + get quantityField() { return this.row.getByTestId('table-cell').nth(7); } @@ -107,6 +115,13 @@ class Row extends BasePageModel { get expiryDateField() { return this.row.getByTestId('table-cell').nth(5); } + + getZoneLocation(zoneLocation: string) { + return this.page + .getByTestId('custom-select-dropdown-menu') + .locator('.css-5ih5ya-group react-select__group-heading') + .getByText(zoneLocation, { exact: true }); + } } export default StartPutawayTable; diff --git a/src/pages/putaway/putawayDetails/components/ItemDetailsTable.ts b/src/pages/putaway/putawayDetails/components/ItemDetailsTable.ts index 2f9bbbf..f0346a4 100644 --- a/src/pages/putaway/putawayDetails/components/ItemDetailsTable.ts +++ b/src/pages/putaway/putawayDetails/components/ItemDetailsTable.ts @@ -1,4 +1,4 @@ -import { Locator, Page } from '@playwright/test'; +import { expect, Locator, Page } from '@playwright/test'; import BasePageModel from '@/pages/BasePageModel'; @@ -7,6 +7,12 @@ class ItemDetailsTable extends BasePageModel { super(page); } + async isLoaded() { + await expect( + this.page.getByRole('heading').getByText('Item Details') + ).toBeVisible(); + } + get table() { return this.page.getByRole('table'); } diff --git a/src/pages/putaway/putawayDetails/components/ItemStatusTable.ts b/src/pages/putaway/putawayDetails/components/ItemStatusTable.ts index 6426087..64c361f 100644 --- a/src/pages/putaway/putawayDetails/components/ItemStatusTable.ts +++ b/src/pages/putaway/putawayDetails/components/ItemStatusTable.ts @@ -1,4 +1,4 @@ -import { Locator, Page } from '@playwright/test'; +import { expect, Locator, Page } from '@playwright/test'; import BasePageModel from '@/pages/BasePageModel'; @@ -7,6 +7,12 @@ class ItemStatusTable extends BasePageModel { super(page); } + async isLoaded() { + await expect( + this.page.getByRole('heading').getByText('Item Status') + ).toBeVisible(); + } + get table() { return this.page.getByTestId('item-status-table'); } diff --git a/src/pages/putaway/putawayDetails/components/SummaryTable.ts b/src/pages/putaway/putawayDetails/components/SummaryTable.ts index eea1fa6..7fa3cf6 100644 --- a/src/pages/putaway/putawayDetails/components/SummaryTable.ts +++ b/src/pages/putaway/putawayDetails/components/SummaryTable.ts @@ -1,4 +1,4 @@ -import { Locator, Page } from '@playwright/test'; +import { expect, Locator, Page } from '@playwright/test'; import BasePageModel from '@/pages/BasePageModel'; @@ -7,6 +7,12 @@ class SummaryTable extends BasePageModel { super(page); } + async isLoaded() { + await expect( + this.page.getByRole('heading').getByText('Summary') + ).toBeVisible(); + } + get table() { return this.page.getByRole('table'); } diff --git a/src/pages/stockMovementShow/components/DocumentsTable.ts b/src/pages/stockMovementShow/components/DocumentsTable.ts index 090ea7a..bacd82c 100644 --- a/src/pages/stockMovementShow/components/DocumentsTable.ts +++ b/src/pages/stockMovementShow/components/DocumentsTable.ts @@ -1,4 +1,4 @@ -import { Locator, Page } from '@playwright/test'; +import { expect, Locator, Page } from '@playwright/test'; import BasePageModel from '@/pages/BasePageModel'; @@ -7,6 +7,12 @@ class DocumentsListTable extends BasePageModel { super(page); } + async isLoaded() { + await expect( + this.page.getByRole('heading').getByText('Documents') + ).toBeVisible(); + } + get table() { return this.page .getByRole('region', { name: 'Documents' }) diff --git a/src/pages/stockMovementShow/components/PackingListTable.ts b/src/pages/stockMovementShow/components/PackingListTable.ts index bf91321..d61c160 100644 --- a/src/pages/stockMovementShow/components/PackingListTable.ts +++ b/src/pages/stockMovementShow/components/PackingListTable.ts @@ -1,4 +1,4 @@ -import { Locator, Page } from '@playwright/test'; +import { expect, Locator, Page } from '@playwright/test'; import BasePageModel from '@/pages/BasePageModel'; @@ -7,6 +7,12 @@ class PackingListTable extends BasePageModel { super(page); } + async isLoaded() { + await expect( + this.page.getByRole('heading').getByText('Packing List') + ).toBeVisible(); + } + get table() { return this.page .getByRole('region', { name: 'Packing List' }) diff --git a/src/pages/stockMovementShow/components/ReceiptsTable.ts b/src/pages/stockMovementShow/components/ReceiptsTable.ts index 0baca7e..b3cbb0b 100644 --- a/src/pages/stockMovementShow/components/ReceiptsTable.ts +++ b/src/pages/stockMovementShow/components/ReceiptsTable.ts @@ -1,4 +1,4 @@ -import { Locator, Page } from '@playwright/test'; +import { expect, Locator, Page } from '@playwright/test'; import BasePageModel from '@/pages/BasePageModel'; @@ -7,6 +7,12 @@ class ReceiptsListTable extends BasePageModel { super(page); } + async isLoaded() { + await expect( + this.page.getByRole('heading').getByText('Receipt') + ).toBeVisible(); + } + get table() { return this.page .getByRole('region', { name: 'Receipt' }) diff --git a/src/tests/putaway/assertZonesInPutaways.test.ts b/src/tests/putaway/assertZonesInPutaways.test.ts new file mode 100644 index 0000000..e16464b --- /dev/null +++ b/src/tests/putaway/assertZonesInPutaways.test.ts @@ -0,0 +1,456 @@ +import AppConfig from '@/config/AppConfig'; +import { LOCATION_URL } from '@/constants/applicationUrls'; +import { ShipmentType } from '@/constants/ShipmentType'; +import { expect, test } from '@/fixtures/fixtures'; +import { Product } from '@/generated/ProductCodes.generated'; +import { ProductResponse, StockMovementResponse } from '@/types'; +import RefreshCachesUtils from '@/utils/RefreshCaches'; +import { + deleteReceivedShipment, + getShipmentId, + getShipmentItemId, +} from '@/utils/shipmentUtils'; +import { byNameAsc } from '@/utils/sortUtils'; +import UniqueIdentifier from '@/utils/UniqueIdentifier'; + +test.describe('Assert zones on putaway pages', () => { + let STOCK_MOVEMENT: StockMovementResponse; + let productA: ProductResponse; + let productB: ProductResponse; + const uniqueIdentifier = new UniqueIdentifier(); + const zoneLocationName = uniqueIdentifier.generateUniqueString('zone'); + + test.beforeEach( + async ({ + supplierLocationService, + mainLocationService, + stockMovementService, + productService, + receivingService, + productShowPage, + productEditPage, + internalLocationService, + page, + locationListPage, + createLocationPage, + }) => { + const supplierLocation = await supplierLocationService.getLocation(); + const mainLocation = await mainLocationService.getLocation(); + const internalLocation = await internalLocationService.getLocation(); + STOCK_MOVEMENT = await stockMovementService.createInbound({ + originId: supplierLocation.id, + }); + + [productA, productB] = [ + await productService.getProduct(Product.FIVE), + await productService.getProduct(Product.FOUR), + ].sort(byNameAsc); + + await test.step('Create and receive stock movement', async () => { + await stockMovementService.addItemsToInboundStockMovement( + STOCK_MOVEMENT.id, + [ + { productId: productA.id, quantity: 10 }, + { productId: productB.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); + }); + + await test.step('Create zone for location', async () => { + await page.goto(LOCATION_URL.list()); + await locationListPage.searchByLocationNameField.fill( + mainLocation.name + ); + await locationListPage.findButton.click(); + await expect( + locationListPage.getLocationEditButton(mainLocation.name) + ).toBeVisible(); + await locationListPage.getLocationEditButton(mainLocation.name).click(); + await createLocationPage.zoneLocationTab.click(); + await createLocationPage.zoneLocationTabSection.isLoaded(); + await createLocationPage.zoneLocationTabSection.addZoneLocationButton.click(); + await createLocationPage.zoneLocationTabSection.addZoneLocationDialog.zoneLocationNameField.fill( + zoneLocationName + ); + await createLocationPage.zoneLocationTabSection.addZoneLocationDialog.saveButton.click(); + await createLocationPage.zoneLocationTabSection.isLoaded(); + }); + + await test.step('Assign created zone to bin location', async () => { + await createLocationPage.binLocationTab.click(); + await createLocationPage.binLocationTabSection.isLoaded(); + await createLocationPage.binLocationTabSection.searchField.fill( + internalLocation.name + ); + await createLocationPage.binLocationTabSection.searchField.press( + 'Enter' + ); + await createLocationPage.binLocationTabSection.isLoaded(); + await createLocationPage.binLocationTabSection.editBinButton + .first() + .click(); + await createLocationPage.locationDetailsTabSection.zoneLocationSelect.click(); + await createLocationPage.locationDetailsTabSection + .getZoneLocation(zoneLocationName) + .click(); + await createLocationPage.locationDetailsTabSection.saveButton.click(); + }); + + await test.step('Assign bin with zone as preferred bin', async () => { + await productShowPage.goToPage(productB.id); + await productShowPage.editProductkButton.click(); + await productEditPage.inventoryLevelsTab.click(); + await productEditPage.inventoryLevelsTabSection.createStockLevelButton.click(); + await productEditPage.inventoryLevelsTabSection.createStockLevelModal.receivingTab.click(); + const internalLocation = await internalLocationService.getLocation(); + await productEditPage.inventoryLevelsTabSection.createStockLevelModal.defaultPutawayLocation.click(); + await productEditPage.inventoryLevelsTabSection.createStockLevelModal + .getDefaultPutawayLocation(internalLocation.name) + .click(); + await productEditPage.inventoryLevelsTabSection.createStockLevelModal.createButton.click(); + }); + } + ); + + test.afterEach( + async ({ + stockMovementShowPage, + stockMovementService, + navbar, + transactionListPage, + oldViewShipmentPage, + productService, + productShowPage, + productEditPage, + page, + locationListPage, + mainLocationService, + createLocationPage, + internalLocationService, + }) => { + await navbar.configurationButton.click(); + await navbar.transactions.click(); + for (let n = 1; n < 4; n++) { + await transactionListPage.deleteTransaction(1); + } + await deleteReceivedShipment({ + stockMovementShowPage, + oldViewShipmentPage, + stockMovementService, + STOCK_MOVEMENT, + }); + const product = await productService.getProduct(Product.FOUR); + + await test.step('Delete inventory level', async () => { + await productShowPage.goToPage(product.id); + await productShowPage.editProductkButton.click(); + await productEditPage.inventoryLevelsTab.click(); + await productEditPage.inventoryLevelsTabSection + .row(1) + .editInventoryLevelButton.click(); + await expect( + productEditPage.inventoryLevelsTabSection.table + ).toBeVisible(); + await productEditPage.inventoryLevelsTabSection.createStockLevelModal.clickDeleteInventoryLevel(); + }); + + await test.step('Remove zone from bin location', async () => { + const mainLocation = await mainLocationService.getLocation(); + const internalLocation = await internalLocationService.getLocation(); + await page.goto(LOCATION_URL.list()); + await locationListPage.searchByLocationNameField.fill( + mainLocation.name + ); + await locationListPage.findButton.click(); + await expect( + locationListPage.getLocationEditButton(mainLocation.name) + ).toBeVisible(); + await locationListPage.getLocationEditButton(mainLocation.name).click(); + await createLocationPage.binLocationTab.click(); + await createLocationPage.binLocationTabSection.isLoaded(); + await createLocationPage.binLocationTabSection.searchField.fill( + internalLocation.name + ); + await createLocationPage.binLocationTabSection.searchField.press( + 'Enter' + ); + await createLocationPage.binLocationTabSection.isLoaded(); + await createLocationPage.binLocationTabSection.editBinButton + .first() + .click(); + await createLocationPage.locationDetailsTabSection.clearZoneLocation.click(); + await createLocationPage.locationDetailsTabSection.saveButton.click(); + }); + + await test.step('Deactivate created zone location', async () => { + await createLocationPage.zoneLocationTab.click(); + await createLocationPage.zoneLocationTabSection.isLoaded(); + await createLocationPage.zoneLocationTabSection.searchField.fill( + zoneLocationName + ); + await createLocationPage.zoneLocationTabSection.searchField.press( + 'Enter' + ); + await createLocationPage.zoneLocationTabSection.isLoaded(); + await createLocationPage.zoneLocationTabSection.editZoneButton.click(); + await createLocationPage.locationConfigurationTab.click(); + await createLocationPage.locationConfigurationTabSection.activeCheckbox.uncheck(); + await createLocationPage.locationConfigurationTabSection.saveButton.click(); + }); + } + ); + + test('Create putaway and assert zones on putaway pages', async ({ + stockMovementShowPage, + navbar, + createPutawayPage, + internalLocationService, + putawayDetailsPage, + }) => { + const receivingBin = + AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; + const internalLocation = await internalLocationService.getLocation(); + + 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 1st putaway', async () => { + await createPutawayPage.table + .row(0) + .getExpandBinLocation(receivingBin) + .click(); + await createPutawayPage.table.row(1).checkbox.click(); + await createPutawayPage.startPutawayButton.click(); + await createPutawayPage.startStep.isLoaded(); + await createPutawayPage.startStep.table.row(0).editButton.click(); + await createPutawayPage.startStep.table.row(0).quantityInput.fill('5'); + }); + + await test.step('Assert zones on start putaway page', async () => { + await createPutawayPage.startStep.table + .row(1) + .expandPutawayBinSelect.waitFor({ state: 'visible' }); + await createPutawayPage.startStep.table + .row(1) + .expandPutawayBinSelect.click(); + await createPutawayPage.startStep.table + .row(1) + .getZoneLocation(zoneLocationName) + .isVisible(); + await createPutawayPage.startStep.table + .row(1) + .getPutawayBin(internalLocation.name) + .click(); + await createPutawayPage.startStep.nextButton.click(); + }); + + await test.step('Assert zones on confirm page', async () => { + await createPutawayPage.completeStep.isLoaded(); + await expect( + createPutawayPage.completeStep.table.row(2).putawayBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + }); + + await test.step('Complete putaway', async () => { + await createPutawayPage.completeStep.completePutawayButton.click(); + await expect( + createPutawayPage.completeStep.confirmPutawayDialog + ).toBeVisible(); + await createPutawayPage.completeStep.yesButtonOnConfirmPutawayDialog.click(); + await putawayDetailsPage.isLoaded(); + await expect(putawayDetailsPage.statusTag).toHaveText('Completed'); + }); + + 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 2nd putaway', async () => { + await createPutawayPage.table + .row(0) + .getExpandBinLocation(receivingBin) + .click(); + 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('Assert zones on start putaway page', async () => { + await expect( + createPutawayPage.startStep.table.row(1).currentdBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + await createPutawayPage.startStep.table + .row(1) + .expandPutawayBinSelect.waitFor({ state: 'visible' }); + await createPutawayPage.startStep.table + .row(1) + .expandPutawayBinSelect.click(); + await createPutawayPage.startStep.table + .row(1) + .getZoneLocation(zoneLocationName) + .isVisible(); + await createPutawayPage.startStep.table + .row(1) + .getPutawayBin(internalLocation.name) + .click(); + await expect( + createPutawayPage.startStep.table.row(2).preferredBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + await expect( + createPutawayPage.startStep.table.row(2).putawayBinSelect + ).toContainText(internalLocation.name); + await createPutawayPage.startStep.table + .row(2) + .expandPutawayBinSelect.waitFor({ state: 'visible' }); + await createPutawayPage.startStep.table + .row(2) + .expandPutawayBinSelect.click(); + await createPutawayPage.startStep.table + .row(2) + .getZoneLocation(zoneLocationName) + .isVisible(); + await createPutawayPage.startStep.table + .row(2) + .getPutawayBin(internalLocation.name) + .click(); + }); + + await test.step('Apply ordering by current bin', async () => { + await createPutawayPage.startStep.sortButton.click(); + await expect(createPutawayPage.startStep.sortButton).toContainText( + 'Sort by current bins' + ); + await expect( + createPutawayPage.startStep.table.row(1).currentdBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + await expect( + createPutawayPage.startStep.table.row(2).preferredBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + }); + + await test.step('Apply ordering by preferred bin', async () => { + await createPutawayPage.startStep.sortButton.click(); + await expect(createPutawayPage.startStep.sortButton).toContainText( + 'Sort by preferred bin' + ); + await expect( + createPutawayPage.startStep.table.row(2).currentdBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + await expect( + createPutawayPage.startStep.table.row(1).preferredBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + }); + + await test.step('Return to original order', async () => { + await createPutawayPage.startStep.sortButton.click(); + await expect(createPutawayPage.startStep.sortButton).toContainText( + 'Sort by current bins' + ); + await expect( + createPutawayPage.startStep.table.row(1).currentdBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + await expect( + createPutawayPage.startStep.table.row(2).preferredBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + }); + + await test.step('Assert zones on split line dialog', async () => { + await createPutawayPage.startStep.table + .row(0) + .splitLineButton.first() + .click(); + await createPutawayPage.startStep.splitModal.isLoaded(); + await createPutawayPage.startStep.splitModal.table + .row(1) + .expandPutawayBinSelect.click(); + await createPutawayPage.startStep.table + .row(1) + .getZoneLocation(zoneLocationName) + .isVisible(); + await createPutawayPage.startStep.splitModal.table + .row(1) + .getPutawayBin(internalLocation.name); + await createPutawayPage.startStep.splitModal.addLineButton.click(); + await createPutawayPage.startStep.splitModal.table + .row(2) + .expandPutawayBinSelect.click(); + await createPutawayPage.startStep.table + .row(2) + .getZoneLocation(zoneLocationName) + .isVisible(); + await createPutawayPage.startStep.splitModal.table + .row(2) + .getPutawayBin(internalLocation.name); + await createPutawayPage.startStep.splitModal.table + .row(2) + .quantityField.fill('5'); + await createPutawayPage.startStep.splitModal.cancelButton.click(); + await createPutawayPage.startStep.nextButton.click(); + }); + + await test.step('Assert zones on confirm page', async () => { + await createPutawayPage.completeStep.isLoaded(); + await expect( + createPutawayPage.completeStep.table.row(2).putawayBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + await expect( + createPutawayPage.completeStep.table.row(2).currentBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + await expect( + createPutawayPage.completeStep.table.row(3).putawayBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + await expect( + createPutawayPage.completeStep.table.row(3).preferredBin + ).toContainText(`${zoneLocationName}: ${internalLocation.name}`); + }); + + await test.step('Complete putaway', async () => { + await createPutawayPage.completeStep.completePutawayButton.click(); + await putawayDetailsPage.isLoaded(); + await expect(putawayDetailsPage.statusTag).toHaveText('Completed'); + }); + }); +}); diff --git a/src/tests/putaway/deleteItemsFromPutaway.test.ts b/src/tests/putaway/deleteItemsFromPutaway.test.ts index 9f9fa23..012bb39 100644 --- a/src/tests/putaway/deleteItemsFromPutaway.test.ts +++ b/src/tests/putaway/deleteItemsFromPutaway.test.ts @@ -2,16 +2,19 @@ import AppConfig from '@/config/AppConfig'; import { ShipmentType } from '@/constants/ShipmentType'; import { expect, test } from '@/fixtures/fixtures'; import { Product } from '@/generated/ProductCodes.generated'; -import { StockMovementResponse } from '@/types'; +import { ProductResponse, StockMovementResponse } from '@/types'; import RefreshCachesUtils from '@/utils/RefreshCaches'; import { deleteReceivedShipment, getShipmentId, getShipmentItemId, } from '@/utils/shipmentUtils'; +import { byNameAsc } from '@/utils/sortUtils'; test.describe('Delete items from putaway', () => { let STOCK_MOVEMENT: StockMovementResponse; + let product: ProductResponse; + let product2: ProductResponse; test.beforeEach( async ({ @@ -25,8 +28,10 @@ test.describe('Delete items from putaway', () => { originId: supplierLocation.id, }); - const product = await productService.getProduct(Product.FIVE); - const product2 = await productService.getProduct(Product.FOUR); + [product, product2] = [ + await productService.getProduct(Product.FIVE), + await productService.getProduct(Product.FOUR), + ].sort(byNameAsc); await stockMovementService.addItemsToInboundStockMovement( STOCK_MOVEMENT.id, @@ -93,13 +98,10 @@ test.describe('Delete items from putaway', () => { createPutawayPage, internalLocationService, putawayDetailsPage, - productService, putawayListPage, }) => { const receivingBin = AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; - const product = await productService.getProduct(Product.FIVE); - const product2 = await productService.getProduct(Product.FOUR); const internalLocation = await internalLocationService.getLocation(); await test.step('Go to create putaway page', async () => { @@ -143,6 +145,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on summary tab', async () => { await putawayDetailsPage.summaryTab.click(); + await putawayDetailsPage.summaryTable.isLoaded(); await expect(putawayDetailsPage.summaryTable.orderItemRows).toHaveCount( 2 ); @@ -150,6 +153,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on status table', async () => { await putawayDetailsPage.itemStatusTab.click(); + await putawayDetailsPage.itemStatusTable.isLoaded(); await expect( putawayDetailsPage.itemStatusTable.orderItemRows ).toHaveCount(2); @@ -157,6 +161,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on item details table', async () => { await putawayDetailsPage.itemDetailsTab.click(); + await putawayDetailsPage.itemDetailsTable.isLoaded(); await expect( putawayDetailsPage.itemDetailsTable.orderItemRows ).toHaveCount(2); @@ -190,6 +195,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on summary tab', async () => { await putawayDetailsPage.summaryTab.click(); + await putawayDetailsPage.summaryTable.isLoaded(); await expect(putawayDetailsPage.summaryTable.orderItemRows).toHaveCount( 1 ); @@ -197,6 +203,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on items status table', async () => { await putawayDetailsPage.itemStatusTab.click(); + await putawayDetailsPage.itemStatusTable.isLoaded(); await expect( putawayDetailsPage.itemStatusTable.orderItemRows ).toHaveCount(1); @@ -204,6 +211,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on item details table', async () => { await putawayDetailsPage.itemDetailsTab.click(); + await putawayDetailsPage.itemDetailsTable.isLoaded(); await expect( putawayDetailsPage.itemDetailsTable.orderItemRows ).toHaveCount(1); @@ -268,6 +276,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on summary tab', async () => { await putawayDetailsPage.summaryTab.click(); + await putawayDetailsPage.summaryTable.isLoaded(); await expect(putawayDetailsPage.summaryTable.orderItemRows).toHaveCount( 2 ); @@ -275,6 +284,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on items status table', async () => { await putawayDetailsPage.itemStatusTab.click(); + await putawayDetailsPage.itemStatusTable.isLoaded(); await expect( putawayDetailsPage.itemStatusTable.orderItemRows ).toHaveCount(2); @@ -282,6 +292,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on item details table', async () => { await putawayDetailsPage.itemDetailsTab.click(); + await putawayDetailsPage.itemDetailsTable.isLoaded(); await expect( putawayDetailsPage.itemDetailsTable.orderItemRows ).toHaveCount(2); @@ -318,6 +329,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on summary tab on completed putaway', async () => { await putawayDetailsPage.summaryTab.click(); + await putawayDetailsPage.summaryTable.isLoaded(); await expect(putawayDetailsPage.summaryTable.orderItemRows).toHaveCount( 2 ); @@ -325,6 +337,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on items status table on completed putaway', async () => { await putawayDetailsPage.itemStatusTab.click(); + await putawayDetailsPage.itemStatusTable.isLoaded(); await expect( putawayDetailsPage.itemStatusTable.orderItemRows ).toHaveCount(2); @@ -332,6 +345,7 @@ test.describe('Delete items from putaway', () => { await test.step('Assert number of lines on item details table on completed putaway', async () => { await putawayDetailsPage.itemDetailsTab.click(); + await putawayDetailsPage.itemDetailsTable.isLoaded(); await expect( putawayDetailsPage.itemDetailsTable.orderItemRows ).toHaveCount(2); diff --git a/src/tests/putaway/performPutawayAsManagerUser.test.ts b/src/tests/putaway/performPutawayAsManagerUser.test.ts index 35d0a6d..725670a 100644 --- a/src/tests/putaway/performPutawayAsManagerUser.test.ts +++ b/src/tests/putaway/performPutawayAsManagerUser.test.ts @@ -6,16 +6,19 @@ import { Product } from '@/generated/ProductCodes.generated'; import CreatePutawayPage from '@/pages/putaway/CreatePutawayPage'; import PutawayDetailsPage from '@/pages/putaway/putawayDetails/PutawayDetailsPage'; import StockMovementShowPage from '@/pages/stockMovementShow/StockMovementShowPage'; -import { StockMovementResponse } from '@/types'; +import { ProductResponse, StockMovementResponse } from '@/types'; import RefreshCachesUtils from '@/utils/RefreshCaches'; import { deleteReceivedShipment, getShipmentId, getShipmentItemId, } from '@/utils/shipmentUtils'; +import { byNameAsc } from '@/utils/sortUtils'; test.describe('Perform putaway as manager user', () => { let STOCK_MOVEMENT: StockMovementResponse; + let product: ProductResponse; + let product2: ProductResponse; test.beforeEach( async ({ @@ -29,8 +32,10 @@ test.describe('Perform putaway as manager user', () => { originId: supplierLocation.id, }); - const product = await productService.getProduct(Product.THREE); - const product2 = await productService.getProduct(Product.FOUR); + [product, product2] = [ + await productService.getProduct(Product.THREE), + await productService.getProduct(Product.FOUR), + ].sort(byNameAsc); await stockMovementService.addItemsToInboundStockMovement( STOCK_MOVEMENT.id, @@ -94,12 +99,9 @@ test.describe('Perform putaway as manager user', () => { test('Perform putaway as manager user', async ({ managerUserContext, internalLocationService, - productService, }) => { const receivingBin = - AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; - const product = await productService.getProduct(Product.THREE); - const product2 = await productService.getProduct(Product.FOUR); + AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;; const internalLocation = await internalLocationService.getLocation(); const managerUserPage = await managerUserContext.newPage(); @@ -125,10 +127,10 @@ test.describe('Perform putaway as manager user', () => { .getExpandBinLocation(receivingBin) .click(); await expect( - createPutawayPage.table.row(1).getProductName(product2.name) + createPutawayPage.table.row(2).getProductName(product2.name) ).toBeVisible(); await expect( - createPutawayPage.table.row(2).getProductName(product.name) + createPutawayPage.table.row(1).getProductName(product.name) ).toBeVisible(); await createPutawayPage.table.row(1).checkbox.click(); await createPutawayPage.table.row(2).checkbox.click(); @@ -214,10 +216,10 @@ test.describe('Perform putaway as manager user', () => { .getExpandBinLocation(receivingBin) .click(); await expect( - createPutawayPage.table.row(1).getProductName(product2.name) + createPutawayPage.table.row(2).getProductName(product2.name) ).toBeVisible(); await expect( - createPutawayPage.table.row(2).getProductName(product.name) + createPutawayPage.table.row(1).getProductName(product.name) ).toBeVisible(); await managerUserPage.close(); }); diff --git a/src/tests/putaway/putawayImtemWithEmptyLot.test.ts b/src/tests/putaway/putawayImtemWithEmptyLot.test.ts index 5f8dd07..ad7cc90 100644 --- a/src/tests/putaway/putawayImtemWithEmptyLot.test.ts +++ b/src/tests/putaway/putawayImtemWithEmptyLot.test.ts @@ -66,7 +66,7 @@ test.describe('Putaway item with empty lot', () => { }) => { await navbar.configurationButton.click(); await navbar.transactions.click(); - for (let n = 1; n < 7; n++) { + for (let n = 1; n < 5; n++) { await transactionListPage.deleteTransaction(1); } await deleteReceivedShipment({ diff --git a/src/tests/putaway/putawayMoreThan1Item.test.ts b/src/tests/putaway/putawayMoreThan1Item.test.ts index eb79bee..512892d 100644 --- a/src/tests/putaway/putawayMoreThan1Item.test.ts +++ b/src/tests/putaway/putawayMoreThan1Item.test.ts @@ -2,16 +2,19 @@ import AppConfig from '@/config/AppConfig'; import { ShipmentType } from '@/constants/ShipmentType'; import { expect, test } from '@/fixtures/fixtures'; import { Product } from '@/generated/ProductCodes.generated'; -import { StockMovementResponse } from '@/types'; +import { ProductResponse, StockMovementResponse } from '@/types'; import RefreshCachesUtils from '@/utils/RefreshCaches'; import { deleteReceivedShipment, getShipmentId, getShipmentItemId, } from '@/utils/shipmentUtils'; +import { byNameAsc } from '@/utils/sortUtils'; test.describe('Create putaway for more than 1 item, separate putaways', () => { let STOCK_MOVEMENT: StockMovementResponse; + let product: ProductResponse; + let product2: ProductResponse; test.beforeEach( async ({ @@ -25,8 +28,10 @@ test.describe('Create putaway for more than 1 item, separate putaways', () => { originId: supplierLocation.id, }); - const product = await productService.getProduct(Product.FIVE); - const product2 = await productService.getProduct(Product.FOUR); + [product, product2] = [ + await productService.getProduct(Product.FIVE), + await productService.getProduct(Product.FOUR), + ].sort(byNameAsc); await stockMovementService.addItemsToInboundStockMovement( STOCK_MOVEMENT.id, @@ -94,13 +99,10 @@ test.describe('Create putaway for more than 1 item, separate putaways', () => { internalLocationService, productShowPage, putawayDetailsPage, - productService, putawayListPage, }) => { const receivingBin = AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; - const product = await productService.getProduct(Product.FIVE); - const product2 = await productService.getProduct(Product.FOUR); const internalLocation = await internalLocationService.getLocation(); await test.step('Go to create putaway page', async () => { @@ -245,6 +247,8 @@ test.describe('Create putaway for more than 1 item, separate putaways', () => { test.describe('Putaway 2 items in the same putaway', () => { let STOCK_MOVEMENT: StockMovementResponse; + let product: ProductResponse; + let product2: ProductResponse; test.beforeEach( async ({ @@ -258,8 +262,10 @@ test.describe('Putaway 2 items in the same putaway', () => { originId: supplierLocation.id, }); - const product = await productService.getProduct(Product.FIVE); - const product2 = await productService.getProduct(Product.FOUR); + [product, product2] = [ + await productService.getProduct(Product.FIVE), + await productService.getProduct(Product.FOUR), + ].sort(byNameAsc); await stockMovementService.addItemsToInboundStockMovement( STOCK_MOVEMENT.id, diff --git a/src/tests/putaway/putawayToPreferredBin.test.ts b/src/tests/putaway/putawayToPreferredBin.test.ts index 49429ec..b979b0b 100644 --- a/src/tests/putaway/putawayToPreferredBin.test.ts +++ b/src/tests/putaway/putawayToPreferredBin.test.ts @@ -2,16 +2,19 @@ import AppConfig from '@/config/AppConfig'; import { ShipmentType } from '@/constants/ShipmentType'; import { expect, test } from '@/fixtures/fixtures'; import { Product } from '@/generated/ProductCodes.generated'; -import { StockMovementResponse } from '@/types'; +import { ProductResponse, StockMovementResponse } from '@/types'; import RefreshCachesUtils from '@/utils/RefreshCaches'; import { deleteReceivedShipment, getShipmentId, getShipmentItemId, } from '@/utils/shipmentUtils'; +import { byNameAsc } from '@/utils/sortUtils'; test.describe('Putaway to preferred bin and default bin', () => { let STOCK_MOVEMENT: StockMovementResponse; + let product: ProductResponse; + let product2: ProductResponse; test.beforeEach( async ({ @@ -28,8 +31,10 @@ test.describe('Putaway to preferred bin and default bin', () => { originId: supplierLocation.id, }); - const product = await productService.getProduct(Product.FIVE); - const product2 = await productService.getProduct(Product.FOUR); + [product, product2] = [ + await productService.getProduct(Product.FIVE), + await productService.getProduct(Product.FOUR), + ].sort(byNameAsc); await stockMovementService.addItemsToInboundStockMovement( STOCK_MOVEMENT.id, @@ -122,12 +127,9 @@ test.describe('Putaway to preferred bin and default bin', () => { internalLocationService, productShowPage, putawayDetailsPage, - productService, }) => { const receivingBin = AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; - const product = await productService.getProduct(Product.FIVE); - const product2 = await productService.getProduct(Product.FOUR); const internalLocation = await internalLocationService.getLocation(); await test.step('Go to create putaway page', async () => { @@ -220,11 +222,10 @@ test.describe('Putaway to preferred bin and default bin', () => { internalLocation2Service, productShowPage, putawayDetailsPage, - productService, }) => { const receivingBin = AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; - const product2 = await productService.getProduct(Product.FOUR); + const internalLocation = await internalLocationService.getLocation(); const internalLocation2 = await internalLocation2Service.getLocation(); diff --git a/src/tests/putaway/splitLineInPutaway.test.ts b/src/tests/putaway/splitLineInPutaway.test.ts index cb2bf28..2cd5b49 100644 --- a/src/tests/putaway/splitLineInPutaway.test.ts +++ b/src/tests/putaway/splitLineInPutaway.test.ts @@ -160,6 +160,7 @@ test.describe('Split line in Putaway', () => { await test.step('Assert content of items status table', async () => { await putawayDetailsPage.itemStatusTab.click(); + await putawayDetailsPage.itemStatusTable.isLoaded(); await expect( putawayDetailsPage.itemStatusTable.row(1).itemStatus ).toHaveText('COMPLETED'); @@ -330,6 +331,7 @@ test.describe('Split line in Putaway', () => { await test.step('Assert content of items status table', async () => { await putawayDetailsPage.itemStatusTab.click(); + await putawayDetailsPage.itemStatusTable.isLoaded(); await expect( putawayDetailsPage.itemStatusTable.row(1).itemStatus ).toHaveText('COMPLETED'); diff --git a/src/tests/putaway/validationOnQtyRemovedFromReceivingBin.test.ts b/src/tests/putaway/validationOnQtyRemovedFromReceivingBin.test.ts index 329334f..47897ba 100644 --- a/src/tests/putaway/validationOnQtyRemovedFromReceivingBin.test.ts +++ b/src/tests/putaway/validationOnQtyRemovedFromReceivingBin.test.ts @@ -5,16 +5,19 @@ import { ShipmentType } from '@/constants/ShipmentType'; import { expect, test } from '@/fixtures/fixtures'; import { Product } from '@/generated/ProductCodes.generated'; import ProductShowPage from '@/pages/product/productShow/ProductShowPage'; -import { StockMovementResponse } from '@/types'; +import { ProductResponse, StockMovementResponse } from '@/types'; import RefreshCachesUtils from '@/utils/RefreshCaches'; import { deleteReceivedShipment, getShipmentId, getShipmentItemId, } from '@/utils/shipmentUtils'; +import { byNameAsc } from '@/utils/sortUtils'; test.describe('Assert validation on qty removed from receiving bin', () => { let STOCK_MOVEMENT: StockMovementResponse; + let product: ProductResponse; + let product2: ProductResponse; test.beforeEach( async ({ @@ -28,8 +31,10 @@ test.describe('Assert validation on qty removed from receiving bin', () => { originId: supplierLocation.id, }); - const product = await productService.getProduct(Product.FIVE); - const product2 = await productService.getProduct(Product.FOUR); + [product, product2] = [ + await productService.getProduct(Product.FIVE), + await productService.getProduct(Product.FOUR), + ].sort(byNameAsc); await stockMovementService.addItemsToInboundStockMovement( STOCK_MOVEMENT.id, @@ -78,7 +83,7 @@ test.describe('Assert validation on qty removed from receiving bin', () => { }) => { await navbar.configurationButton.click(); await navbar.transactions.click(); - for (let n = 1; n < 4; n++) { + for (let n = 1; n < 6; n++) { await transactionListPage.deleteTransaction(1); } await deleteReceivedShipment({ @@ -99,15 +104,12 @@ test.describe('Assert validation on qty removed from receiving bin', () => { internalLocationService, productShowPage, putawayDetailsPage, - productService, putawayListPage, browser, navbar, }) => { const receivingBin = AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; - const product = await productService.getProduct(Product.FIVE); - const product2 = await productService.getProduct(Product.FOUR); const internalLocation = await internalLocationService.getLocation(); await test.step('Edit transaction date of transfer in', async () => { diff --git a/src/tests/receiving/assertCreationOfGoodsReceiptNote.test.ts b/src/tests/receiving/assertCreationOfGoodsReceiptNote.test.ts index 83c1614..37793c4 100644 --- a/src/tests/receiving/assertCreationOfGoodsReceiptNote.test.ts +++ b/src/tests/receiving/assertCreationOfGoodsReceiptNote.test.ts @@ -83,6 +83,7 @@ test.describe('Assert Goods Receipt Note is created and opened', () => { await test.step('Go to Documnents tab and assert Goods receipt note is not visible', async () => { await stockMovementShowPage.documentTab.click(); + await stockMovementShowPage.documentsListTable.isLoaded(); await expect( stockMovementShowPage.documentsListTable .row(7) @@ -122,6 +123,7 @@ test.describe('Assert Goods Receipt Note is created and opened', () => { await test.step('Assert Goods receipt note is created and opened for partially received shipment', async () => { await stockMovementShowPage.documentTab.click(); + await stockMovementShowPage.documentsListTable.isLoaded(); await expect( stockMovementShowPage.documentsListTable .row(7) @@ -159,6 +161,7 @@ test.describe('Assert Goods Receipt Note is created and opened', () => { await test.step('Assert Goods receipt note is created and opened for received shipment', async () => { await stockMovementShowPage.documentTab.click(); + await stockMovementShowPage.documentsListTable.isLoaded(); await expect( stockMovementShowPage.documentsListTable .row(7) diff --git a/src/tests/receiving/cancelRemainingQty.test.ts b/src/tests/receiving/cancelRemainingQty.test.ts index 7818cb1..421a925 100644 --- a/src/tests/receiving/cancelRemainingQty.test.ts +++ b/src/tests/receiving/cancelRemainingQty.test.ts @@ -125,6 +125,7 @@ test.describe('Cancel qty in the middle of receipt', () => { await test.step('Assert canceled qty on stock movement show page', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Received'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await expect( stockMovementShowPage.receiptListTable.row(1).quantityCanceled ).toHaveText('50'); @@ -177,6 +178,7 @@ test.describe('Cancel qty in the middle of receipt', () => { await test.step('Assert canceled qty on stock movement show page', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Receiving'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await expect( stockMovementShowPage.receiptListTable.row(1).quantityReceived ).toHaveText('50'); @@ -234,6 +236,7 @@ test.describe('Cancel qty in the middle of receipt', () => { await test.step('Assert canceled qty on stock movement show page', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Received'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await expect( stockMovementShowPage.receiptListTable.row(2).quantityCanceled ).toHaveText('10'); @@ -303,6 +306,7 @@ test.describe('Cancel qty in the middle of receipt', () => { await test.step('Assert canceled and received qty on stock movement show page', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Received'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await expect( stockMovementShowPage.receiptListTable.row(1).quantityCanceled ).toHaveText('0'); @@ -374,6 +378,7 @@ test.describe('Cancel qty in the middle of receipt', () => { await test.step('Assert canceled qty on stock movement show page', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Received'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await expect( stockMovementShowPage.receiptListTable.row(1).quantityCanceled ).toHaveText('50'); @@ -438,6 +443,7 @@ test.describe('Cancel qty in the middle of receipt', () => { await test.step('Assert canceled and received qty on stock movement show page', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Receiving'); await stockMovementShowPage.packingListTab.click(); + await stockMovementShowPage.packingListTable.isLoaded(); await expect( stockMovementShowPage.packingListTable.row(1).quantityShipped ).toHaveText('100'); @@ -486,6 +492,7 @@ test.describe('Cancel qty in the middle of receipt', () => { await test.step('Assert canceled and received qty on stock movement show page', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Receiving'); await stockMovementShowPage.packingListTab.click(); + await stockMovementShowPage.packingListTable.isLoaded(); await expect( stockMovementShowPage.packingListTable.row(2).quantityShipped ).toHaveText('10'); diff --git a/src/tests/receiving/editBinLocationWhenReceive.test.ts b/src/tests/receiving/editBinLocationWhenReceive.test.ts index 552a78b..9d4bc57 100644 --- a/src/tests/receiving/editBinLocationWhenReceive.test.ts +++ b/src/tests/receiving/editBinLocationWhenReceive.test.ts @@ -384,6 +384,7 @@ test.describe('Edit Bin Location to bin with zone when receive inbound stock mov }); await test.step('Assert edited bin on Packing list', async () => { + await stockMovementShowPage.packingListTable.isLoaded(); await expect( stockMovementShowPage.packingListTable.row(1).binLocation ).toHaveText(binLocationName); @@ -567,6 +568,7 @@ test.describe('Edit Bin Location when receive for all lines', () => { }); await test.step('Assert edited bin on Packing list', async () => { + await stockMovementShowPage.packingListTable.isLoaded(); await expect( stockMovementShowPage.packingListTable.row(1).binLocation ).toHaveText(binLocationName); diff --git a/src/tests/receiving/editOriginalLineQtyTo0.test.ts b/src/tests/receiving/editOriginalLineQtyTo0.test.ts index ee60c4c..b9038aa 100644 --- a/src/tests/receiving/editOriginalLineQtyTo0.test.ts +++ b/src/tests/receiving/editOriginalLineQtyTo0.test.ts @@ -381,6 +381,7 @@ test.describe('Edit original line to other product in the middle of receipt', () stockMovementShowPage.packingListTable.row(1).product ).toHaveText(PRODUCT_FOUR.name); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await expect( stockMovementShowPage.receiptListTable.row(1).product ).toHaveText(PRODUCT_FIVE.name); diff --git a/src/tests/receiving/receiveInboundWithoutPickAndPutawayStock.test.ts b/src/tests/receiving/receiveInboundWithoutPickAndPutawayStock.test.ts index da8106a..448d424 100644 --- a/src/tests/receiving/receiveInboundWithoutPickAndPutawayStock.test.ts +++ b/src/tests/receiving/receiveInboundWithoutPickAndPutawayStock.test.ts @@ -148,6 +148,7 @@ test.describe('Receive inbound stock movement in location without pick and putaw }); await test.step('Assert Default bin on Packing list', async () => { + await stockMovementShowPage.packingListTable.isLoaded(); await expect( stockMovementShowPage.packingListTable.row(1).binLocation ).toHaveText('Default'); diff --git a/src/tests/receiving/receiveToHoldBin.test.ts b/src/tests/receiving/receiveToHoldBin.test.ts index 35cf2d3..bbff5d4 100644 --- a/src/tests/receiving/receiveToHoldBin.test.ts +++ b/src/tests/receiving/receiveToHoldBin.test.ts @@ -131,6 +131,7 @@ test.describe('Receive item into hold bin', () => { }); await test.step('Assert edited bin on Packing list', async () => { + await stockMovementShowPage.packingListTable.isLoaded(); await expect( stockMovementShowPage.packingListTable.row(1).binLocation ).toHaveText(holdBinLocationName); diff --git a/src/tests/receiving/receivingStatusChanges.test.ts b/src/tests/receiving/receivingStatusChanges.test.ts index fe673df..9efc174 100644 --- a/src/tests/receiving/receivingStatusChanges.test.ts +++ b/src/tests/receiving/receivingStatusChanges.test.ts @@ -89,6 +89,7 @@ test.describe('Status changes on sm view page when receive shipment', () => { await test.step('Assert empty receipt tab', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect(stockMovementShowPage.emptyReceiptTab).toBeVisible(); }); @@ -117,6 +118,7 @@ test.describe('Status changes on sm view page when receive shipment', () => { await newStockMovementShowPage.isLoaded(); await expect(newStockMovementShowPage.statusTag).toHaveText('Shipped'); await newStockMovementShowPage.receiptTab.click(); + await newStockMovementShowPage.receiptListTable.isLoaded(); await newStockMovementShowPage.receiptTab.isVisible(); await expect( newStockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -139,6 +141,7 @@ test.describe('Status changes on sm view page when receive shipment', () => { await test.step('Assert statuses on stock movmenent show page after receiving item partially', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Receiving'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -168,6 +171,7 @@ test.describe('Status changes on sm view page when receive shipment', () => { await test.step('Assert empty receipt tab', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect(stockMovementShowPage.emptyReceiptTab).toBeVisible(); }); @@ -196,6 +200,7 @@ test.describe('Status changes on sm view page when receive shipment', () => { await newStockMovementShowPage.isLoaded(); await expect(newStockMovementShowPage.statusTag).toHaveText('Shipped'); await newStockMovementShowPage.receiptTab.click(); + await newStockMovementShowPage.receiptListTable.isLoaded(); await newStockMovementShowPage.receiptTab.isVisible(); await expect( newStockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -218,6 +223,7 @@ test.describe('Status changes on sm view page when receive shipment', () => { await test.step('Assert statuses on stock movmenent show page after receiving fully 1 of items', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Receiving'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -247,6 +253,7 @@ test.describe('Status changes on sm view page when receive shipment', () => { await test.step('Assert empty receipt tab', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect(stockMovementShowPage.emptyReceiptTab).toBeVisible(); }); @@ -278,6 +285,7 @@ test.describe('Status changes on sm view page when receive shipment', () => { await newStockMovementShowPage.isLoaded(); await expect(newStockMovementShowPage.statusTag).toHaveText('Shipped'); await newStockMovementShowPage.receiptTab.click(); + await newStockMovementShowPage.receiptListTable.isLoaded(); await newStockMovementShowPage.receiptTab.isVisible(); await expect( newStockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -309,6 +317,7 @@ test.describe('Status changes on sm view page when receive shipment', () => { await test.step('Assert statuses on stock movmenent show page after receiving items', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Receiving'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -352,6 +361,7 @@ test.describe('Status changes on sm view page when receive shipment', () => { await test.step('Assert statuses on stock movmenent show page after receiving items', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Received'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(3).receiptStatus diff --git a/src/tests/receiving/receivingStatusChangesWithoutPartialReceiving.test.ts b/src/tests/receiving/receivingStatusChangesWithoutPartialReceiving.test.ts index 8959789..b7d0275 100644 --- a/src/tests/receiving/receivingStatusChangesWithoutPartialReceiving.test.ts +++ b/src/tests/receiving/receivingStatusChangesWithoutPartialReceiving.test.ts @@ -82,6 +82,7 @@ test.describe('Status changes on sm view page when receive shipment in location await test.step('Assert empty receipt tab', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect(stockMovementShowPage.emptyReceiptTab).toBeVisible(); }); @@ -115,6 +116,7 @@ test.describe('Status changes on sm view page when receive shipment in location await test.step('Assert Qty and statuses on receipt tab after receiving item partially and cancel not received qty', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -160,6 +162,7 @@ test.describe('Status changes on sm view page when receive shipment in location await test.step('Assert empty receipt tab', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect(stockMovementShowPage.emptyReceiptTab).toBeVisible(); }); @@ -193,6 +196,7 @@ test.describe('Status changes on sm view page when receive shipment in location await test.step('Assert Qty and statuses on receipt tab after receiving item partially and cancel not received qty', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -238,6 +242,7 @@ test.describe('Status changes on sm view page when receive shipment in location await test.step('Assert empty receipt tab', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect(stockMovementShowPage.emptyReceiptTab).toBeVisible(); }); @@ -270,6 +275,7 @@ test.describe('Status changes on sm view page when receive shipment in location await test.step('Assert Qty and statuses on receipt tab after receiving items and cancel not received qty', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -315,6 +321,7 @@ test.describe('Status changes on sm view page when receive shipment in location await test.step('Assert empty receipt tab', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect(stockMovementShowPage.emptyReceiptTab).toBeVisible(); }); @@ -347,6 +354,7 @@ test.describe('Status changes on sm view page when receive shipment in location await test.step('Assert Qty and statuses on receipt tab after receiving items and cancel not received qty', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -385,6 +393,7 @@ test.describe('Status changes on sm view page when receive shipment in location await test.step('Assert empty receipt tab after rollback receipt', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect(stockMovementShowPage.emptyReceiptTab).toBeVisible(); }); diff --git a/src/tests/receiving/rollbackStatusChanges.test.ts b/src/tests/receiving/rollbackStatusChanges.test.ts index 4215f7a..19b359e 100644 --- a/src/tests/receiving/rollbackStatusChanges.test.ts +++ b/src/tests/receiving/rollbackStatusChanges.test.ts @@ -106,6 +106,7 @@ test.describe('Status changes on sm view page when rollback receipts', () => { await test.step('Assert statuses on stock movmenent show page after receiving item partially', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Receiving'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -128,6 +129,7 @@ test.describe('Status changes on sm view page when rollback receipts', () => { await test.step('Assert empty receipt tab after rollback last receipt', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect(stockMovementShowPage.emptyReceiptTab).toBeVisible(); }); @@ -165,6 +167,7 @@ test.describe('Status changes on sm view page when rollback receipts', () => { await test.step('Assert statuses on stock movmenent show page after receiving fully 1 of items', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Receiving'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -187,6 +190,7 @@ test.describe('Status changes on sm view page when rollback receipts', () => { await test.step('Assert empty receipt tab after rollback last receipt', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect(stockMovementShowPage.emptyReceiptTab).toBeVisible(); }); @@ -246,6 +250,7 @@ test.describe('Status changes on sm view page when rollback receipts', () => { await test.step('Assert statuses on stock movmenent show page after receiving items', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Received'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(3).receiptStatus @@ -266,6 +271,7 @@ test.describe('Status changes on sm view page when rollback receipts', () => { await test.step('Assert statuses on stock movmenent show page after receiving items', async () => { await expect(stockMovementShowPage.statusTag).toHaveText('Receiving'); await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect( stockMovementShowPage.receiptListTable.row(1).receiptStatus @@ -298,6 +304,7 @@ test.describe('Status changes on sm view page when rollback receipts', () => { await test.step('Assert empty receipt tab after rollback both receipts', async () => { await stockMovementShowPage.receiptTab.click(); + await stockMovementShowPage.receiptListTable.isLoaded(); await stockMovementShowPage.receiptTab.isVisible(); await expect(stockMovementShowPage.emptyReceiptTab).toBeVisible(); }); diff --git a/src/tests/receiving/sortByAlphabeticalOrderAndRemainInputs.test.ts b/src/tests/receiving/sortByAlphabeticalOrderAndRemainInputs.test.ts index aa3bf3e..5b2b2db 100644 --- a/src/tests/receiving/sortByAlphabeticalOrderAndRemainInputs.test.ts +++ b/src/tests/receiving/sortByAlphabeticalOrderAndRemainInputs.test.ts @@ -105,9 +105,11 @@ test.describe('Apply sorting by alphabetical order and remain inputs', () => { await createInboundPage.nextButton.click(); await createInboundPage.sendStep.isLoaded(); await expect(createInboundPage.sendStep.sendShipmentButton).toBeVisible(); - await createInboundPage.sendStep.sendShipmentButton.focus(); - await createInboundPage.sendStep.sendShipmentButton.click(); - await stockMovementShowPage.waitForUrl(); + await expect(createInboundPage.sendStep.sendShipmentButton).toBeEnabled(); + await Promise.all([ + stockMovementShowPage.waitForUrl(), + createInboundPage.sendStep.sendShipmentButton.click(), + ]); await stockMovementShowPage.isLoaded(); }); diff --git a/src/tests/receiving/validationsOnEditAndReceive.test.ts b/src/tests/receiving/validationsOnEditAndReceive.test.ts index 8c6c6ab..3192ee5 100644 --- a/src/tests/receiving/validationsOnEditAndReceive.test.ts +++ b/src/tests/receiving/validationsOnEditAndReceive.test.ts @@ -222,7 +222,6 @@ test.describe('Validations on edit and receive inbound stock movement', () => { test('Assert unable to receive already received inbounds', async ({ stockMovementShowPage, receivingPage, - page, }) => { await test.step('Go to stock movement show page', async () => { await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); @@ -253,8 +252,6 @@ test.describe('Validations on edit and receive inbound stock movement', () => { await test.step('Validation on receive already received inbound', async () => { await stockMovementShowPage.isLoaded(); - // eslint-disable-next-line playwright/no-networkidle - await page.waitForLoadState('networkidle'); await stockMovementShowPage.receiveButton.click(); await expect(stockMovementShowPage.errorMessage).toBeVisible({ timeout: 10000,