Skip to content

Commit 0af9292

Browse files
authored
OBPIH-7234 sort by alphabetical order and remain inputs (#56)
* add confirm reload dialog * add button to popup * rename 1 product * add elements to page * add test for ordering items on receiving page and keep inputs * add test default to 0 after removed qty and save, adjust other test to 2nd product * add comment to appConfig * update selector * add assert not clearable field * remove not needed lines from edit bin tests
1 parent ed3192d commit 0af9292

8 files changed

Lines changed: 260 additions & 18 deletions

File tree

src/components/AlertPopup.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class AlertPopup extends BasePageModel {
2424
return this.dialog.getByRole('button', { name: this.cancelLabel });
2525
}
2626

27+
get yesButton() {
28+
return this.dialog.getByRole('button', { name: 'Yes' });
29+
}
30+
2731
async assertPopupVisible() {
2832
await expect(this.dialog).toBeVisible();
2933
}

src/config/AppConfig.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ class AppConfig {
290290
productFive: new ProductConfig({
291291
id: env.get('PRODUCT_FIVE').asString(),
292292
key: PRODUCT_KEY.FIVE,
293-
name: this.uniqueIdentifier.generateUniqueString('product-five'),
293+
name: this.uniqueIdentifier.generateUniqueString('aa-product-five'),
294+
//'aa' part was added to improve visibility of ordering products alphabetically
294295
quantity: 160,
295296
required: false,
296297
}),

src/pages/inbound/create/steps/AddItemsStep.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Page } from '@playwright/test';
22

3+
import AlertPopup from '@/components/AlertPopup';
34
import FileHandler from '@/components/FileHandler';
45
import { expect, test } from '@/fixtures/fixtures';
56
import BasePageModel from '@/pages/BasePageModel';
@@ -9,11 +10,17 @@ import { CreateInboundAddItemsTableEntity } from '@/types';
910
class AddItemsStep extends BasePageModel {
1011
table: AddItemsTable;
1112
fileHandler: FileHandler;
13+
confirmReloadPopup: AlertPopup;
1214

1315
constructor(page: Page) {
1416
super(page);
1517
this.table = new AddItemsTable(page);
1618
this.fileHandler = new FileHandler(page);
19+
this.confirmReloadPopup = new AlertPopup(
20+
page,
21+
'Confirm refresh',
22+
'Are you sure you want to refresh? Your progress since last save will be lost.'
23+
);
1724
}
1825

1926
async isLoaded() {

src/pages/receiving/steps/ReceivingStep.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ class ReceivingStep extends BasePageModel {
8383
'You can only import the Receiving Now and the Comment fields. To make other changes, please use the edit line feature. You can then export and import the template again.'
8484
);
8585
}
86+
87+
get orderSelect() {
88+
return this.page.getByTestId('custom-select-ordering');
89+
}
90+
91+
getOrder(order: string) {
92+
return this.page
93+
.getByTestId('custom-select-dropdown-menu')
94+
.getByRole('listitem')
95+
.getByText(order, { exact: true });
96+
}
8697
}
8798

8899
export default ReceivingStep;

src/tests/receiving/editBinLocationWhenReceive.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ test.describe('Edit Bin Location when receive inbound stock movement', () => {
9898
);
9999
await createLocationPage.binLocationTabSection.isLoaded();
100100
await createLocationPage.binLocationTabSection.deleteBinButton.click();
101-
await createLocationPage.binLocationTabSection.isLoaded();
102101
});
103102
}
104103
);
@@ -279,7 +278,6 @@ test.describe('Edit Bin Location to bin with zone when receive inbound stock mov
279278
);
280279
await createLocationPage.binLocationTabSection.isLoaded();
281280
await createLocationPage.binLocationTabSection.deleteBinButton.click();
282-
await createLocationPage.binLocationTabSection.isLoaded();
283281
});
284282

285283
await test.step('Delete created zone location', async () => {
@@ -459,7 +457,6 @@ test.describe('Edit Bin Location when receive for all lines', () => {
459457
);
460458
await createLocationPage.binLocationTabSection.isLoaded();
461459
await createLocationPage.binLocationTabSection.deleteBinButton.click();
462-
await createLocationPage.binLocationTabSection.isLoaded();
463460
});
464461
}
465462
);

src/tests/receiving/receiveInbound.test.ts

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ test.describe('Receive inbound stock movement', () => {
1515
supplierLocationService,
1616
stockMovementService,
1717
mainProductService,
18+
otherProductService,
1819
}) => {
1920
const supplierLocation = await supplierLocationService.getLocation();
2021
STOCK_MOVEMENT = await stockMovementService.createInbound({
@@ -24,10 +25,14 @@ test.describe('Receive inbound stock movement', () => {
2425
});
2526

2627
const product = await mainProductService.getProduct();
28+
const product2 = await otherProductService.getProduct();
2729

2830
await stockMovementService.addItemsToInboundStockMovement(
2931
STOCK_MOVEMENT.id,
30-
[{ productId: product.id, quantity: 10 }]
32+
[
33+
{ productId: product.id, quantity: 10 },
34+
{ productId: product2.id, quantity: 10 },
35+
]
3136
);
3237

3338
await stockMovementService.sendInboundStockMovement(STOCK_MOVEMENT.id, {
@@ -117,9 +122,7 @@ test.describe('Receive inbound stock movement', () => {
117122

118123
await test.step('Select all items to receive', async () => {
119124
await receivingPage.receivingStep.isLoaded();
120-
await receivingPage.receivingStep.table
121-
.row(1)
122-
.receivingNowField.textbox.fill('10');
125+
await receivingPage.receivingStep.autofillQuantitiesButton.click();
123126
});
124127

125128
await test.step('Go to Check page', async () => {
@@ -257,6 +260,9 @@ test.describe('Receive inbound stock movement', () => {
257260
await receivingPage.receivingStep.table
258261
.row(1)
259262
.receivingNowField.textbox.fill('8');
263+
await receivingPage.receivingStep.table
264+
.row(2)
265+
.receivingNowField.textbox.fill('8');
260266
});
261267

262268
await test.step('Click on Save button', async () => {
@@ -271,6 +277,9 @@ test.describe('Receive inbound stock movement', () => {
271277
await expect(
272278
receivingPage.receivingStep.table.row(1).receivingNowField.textbox
273279
).toHaveValue('8');
280+
await expect(
281+
receivingPage.receivingStep.table.row(2).receivingNowField.textbox
282+
).toHaveValue('8');
274283
});
275284
});
276285

@@ -292,6 +301,9 @@ test.describe('Receive inbound stock movement', () => {
292301
await receivingPage.receivingStep.table
293302
.row(1)
294303
.receivingNowField.textbox.fill('2');
304+
await receivingPage.receivingStep.table
305+
.row(2)
306+
.receivingNowField.textbox.fill('2');
295307
});
296308

297309
await test.step('Click on Save and Exit button', async () => {
@@ -305,6 +317,46 @@ test.describe('Receive inbound stock movement', () => {
305317
await expect(
306318
receivingPage.receivingStep.table.row(1).receivingNowField.textbox
307319
).toHaveValue('2');
320+
await expect(
321+
receivingPage.receivingStep.table.row(2).receivingNowField.textbox
322+
).toHaveValue('2');
323+
});
324+
});
325+
326+
test.skip('Use Save button after removing qty and default to 0', async ({
327+
stockMovementShowPage,
328+
receivingPage,
329+
}) => {
330+
await test.step('Go to stock movement show page', async () => {
331+
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
332+
await stockMovementShowPage.isLoaded();
333+
});
334+
335+
await test.step('Go to shipment receiving page', async () => {
336+
await stockMovementShowPage.receiveButton.click();
337+
await receivingPage.receivingStep.isLoaded();
338+
});
339+
340+
await test.step('Input qty for an item to be received', async () => {
341+
await receivingPage.receivingStep.table
342+
.row(1)
343+
.receivingNowField.textbox.fill('8');
344+
await receivingPage.receivingStep.table
345+
.row(2)
346+
.receivingNowField.textbox.fill('10');
347+
});
348+
349+
await test.step('Clear qty field and click on Save button', async () => {
350+
await receivingPage.receivingStep.table
351+
.row(1)
352+
.receivingNowField.textbox.clear();
353+
await receivingPage.receivingStep.saveButton.click();
354+
await expect(
355+
receivingPage.receivingStep.table.row(1).receivingNowField.textbox
356+
).toHaveValue('0');
357+
await expect(
358+
receivingPage.receivingStep.table.row(2).receivingNowField.textbox
359+
).toHaveValue('10');
308360
});
309361
});
310362

src/tests/receiving/receiveToHoldBin.test.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import UniqueIdentifier from '@/utils/UniqueIdentifier';
55

66
test.describe('Receive item into hold bin', () => {
77
test.describe.configure({ timeout: 60000 });
8-
//timeout has been added for this test to make sure that the content on bin location tab will load as it can include a lot of data
8+
//timeout has been added for this test to make sure that the content on bin location tab will load as it can include a lot of data
99
let STOCK_MOVEMENT: StockMovementResponse;
1010
const uniqueIdentifier = new UniqueIdentifier();
1111
const binLocationName = uniqueIdentifier.generateUniqueString('holdbin');
@@ -30,9 +30,7 @@ test.describe('Receive item into hold bin', () => {
3030

3131
await stockMovementService.addItemsToInboundStockMovement(
3232
STOCK_MOVEMENT.id,
33-
[
34-
{ productId: PRODUCT_ONE.id, quantity: 20 },
35-
]
33+
[{ productId: PRODUCT_ONE.id, quantity: 20 }]
3634
);
3735

3836
await stockMovementService.sendInboundStockMovement(STOCK_MOVEMENT.id, {
@@ -67,10 +65,16 @@ test.describe('Receive item into hold bin', () => {
6765
await createLocationPage.binLocationTabSection.editBinButton.click();
6866
await createLocationPage.locationConfigurationTab.click();
6967
await createLocationPage.locationConfigurationTabSection.useDefaultSettingsCheckbox.uncheck();
70-
await createLocationPage.locationConfigurationTabSection.removeSupportedActivitiesButton('Putaway stock').click();
71-
await createLocationPage.locationConfigurationTabSection.removeSupportedActivitiesButton('Pick stock').click();
68+
await createLocationPage.locationConfigurationTabSection
69+
.removeSupportedActivitiesButton('Putaway stock')
70+
.click();
71+
await createLocationPage.locationConfigurationTabSection
72+
.removeSupportedActivitiesButton('Pick stock')
73+
.click();
7274
await createLocationPage.locationConfigurationTabSection.supportedActivitiesSelect.click();
73-
await createLocationPage.locationConfigurationTabSection.getSupportedActivitiesOption('Hold stock').click();
75+
await createLocationPage.locationConfigurationTabSection
76+
.getSupportedActivitiesOption('Hold stock')
77+
.click();
7478
await createLocationPage.locationConfigurationTabSection.saveButton.click();
7579
});
7680
}
@@ -111,7 +115,6 @@ test.describe('Receive item into hold bin', () => {
111115
);
112116
await createLocationPage.binLocationTabSection.isLoaded();
113117
await createLocationPage.binLocationTabSection.deleteBinButton.click();
114-
await createLocationPage.binLocationTabSection.isLoaded();
115118
});
116119
}
117120
);
@@ -167,8 +170,12 @@ test.describe('Receive item into hold bin', () => {
167170
await expect(
168171
productShowPage.inStockTabSection.row(2).binLocation
169172
).toHaveText(binLocationName);
170-
await expect(productShowPage.inStockTabSection.row(2).row).toHaveAttribute('title', 'This bin has been restricted');
171-
await expect(productShowPage.inStockTabSection.row(2).inventoryInformation).toHaveText('Hold');
173+
await expect(
174+
productShowPage.inStockTabSection.row(2).row
175+
).toHaveAttribute('title', 'This bin has been restricted');
176+
await expect(
177+
productShowPage.inStockTabSection.row(2).inventoryInformation
178+
).toHaveText('Hold');
172179
});
173180
});
174181
});

0 commit comments

Comments
 (0)