diff --git a/.env.example b/.env.example index 751c895..011c046 100644 --- a/.env.example +++ b/.env.example @@ -11,6 +11,7 @@ LOCATION_NO_MANAGE_INVENOTRY_DEPOT=locationId LOCATION_SUPPLIER=locationId LOCATION_SUPPLIER_ALT=locationId LOCATION_DEPOT=locationId +LOCATION_NO_PICK_AND_PUTAWAY_STOCK_DEPOT=locationId LOCATION_WARD=locationId PRODUCT_ONE=productId PRODUCT_TWO=productId \ No newline at end of file diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 61e653a..ae5ee60 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -61,6 +61,7 @@ jobs: LOCATION_SUPPLIER_ALT: ${{ secrets.LOCATION_SUPPLIER_ALT }} LOCATION_DEPOT: ${{ secrets.LOCATION_DEPOT }} LOCATION_WARD: ${{ secrets.LOCATION_WARD }} + LOCATION_NO_PICK_AND_PUTAWAY_STOCK_DEPOT: ${{ secrets.LOCATION_NO_PICK_AND_PUTAWAY_STOCK_DEPOT }} PRODUCT_ONE: ${{ secrets.PRODUCT_ONE }} PRODUCT_TWO: ${{ secrets.PRODUCT_TWO }} run: | diff --git a/src/config/AppConfig.ts b/src/config/AppConfig.ts index 7bd30ae..c6da29d 100644 --- a/src/config/AppConfig.ts +++ b/src/config/AppConfig.ts @@ -23,6 +23,7 @@ export enum LOCATION_KEY { NO_MANAGER_INENTORY = 'noManageInventoryDepot', DEPOT = 'depot', WARD = 'ward', + NO_PICK_AND_PUTAWAY_STOCK = 'noPickAndPutawayStockDepot', } export enum PRODUCT_KEY { @@ -219,6 +220,29 @@ class AppConfig { required: false, type: LocationTypeCode.WARD, }), + + noPickAndPutawayStockDepot: new LocationConfig({ + id: env.get('LOCATION_NO_PICK_AND_PUTAWAY_STOCK_DEPOT').asString(), + key: LOCATION_KEY.NO_PICK_AND_PUTAWAY_STOCK, + name: this.uniqueIdentifier.generateUniqueString('no-pickandputawaystock-depot'), + requiredActivityCodes: new Set([ + ActivityCode.MANAGE_INVENTORY, + ActivityCode.DYNAMIC_CREATION, + ActivityCode.AUTOSAVE, + ActivityCode.SUBMIT_REQUEST, + ActivityCode.SEND_STOCK, + ActivityCode.PLACE_REQUEST, + ActivityCode.FULFILL_REQUEST, + ActivityCode.EXTERNAL, + ActivityCode.RECEIVE_STOCK, + ActivityCode.PARTIAL_RECEIVING, + ]), + required: false, + type: LocationTypeCode.DEPOT, + }), + + + }; this.products = { diff --git a/src/fixtures/fixtures.ts b/src/fixtures/fixtures.ts index 348724e..d679261 100644 --- a/src/fixtures/fixtures.ts +++ b/src/fixtures/fixtures.ts @@ -74,6 +74,7 @@ type Fixtures = { supplierAltLocationService: LocationData; depotLocationService: LocationData; wardLocationService: LocationData; + noPickAndPutawayStockDepotService: LocationData; // PRODUCT DATA mainProductService: ProductData; otherProductService: ProductData; @@ -142,6 +143,8 @@ export const test = baseTest.extend({ use(new LocationData(LOCATION_KEY.DEPOT, page.request)), wardLocationService: async ({ page }, use) => use(new LocationData(LOCATION_KEY.WARD, page.request)), + noPickAndPutawayStockDepotService: async ({ page }, use) => + use(new LocationData(LOCATION_KEY.NO_PICK_AND_PUTAWAY_STOCK, page.request)), // PRODUCTS mainProductService: async ({ page }, use) => use(new ProductData(PRODUCT_KEY.ONE, page.request)), diff --git a/src/tests/receiving/receiveInboundWithoutPickAndPutawayStock.test.ts b/src/tests/receiving/receiveInboundWithoutPickAndPutawayStock.test.ts new file mode 100644 index 0000000..3f9abb1 --- /dev/null +++ b/src/tests/receiving/receiveInboundWithoutPickAndPutawayStock.test.ts @@ -0,0 +1,144 @@ +import AppConfig from '@/config/AppConfig'; +import { ShipmentType } from '@/constants/ShipmentType'; +import { expect, test } from '@/fixtures/fixtures'; +import { StockMovementResponse } from '@/types'; +import { getToday } from '@/utils/DateUtils'; + +test.describe('Receive inbound stock movement in location without pick and putaway stock', () => { + let STOCK_MOVEMENT: StockMovementResponse; + const description = 'some description'; + const dateRequested = getToday(); + + test.beforeEach( + async ({ + supplierLocationService, + stockMovementService, + mainProductService, + noPickAndPutawayStockDepotService, + }) => { + const supplierLocation = await supplierLocationService.getLocation(); + const noPickAndPutawayStockDepot= await noPickAndPutawayStockDepotService.getLocation(); + const PRODUCT_ONE = await mainProductService.getProduct(); + + STOCK_MOVEMENT = await stockMovementService.createInbound({ + originId: supplierLocation.id, + destinationId: noPickAndPutawayStockDepot.id, + description, + dateRequested, + }); + + await stockMovementService.addItemsToInboundStockMovement( + STOCK_MOVEMENT.id, + [ + { productId: PRODUCT_ONE.id, quantity: 200 }, + ] + ); + + await stockMovementService.sendInboundStockMovement(STOCK_MOVEMENT.id, { + shipmentType: ShipmentType.AIR, + }); + } + ); + + test.afterEach( + async ({ stockMovementShowPage, authService }) => { + await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); + await stockMovementShowPage.rollbackLastReceiptButton.click(); + await stockMovementShowPage.rollbackButton.click(); + await stockMovementShowPage.clickDeleteShipment(); + + await authService.changeLocation(AppConfig.instance.locations.main.id); + } + ); + + test('Receive sm in location without pick and putaway stock', async ({ + stockMovementShowPage, + receivingPage, + authService, + }) => { + await test.step('Go to stock movement show page', async () => { + await authService.changeLocation(AppConfig.instance.locations.noPickAndPutawayStockDepot.id); + await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); + await stockMovementShowPage.isLoaded(); + }); + + await test.step('Go to shipment receiving page', async () => { + await stockMovementShowPage.receiveButton.click(); + await receivingPage.receivingStep.isLoaded(); + }); + + await test.step('Assert table column headers on receiving page', async () => { + await receivingPage.assertColumnHeaderTooltipOnReceivingStep( + 'Pack level 1' + ); + await receivingPage.assertColumnHeaderTooltipOnReceivingStep( + 'Pack level 2' + ); + await receivingPage.assertColumnHeaderTooltipOnReceivingStep('Code'); + await receivingPage.assertColumnHeaderTooltipOnReceivingStep('Product'); + await receivingPage.assertColumnHeaderTooltipOnReceivingStep( + 'Lot/Serial No.' + ); + await receivingPage.assertColumnHeaderTooltipOnReceivingStep( + 'Expiration date' + ); + await receivingPage.assertColumnHeaderTooltipOnReceivingStep('Recipient'); + await receivingPage.assertColumnHeaderTooltipOnReceivingStep('Shipped'); + await receivingPage.assertColumnHeaderTooltipOnReceivingStep('Received'); + await receivingPage.assertColumnHeaderTooltipOnReceivingStep('To receive'); + await receivingPage.assertColumnHeaderTooltipOnReceivingStep( + 'Receiving now' + ); + await receivingPage.assertColumnHeaderTooltipOnReceivingStep('Comment'); + }); + + + await test.step('Autofill receiving qty', async () => { + await receivingPage.receivingStep.isLoaded(); + await receivingPage.receivingStep.autofillQuantitiesButton.click(); + }); + + + await test.step('Go to and assert checking page is visible ', async () => { + await receivingPage.nextButton.click(); + await receivingPage.checkStep.isLoaded(); + }); + + await test.step('Assert table column headers on checking page', async () => { + await receivingPage.assertColumnHeaderTooltipOnCheckingStep( + 'Pack level 1' + ); + await receivingPage.assertColumnHeaderTooltipOnCheckingStep( + 'Pack level 2' + ); + await receivingPage.assertColumnHeaderTooltipOnCheckingStep('Code'); + await receivingPage.assertColumnHeaderTooltipOnCheckingStep('Product'); + await receivingPage.assertColumnHeaderTooltipOnCheckingStep( + 'Lot/Serial No.' + ); + await receivingPage.assertColumnHeaderTooltipOnCheckingStep( + 'Expiration date' + ); + await receivingPage.assertColumnHeaderTooltipOnCheckingStep('Recipient'); + await receivingPage.assertColumnHeaderTooltipOnCheckingStep( + 'Receiving now' + ); + await receivingPage.assertColumnHeaderTooltipOnCheckingStep('Remaining'); + await receivingPage.assertColumnHeaderTooltipOnCheckingStep('Cancel remaining'); + await receivingPage.assertColumnHeaderTooltipOnCheckingStep('Comment'); + }); + + await test.step('Receive shipment', async () => { + await receivingPage.checkStep.isLoaded(); + await receivingPage.checkStep.receiveShipmentButton.click(); + await stockMovementShowPage.isLoaded(); + }); + + await test.step('Assert Default bin on Packing list', async () => { + await expect(stockMovementShowPage.packingListTable.row(1).binLocation).toHaveText('Default'); + }); + + }); + + +});