Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
24 changes: 24 additions & 0 deletions src/config/AppConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 = {
Expand Down
3 changes: 3 additions & 0 deletions src/fixtures/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type Fixtures = {
supplierAltLocationService: LocationData;
depotLocationService: LocationData;
wardLocationService: LocationData;
noPickAndPutawayStockDepotService: LocationData;
// PRODUCT DATA
mainProductService: ProductData;
otherProductService: ProductData;
Expand Down Expand Up @@ -142,6 +143,8 @@ export const test = baseTest.extend<Fixtures>({
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)),
Expand Down
144 changes: 144 additions & 0 deletions src/tests/receiving/receiveInboundWithoutPickAndPutawayStock.test.ts
Original file line number Diff line number Diff line change
@@ -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');
});

});


});
Loading