Skip to content

Commit 8504eec

Browse files
committed
add deactivation of receiving bin to receiving tests
1 parent f5ee729 commit 8504eec

20 files changed

Lines changed: 1130 additions & 309 deletions

src/tests/receiving/assertBinLocationField.test.ts

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,58 @@ test.describe('Assert bin location not clearable', () => {
3535
}
3636
);
3737

38-
test.afterEach(async ({ stockMovementShowPage, stockMovementService }) => {
39-
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
40-
const isRollbackLastReceiptButtonVisible =
41-
await stockMovementShowPage.rollbackLastReceiptButton.isVisible();
42-
const isRollbackButtonVisible =
43-
await stockMovementShowPage.rollbackButton.isVisible();
38+
test.afterEach(
39+
async ({
40+
stockMovementShowPage,
41+
stockMovementService,
42+
mainLocationService,
43+
page,
44+
locationListPage,
45+
createLocationPage,
46+
}) => {
47+
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
48+
const isRollbackLastReceiptButtonVisible =
49+
await stockMovementShowPage.rollbackLastReceiptButton.isVisible();
50+
const isRollbackButtonVisible =
51+
await stockMovementShowPage.rollbackButton.isVisible();
4452

45-
// due to failed test, shipment might not be received which will not show the button
46-
if (isRollbackLastReceiptButtonVisible) {
47-
await stockMovementShowPage.rollbackLastReceiptButton.click();
48-
}
53+
// due to failed test, shipment might not be received which will not show the button
54+
if (isRollbackLastReceiptButtonVisible) {
55+
await stockMovementShowPage.rollbackLastReceiptButton.click();
56+
}
4957

50-
if (isRollbackButtonVisible) {
51-
await stockMovementShowPage.rollbackButton.click();
52-
}
58+
if (isRollbackButtonVisible) {
59+
await stockMovementShowPage.rollbackButton.click();
60+
}
5361

54-
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
55-
});
62+
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
63+
64+
await test.step('Deactivate receiving bin', async () => {
65+
const mainLocation = await mainLocationService.getLocation();
66+
const receivingBin =
67+
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
68+
await page.goto('./location/list');
69+
await locationListPage.searchByLocationNameField.fill(
70+
mainLocation.name
71+
);
72+
await locationListPage.findButton.click();
73+
await locationListPage.getLocationEditButton(mainLocation.name).click();
74+
await createLocationPage.binLocationTab.click();
75+
await createLocationPage.binLocationTabSection.isLoaded();
76+
await createLocationPage.binLocationTabSection.searchField.fill(
77+
receivingBin
78+
);
79+
await createLocationPage.binLocationTabSection.searchField.press(
80+
'Enter'
81+
);
82+
await createLocationPage.binLocationTabSection.isLoaded();
83+
await createLocationPage.binLocationTabSection.editBinButton.click();
84+
await createLocationPage.locationConfigurationTab.click();
85+
await createLocationPage.locationConfigurationTabSection.activeCheckbox.uncheck();
86+
await createLocationPage.locationConfigurationTabSection.saveButton.click();
87+
});
88+
}
89+
);
5690

5791
test('Assert bin location not clearable', async ({
5892
stockMovementShowPage,
@@ -69,7 +103,7 @@ test.describe('Assert bin location not clearable', () => {
69103
});
70104

71105
await test.step('Assert bin location cant be cleared', async () => {
72-
await expect(
106+
await expect(
73107
receivingPage.receivingStep.table
74108
.row(1)
75109
.binLocationSelect.locator('.react-select__clear-indicator')
@@ -89,7 +123,7 @@ test.describe('Assert bin location not clearable', () => {
89123
await receivingPage.receivingStep.editModal.saveButton.click();
90124
});
91125

92-
await test.step('Assertbin location field content after split linw', async () => {
126+
await test.step('Assert bin location field content after split line', async () => {
93127
const receivingBin =
94128
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
95129
await expect(

src/tests/receiving/assertCreationOfGoodsReceiptNote.test.ts

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import AppConfig from '@/config/AppConfig';
12
import { ShipmentType } from '@/constants/ShipmentType';
23
import { expect, test } from '@/fixtures/fixtures';
34
import { StockMovementResponse } from '@/types';
@@ -34,12 +35,46 @@ test.describe('Assert Goods Receipt Note is created and opened', () => {
3435
}
3536
);
3637

37-
test.afterEach(async ({ stockMovementShowPage, stockMovementService }) => {
38-
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
39-
await stockMovementShowPage.rollbackLastReceiptButton.click();
40-
await stockMovementShowPage.rollbackButton.click();
41-
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
42-
});
38+
test.afterEach(
39+
async ({
40+
stockMovementShowPage,
41+
stockMovementService,
42+
mainLocationService,
43+
page,
44+
locationListPage,
45+
createLocationPage,
46+
}) => {
47+
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
48+
await stockMovementShowPage.rollbackLastReceiptButton.click();
49+
await stockMovementShowPage.rollbackButton.click();
50+
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
51+
52+
await test.step('Deactivate receiving bin', async () => {
53+
const mainLocation = await mainLocationService.getLocation();
54+
const receivingBin =
55+
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
56+
await page.goto('./location/list');
57+
await locationListPage.searchByLocationNameField.fill(
58+
mainLocation.name
59+
);
60+
await locationListPage.findButton.click();
61+
await locationListPage.getLocationEditButton(mainLocation.name).click();
62+
await createLocationPage.binLocationTab.click();
63+
await createLocationPage.binLocationTabSection.isLoaded();
64+
await createLocationPage.binLocationTabSection.searchField.fill(
65+
receivingBin
66+
);
67+
await createLocationPage.binLocationTabSection.searchField.press(
68+
'Enter'
69+
);
70+
await createLocationPage.binLocationTabSection.isLoaded();
71+
await createLocationPage.binLocationTabSection.editBinButton.click();
72+
await createLocationPage.locationConfigurationTab.click();
73+
await createLocationPage.locationConfigurationTabSection.activeCheckbox.uncheck();
74+
await createLocationPage.locationConfigurationTabSection.saveButton.click();
75+
});
76+
}
77+
);
4378

4479
test('Assert Goods Receipt note is created', async ({
4580
stockMovementShowPage,

src/tests/receiving/assertCreationOfReceivingBin.test.ts

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,45 @@ test.describe('Assert creation of receiving bin', () => {
4242
}
4343
);
4444

45-
test.afterEach(async ({ stockMovementShowPage, stockMovementService }) => {
46-
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
47-
await stockMovementShowPage.rollbackButton.click();
48-
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
49-
});
45+
test.afterEach(
46+
async ({
47+
stockMovementShowPage,
48+
stockMovementService,
49+
mainLocationService,
50+
page,
51+
locationListPage,
52+
createLocationPage,
53+
}) => {
54+
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
55+
await stockMovementShowPage.rollbackButton.click();
56+
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
57+
58+
await test.step('Deactivate receiving bin', async () => {
59+
const mainLocation = await mainLocationService.getLocation();
60+
const receivingBin =
61+
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
62+
await page.goto('./location/list');
63+
await locationListPage.searchByLocationNameField.fill(
64+
mainLocation.name
65+
);
66+
await locationListPage.findButton.click();
67+
await locationListPage.getLocationEditButton(mainLocation.name).click();
68+
await createLocationPage.binLocationTab.click();
69+
await createLocationPage.binLocationTabSection.isLoaded();
70+
await createLocationPage.binLocationTabSection.searchField.fill(
71+
receivingBin
72+
);
73+
await createLocationPage.binLocationTabSection.searchField.press(
74+
'Enter'
75+
);
76+
await createLocationPage.binLocationTabSection.isLoaded();
77+
await createLocationPage.binLocationTabSection.editBinButton.click();
78+
await createLocationPage.locationConfigurationTab.click();
79+
await createLocationPage.locationConfigurationTabSection.activeCheckbox.uncheck();
80+
await createLocationPage.locationConfigurationTabSection.saveButton.click();
81+
});
82+
}
83+
);
5084

5185
test('Assert receiving bin is not created when shipment is shipped', async ({
5286
stockMovementShowPage,

src/tests/receiving/assertQtyInputs.test.ts

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import AppConfig from '@/config/AppConfig';
12
import { ShipmentType } from '@/constants/ShipmentType';
23
import { expect, test } from '@/fixtures/fixtures';
34
import { StockMovementResponse } from '@/types';
@@ -41,24 +42,58 @@ test.describe('Assert if quantity inputs remain when split lines', () => {
4142
}
4243
);
4344

44-
test.afterEach(async ({ stockMovementShowPage, stockMovementService }) => {
45-
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
46-
const isRollbackLastReceiptButtonVisible =
47-
await stockMovementShowPage.rollbackLastReceiptButton.isVisible();
48-
const isRollbackButtonVisible =
49-
await stockMovementShowPage.rollbackButton.isVisible();
45+
test.afterEach(
46+
async ({
47+
stockMovementShowPage,
48+
stockMovementService,
49+
mainLocationService,
50+
page,
51+
locationListPage,
52+
createLocationPage,
53+
}) => {
54+
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
55+
const isRollbackLastReceiptButtonVisible =
56+
await stockMovementShowPage.rollbackLastReceiptButton.isVisible();
57+
const isRollbackButtonVisible =
58+
await stockMovementShowPage.rollbackButton.isVisible();
5059

51-
// due to failed test, shipment might not be received which will not show the button
52-
if (isRollbackLastReceiptButtonVisible) {
53-
await stockMovementShowPage.rollbackLastReceiptButton.click();
54-
}
60+
// due to failed test, shipment might not be received which will not show the button
61+
if (isRollbackLastReceiptButtonVisible) {
62+
await stockMovementShowPage.rollbackLastReceiptButton.click();
63+
}
5564

56-
if (isRollbackButtonVisible) {
57-
await stockMovementShowPage.rollbackButton.click();
58-
}
65+
if (isRollbackButtonVisible) {
66+
await stockMovementShowPage.rollbackButton.click();
67+
}
5968

60-
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
61-
});
69+
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
70+
71+
await test.step('Deactivate receiving bin', async () => {
72+
const mainLocation = await mainLocationService.getLocation();
73+
const receivingBin =
74+
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
75+
await page.goto('./location/list');
76+
await locationListPage.searchByLocationNameField.fill(
77+
mainLocation.name
78+
);
79+
await locationListPage.findButton.click();
80+
await locationListPage.getLocationEditButton(mainLocation.name).click();
81+
await createLocationPage.binLocationTab.click();
82+
await createLocationPage.binLocationTabSection.isLoaded();
83+
await createLocationPage.binLocationTabSection.searchField.fill(
84+
receivingBin
85+
);
86+
await createLocationPage.binLocationTabSection.searchField.press(
87+
'Enter'
88+
);
89+
await createLocationPage.binLocationTabSection.isLoaded();
90+
await createLocationPage.binLocationTabSection.editBinButton.click();
91+
await createLocationPage.locationConfigurationTab.click();
92+
await createLocationPage.locationConfigurationTabSection.activeCheckbox.uncheck();
93+
await createLocationPage.locationConfigurationTabSection.saveButton.click();
94+
});
95+
}
96+
);
6297

6398
test('Assert quantity input after split line', async ({
6499
stockMovementShowPage,

src/tests/receiving/assertRecipientField.test.ts

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import AppConfig from '@/config/AppConfig';
12
import { ShipmentType } from '@/constants/ShipmentType';
23
import { expect, test } from '@/fixtures/fixtures';
34
import { StockMovementResponse } from '@/types';
@@ -43,24 +44,58 @@ test.describe('Assert recipient field when receive', () => {
4344
}
4445
);
4546

46-
test.afterEach(async ({ stockMovementShowPage, stockMovementService }) => {
47-
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
48-
const isRollbackLastReceiptButtonVisible =
49-
await stockMovementShowPage.rollbackLastReceiptButton.isVisible();
50-
const isRollbackButtonVisible =
51-
await stockMovementShowPage.rollbackButton.isVisible();
52-
53-
// due to failed test, shipment might not be received which will not show the button
54-
if (isRollbackLastReceiptButtonVisible) {
55-
await stockMovementShowPage.rollbackLastReceiptButton.click();
56-
}
57-
58-
if (isRollbackButtonVisible) {
59-
await stockMovementShowPage.rollbackButton.click();
47+
test.afterEach(
48+
async ({
49+
stockMovementShowPage,
50+
stockMovementService,
51+
mainLocationService,
52+
page,
53+
locationListPage,
54+
createLocationPage,
55+
}) => {
56+
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
57+
const isRollbackLastReceiptButtonVisible =
58+
await stockMovementShowPage.rollbackLastReceiptButton.isVisible();
59+
const isRollbackButtonVisible =
60+
await stockMovementShowPage.rollbackButton.isVisible();
61+
62+
// due to failed test, shipment might not be received which will not show the button
63+
if (isRollbackLastReceiptButtonVisible) {
64+
await stockMovementShowPage.rollbackLastReceiptButton.click();
65+
}
66+
67+
if (isRollbackButtonVisible) {
68+
await stockMovementShowPage.rollbackButton.click();
69+
}
70+
71+
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
72+
73+
await test.step('Deactivate receiving bin', async () => {
74+
const mainLocation = await mainLocationService.getLocation();
75+
const receivingBin =
76+
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
77+
await page.goto('./location/list');
78+
await locationListPage.searchByLocationNameField.fill(
79+
mainLocation.name
80+
);
81+
await locationListPage.findButton.click();
82+
await locationListPage.getLocationEditButton(mainLocation.name).click();
83+
await createLocationPage.binLocationTab.click();
84+
await createLocationPage.binLocationTabSection.isLoaded();
85+
await createLocationPage.binLocationTabSection.searchField.fill(
86+
receivingBin
87+
);
88+
await createLocationPage.binLocationTabSection.searchField.press(
89+
'Enter'
90+
);
91+
await createLocationPage.binLocationTabSection.isLoaded();
92+
await createLocationPage.binLocationTabSection.editBinButton.click();
93+
await createLocationPage.locationConfigurationTab.click();
94+
await createLocationPage.locationConfigurationTabSection.activeCheckbox.uncheck();
95+
await createLocationPage.locationConfigurationTabSection.saveButton.click();
96+
});
6097
}
61-
62-
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
63-
});
98+
);
6499

65100
test('Assert recipient field filled and disabled', async ({
66101
stockMovementShowPage,

0 commit comments

Comments
 (0)