Skip to content

Commit 0eaf31a

Browse files
committed
OBPIH-6969 Refactor product service usage in inbound tests
1 parent f8e2d2e commit 0eaf31a

11 files changed

Lines changed: 63 additions & 46 deletions

src/setup/dataImport/inventory.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
Product code,Product,Lot number,Expiration date,Bin location,Quantity,Comment
22
1,E2E-product-one,,,,122,
33
2,E2E-product-two,,,,123,
4+
3,E2E-product-three,,,,100,
5+
4,E2E-product-four,,,,100,

src/setup/dataImport/products.csv

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Id,ProductCode,ProductType,Name,ProductFamily,Category,GLAccount,Description,UnitOfMeasure,Tags,UnitCost,LotAndExpiryControl,ColdChain,ControlledSubstance,HazardousMaterial,Reconditioned,Manufacturer,BrandName,ManufacturerCode,ManufacturerName,Vendor,VendorCode,VendorName,UPC,NDC,Created,Updated
2-
,1,Default,E2E-product-one,,ARVS,,,,,,,,,,,,,,,,,,,,,
3-
,2,Default,E2E-product-two,,ARVS,,,,,,,,,,,,,,,,,,,,,
4-
,3,Default,E2E-product-three,,ARVS,,,,,,,,,,,,,,,,,,,,,
5-
,4,Default,E2E-product-four,,ARVS,,,,,,,,,,,,,,,,,,,,,
6-
,5,Default,E2E-product-five,,ARVS,,,,,,,,,,,,,,,,,,,,,
1+
Id,Active,ProductCode,ProductType,Name,ProductFamily,Category,GLAccount,Description,UnitOfMeasure,Tags,UnitCost,LotAndExpiryControl,ColdChain,ControlledSubstance,HazardousMaterial,Reconditioned,Manufacturer,BrandName,ManufacturerCode,ManufacturerName,Vendor,VendorCode,VendorName,UPC,NDC,Created,Updated
2+
,true,1,Default,E2E-product-one,,ARVS,,,,,,,,,,,,,,,,,,,,,
3+
,true,2,Default,E2E-product-two,,ARVS,,,,,,,,,,,,,,,,,,,,,
4+
,true,3,Default,E2E-product-three,,ARVS,,,,,,,,,,,,,,,,,,,,,
5+
,true,4,Default,E2E-product-four,,ARVS,,,,,,,,,,,,,,,,,,,,,
6+
,true,5,Default,E2E-product-five,,ARVS,,,,,,,,,,,,,,,,,,,,,

src/tests/putaway/assertAttemptToEditCompletedPutaway.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ test.describe('Assert attempt to edit completed putaway', () => {
1111
async ({
1212
supplierLocationService,
1313
stockMovementService,
14-
fifthProductService,
14+
productService,
1515
receivingService,
1616
}) => {
1717
const supplierLocation = await supplierLocationService.getLocation();
1818
STOCK_MOVEMENT = await stockMovementService.createInbound({
1919
originId: supplierLocation.id,
2020
});
2121

22-
const product = await fifthProductService.getProduct();
22+
productService.setProduct('5');
23+
const product = await productService.getProduct();
2324

2425
await stockMovementService.addItemsToInboundStockMovement(
2526
STOCK_MOVEMENT.id,

src/tests/putaway/assertPutawayDetailsPage.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ test.describe('Assert putaway details page', () => {
1111
async ({
1212
supplierLocationService,
1313
stockMovementService,
14-
fifthProductService,
14+
productService,
1515
receivingService,
1616
}) => {
1717
const supplierLocation = await supplierLocationService.getLocation();
1818
STOCK_MOVEMENT = await stockMovementService.createInbound({
1919
originId: supplierLocation.id,
2020
});
2121

22-
const product = await fifthProductService.getProduct();
22+
productService.setProduct('5');
23+
const product = await productService.getProduct();
2324

2425
await stockMovementService.addItemsToInboundStockMovement(
2526
STOCK_MOVEMENT.id,

src/tests/putaway/changeLocationOnCreatePutawayPage.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ test.describe('Change location on putaway create page and list pages', () => {
1111
async ({
1212
supplierLocationService,
1313
stockMovementService,
14-
fifthProductService,
14+
productService,
1515
receivingService,
1616
}) => {
1717
const supplierLocation = await supplierLocationService.getLocation();
1818
STOCK_MOVEMENT = await stockMovementService.createInbound({
1919
originId: supplierLocation.id,
2020
});
2121

22-
const product = await fifthProductService.getProduct();
22+
productService.setProduct('5');
23+
const product = await productService.getProduct();
2324

2425
await stockMovementService.addItemsToInboundStockMovement(
2526
STOCK_MOVEMENT.id,
@@ -77,15 +78,16 @@ test.describe('Change location on putaway create page and list pages', () => {
7778
navbar,
7879
createPutawayPage,
7980
locationChooser,
80-
fifthProductService,
81+
productService,
8182
depotLocationService,
8283
mainLocationService,
8384
putawayListPage,
8485
authService,
8586
}) => {
8687
const receivingBin =
8788
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
88-
const product = await fifthProductService.getProduct();
89+
productService.setProduct('5');
90+
const product = await productService.getProduct();
8991
const mainLocation = await mainLocationService.getLocation();
9092
const depotLocation = await depotLocationService.getLocation();
9193

src/tests/putaway/createPutaway.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ test.describe('Putaway received inbound shipment', () => {
1111
async ({
1212
supplierLocationService,
1313
stockMovementService,
14-
fifthProductService,
14+
productService,
1515
receivingService,
1616
}) => {
1717
const supplierLocation = await supplierLocationService.getLocation();
1818
STOCK_MOVEMENT = await stockMovementService.createInbound({
1919
originId: supplierLocation.id,
2020
});
2121

22-
const product = await fifthProductService.getProduct();
22+
productService.setProduct('5');
23+
const product = await productService.getProduct();
2324

2425
await stockMovementService.addItemsToInboundStockMovement(
2526
STOCK_MOVEMENT.id,
@@ -84,7 +85,7 @@ test.describe('Putaway received inbound shipment', () => {
8485
internalLocationService,
8586
productShowPage,
8687
putawayDetailsPage,
87-
fifthProductService,
88+
productService,
8889
}) => {
8990
await test.step('Go to stock movement show page and assert received status', async () => {
9091
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
@@ -128,7 +129,8 @@ test.describe('Putaway received inbound shipment', () => {
128129

129130
await test.step('Assert putaway bin on stock card', async () => {
130131
await putawayDetailsPage.summaryTab.click();
131-
const product = await fifthProductService.getProduct();
132+
productService.setProduct('5');
133+
const product = await productService.getProduct();
132134
await productShowPage.goToPage(product.id)
133135
await productShowPage.inStockTab.click();
134136
await productShowPage.inStockTabSection.isLoaded();

src/tests/putaway/putawayMoreThan1Item.test.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ test.describe('Create putaway for more than 1 item, separate putaways', () => {
1111
async ({
1212
supplierLocationService,
1313
stockMovementService,
14-
fifthProductService,
15-
fourthProductService,
14+
productService,
1615
receivingService,
1716
}) => {
1817
const supplierLocation = await supplierLocationService.getLocation();
1918
STOCK_MOVEMENT = await stockMovementService.createInbound({
2019
originId: supplierLocation.id,
2120
});
2221

23-
const product = await fifthProductService.getProduct();
24-
const product2 = await fourthProductService.getProduct();
22+
productService.setProduct('5');
23+
const product = await productService.getProduct();
24+
productService.setProduct('4');
25+
const product2 = await productService.getProduct();
2526

2627
await stockMovementService.addItemsToInboundStockMovement(
2728
STOCK_MOVEMENT.id,
@@ -90,14 +91,15 @@ test.describe('Create putaway for more than 1 item, separate putaways', () => {
9091
internalLocationService,
9192
productShowPage,
9293
putawayDetailsPage,
93-
fifthProductService,
94-
fourthProductService,
94+
productService,
9595
putawayListPage,
9696
}) => {
9797
const receivingBin =
9898
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
99-
const product = await fifthProductService.getProduct();
100-
const product2 = await fourthProductService.getProduct();
99+
productService.setProduct('5');
100+
const product = await productService.getProduct();
101+
productService.setProduct('4');
102+
const product2 = await productService.getProduct();
101103
const internalLocation = await internalLocationService.getLocation();
102104

103105
await test.step('Go to create putaway page', async () => {
@@ -243,17 +245,18 @@ test.describe('Putaway 2 items in the same putaway', () => {
243245
async ({
244246
supplierLocationService,
245247
stockMovementService,
246-
fifthProductService,
247-
fourthProductService,
248+
productService,
248249
receivingService,
249250
}) => {
250251
const supplierLocation = await supplierLocationService.getLocation();
251252
STOCK_MOVEMENT = await stockMovementService.createInbound({
252253
originId: supplierLocation.id,
253254
});
254255

255-
const product = await fifthProductService.getProduct();
256-
const product2 = await fourthProductService.getProduct();
256+
productService.setProduct('5');
257+
const product = await productService.getProduct();
258+
productService.setProduct('4');
259+
const product2 = await productService.getProduct();
257260

258261
await stockMovementService.addItemsToInboundStockMovement(
259262
STOCK_MOVEMENT.id,
@@ -321,13 +324,14 @@ test.describe('Putaway 2 items in the same putaway', () => {
321324
internalLocationService,
322325
productShowPage,
323326
putawayDetailsPage,
324-
fifthProductService,
325-
fourthProductService,
327+
productService,
326328
}) => {
327329
const receivingBin =
328330
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
329-
const product = await fifthProductService.getProduct();
330-
const product2 = await fourthProductService.getProduct();
331+
productService.setProduct('5');
332+
const product = await productService.getProduct();
333+
productService.setProduct('4');
334+
const product2 = await productService.getProduct();
331335
const internalLocation = await internalLocationService.getLocation();
332336

333337
await test.step('Go to create putaway page', async () => {

src/tests/putaway/rollbackLastReceiptWhenPutawayCreated.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ test.describe('Rollback last receipt behavior when putaway created', () => {
1111
async ({
1212
supplierLocationService,
1313
stockMovementService,
14-
fifthProductService,
14+
productService,
1515
receivingService,
1616
}) => {
1717
const supplierLocation = await supplierLocationService.getLocation();
1818
STOCK_MOVEMENT = await stockMovementService.createInbound({
1919
originId: supplierLocation.id,
2020
});
2121

22-
const product = await fifthProductService.getProduct();
22+
productService.setProduct('5');
23+
const product = await productService.getProduct();
2324

2425
await stockMovementService.addItemsToInboundStockMovement(
2526
STOCK_MOVEMENT.id,

src/tests/putaway/splitLineInPutaway.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ test.describe('Split line in Putaway', () => {
1111
async ({
1212
supplierLocationService,
1313
stockMovementService,
14-
fifthProductService,
14+
productService,
1515
receivingService,
1616
}) => {
1717
const supplierLocation = await supplierLocationService.getLocation();
1818
STOCK_MOVEMENT = await stockMovementService.createInbound({
1919
originId: supplierLocation.id,
2020
});
2121

22-
const product = await fifthProductService.getProduct();
22+
productService.setProduct('5');
23+
const product = await productService.getProduct();
2324

2425
await stockMovementService.addItemsToInboundStockMovement(
2526
STOCK_MOVEMENT.id,
@@ -88,7 +89,7 @@ test.describe('Split line in Putaway', () => {
8889
internalLocation2Service,
8990
putawayDetailsPage,
9091
productShowPage,
91-
fifthProductService,
92+
productService,
9293
}) => {
9394
const internalLocation = await internalLocationService.getLocation();
9495
const internalLocation2 = await internalLocation2Service.getLocation();
@@ -176,7 +177,8 @@ test.describe('Split line in Putaway', () => {
176177

177178
await test.step('Assert putaway bin on stock card', async () => {
178179
await putawayDetailsPage.summaryTab.click();
179-
const product = await fifthProductService.getProduct();
180+
productService.setProduct('5');
181+
const product = await productService.getProduct();
180182
await productShowPage.goToPage(product.id);
181183
await productShowPage.inStockTab.click();
182184
await productShowPage.inStockTabSection.isLoaded();

src/tests/receiving/receiveInbound.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,7 @@ test.describe('Receive from different locations', () => {
392392
async ({
393393
supplierLocationService,
394394
stockMovementService,
395-
mainProductService,
396-
otherProductService,
395+
productService,
397396
}) => {
398397
const supplierLocation = await supplierLocationService.getLocation();
399398
STOCK_MOVEMENT = await stockMovementService.createInbound({
@@ -402,8 +401,10 @@ test.describe('Receive from different locations', () => {
402401
dateRequested,
403402
});
404403

405-
const product = await mainProductService.getProduct();
406-
const product2 = await otherProductService.getProduct();
404+
productService.setProduct('1');
405+
const product = await productService.getProduct();
406+
productService.setProduct('2');
407+
const product2 = await productService.getProduct();
407408

408409
await stockMovementService.addItemsToInboundStockMovement(
409410
STOCK_MOVEMENT.id,

0 commit comments

Comments
 (0)