Skip to content

Commit 13b2503

Browse files
authored
Merge pull request #66 from openboxes/OBPIH-7029
OBPIH-7029: add deactivation of receiving bin to receiving tests
2 parents f5ee729 + 93b0885 commit 13b2503

24 files changed

+850
-308
lines changed

src/tests/inbound/createInbound/exportItems.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ test.describe('Export all incoming items', () => {
152152
const isRollbackButtonVisible =
153153
await stockMovementShowPage.rollbackButton.isVisible();
154154

155-
// due to failed test, shipment might not be received which will not show the button
156155
if (isRollbackLastReceiptButtonVisible) {
157156
await stockMovementShowPage.rollbackLastReceiptButton.click();
158157
}

src/tests/receiving/assertBinLocationField.test.ts

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import AppConfig from '@/config/AppConfig';
22
import { ShipmentType } from '@/constants/ShipmentType';
33
import { expect, test } from '@/fixtures/fixtures';
44
import { StockMovementResponse } from '@/types';
5+
import BinLocationUtils from '@/utils/BinLocationUtils';
56

67
test.describe('Assert bin location not clearable', () => {
78
let STOCK_MOVEMENT: StockMovementResponse;
@@ -35,24 +36,41 @@ test.describe('Assert bin location not clearable', () => {
3536
}
3637
);
3738

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

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-
}
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+
const receivingBin =
64+
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
65+
await BinLocationUtils.deactivateReceivingBin({
66+
mainLocationService,
67+
locationListPage,
68+
createLocationPage,
69+
page,
70+
receivingBin,
71+
});
72+
}
73+
);
5674

5775
test('Assert bin location not clearable', async ({
5876
stockMovementShowPage,
@@ -69,7 +87,7 @@ test.describe('Assert bin location not clearable', () => {
6987
});
7088

7189
await test.step('Assert bin location cant be cleared', async () => {
72-
await expect(
90+
await expect(
7391
receivingPage.receivingStep.table
7492
.row(1)
7593
.binLocationSelect.locator('.react-select__clear-indicator')
@@ -89,7 +107,7 @@ test.describe('Assert bin location not clearable', () => {
89107
await receivingPage.receivingStep.editModal.saveButton.click();
90108
});
91109

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

src/tests/receiving/assertCreationOfGoodsReceiptNote.test.ts

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import AppConfig from '@/config/AppConfig';
12
import { ShipmentType } from '@/constants/ShipmentType';
23
import { expect, test } from '@/fixtures/fixtures';
34
import { StockMovementResponse } from '@/types';
5+
import BinLocationUtils from '@/utils/BinLocationUtils';
46

57
test.describe('Assert Goods Receipt Note is created and opened', () => {
68
let STOCK_MOVEMENT: StockMovementResponse;
@@ -34,12 +36,30 @@ test.describe('Assert Goods Receipt Note is created and opened', () => {
3436
}
3537
);
3638

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-
});
39+
test.afterEach(
40+
async ({
41+
stockMovementShowPage,
42+
stockMovementService,
43+
mainLocationService,
44+
page,
45+
locationListPage,
46+
createLocationPage,
47+
}) => {
48+
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
49+
await stockMovementShowPage.rollbackLastReceiptButton.click();
50+
await stockMovementShowPage.rollbackButton.click();
51+
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
52+
const receivingBin =
53+
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
54+
await BinLocationUtils.deactivateReceivingBin({
55+
mainLocationService,
56+
locationListPage,
57+
createLocationPage,
58+
page,
59+
receivingBin,
60+
});
61+
}
62+
);
4363

4464
test('Assert Goods Receipt note is created', async ({
4565
stockMovementShowPage,

src/tests/receiving/assertCreationOfReceivingBin.test.ts

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { expect, test } from '@/fixtures/fixtures';
44
import CreateLocationPage from '@/pages/location/createLocation/CreateLocationPage';
55
import LocationListPage from '@/pages/location/LocationListPage';
66
import { StockMovementResponse } from '@/types';
7+
import BinLocationUtils from '@/utils/BinLocationUtils';
78

89
test.describe('Assert creation of receiving bin', () => {
910
test.describe.configure({ timeout: 60000 });
@@ -42,11 +43,30 @@ test.describe('Assert creation of receiving bin', () => {
4243
}
4344
);
4445

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-
});
46+
test.afterEach(
47+
async ({
48+
stockMovementShowPage,
49+
stockMovementService,
50+
mainLocationService,
51+
page,
52+
locationListPage,
53+
createLocationPage,
54+
}) => {
55+
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
56+
await stockMovementShowPage.rollbackButton.click();
57+
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
58+
59+
const receivingBin =
60+
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
61+
await BinLocationUtils.deactivateReceivingBin({
62+
mainLocationService,
63+
locationListPage,
64+
createLocationPage,
65+
page,
66+
receivingBin,
67+
});
68+
}
69+
);
5070

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

src/tests/receiving/assertQtyInputs.test.ts

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import AppConfig from '@/config/AppConfig';
12
import { ShipmentType } from '@/constants/ShipmentType';
23
import { expect, test } from '@/fixtures/fixtures';
34
import { StockMovementResponse } from '@/types';
5+
import BinLocationUtils from '@/utils/BinLocationUtils';
46
import { formatDate, getDateByOffset } from '@/utils/DateUtils';
57

68
test.describe('Assert if quantity inputs remain when split lines', () => {
@@ -41,24 +43,42 @@ test.describe('Assert if quantity inputs remain when split lines', () => {
4143
}
4244
);
4345

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();
46+
test.afterEach(
47+
async ({
48+
stockMovementShowPage,
49+
stockMovementService,
50+
mainLocationService,
51+
page,
52+
locationListPage,
53+
createLocationPage,
54+
}) => {
55+
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
56+
const isRollbackLastReceiptButtonVisible =
57+
await stockMovementShowPage.rollbackLastReceiptButton.isVisible();
58+
const isRollbackButtonVisible =
59+
await stockMovementShowPage.rollbackButton.isVisible();
5060

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-
}
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+
const receivingBin =
72+
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
73+
await BinLocationUtils.deactivateReceivingBin({
74+
mainLocationService,
75+
locationListPage,
76+
createLocationPage,
77+
page,
78+
receivingBin,
79+
});
80+
}
81+
);
6282

6383
test('Assert quantity input after split line', async ({
6484
stockMovementShowPage,

src/tests/receiving/assertRecipientField.test.ts

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import AppConfig from '@/config/AppConfig';
12
import { ShipmentType } from '@/constants/ShipmentType';
23
import { expect, test } from '@/fixtures/fixtures';
34
import { StockMovementResponse } from '@/types';
5+
import BinLocationUtils from '@/utils/BinLocationUtils';
46

57
test.describe('Assert recipient field when receive', () => {
68
let STOCK_MOVEMENT: StockMovementResponse;
@@ -43,24 +45,42 @@ test.describe('Assert recipient field when receive', () => {
4345
}
4446
);
4547

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();
48+
test.afterEach(
49+
async ({
50+
stockMovementShowPage,
51+
stockMovementService,
52+
mainLocationService,
53+
page,
54+
locationListPage,
55+
createLocationPage,
56+
}) => {
57+
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
58+
const isRollbackLastReceiptButtonVisible =
59+
await stockMovementShowPage.rollbackLastReceiptButton.isVisible();
60+
const isRollbackButtonVisible =
61+
await stockMovementShowPage.rollbackButton.isVisible();
62+
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+
const receivingBin =
74+
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
75+
await BinLocationUtils.deactivateReceivingBin({
76+
mainLocationService,
77+
locationListPage,
78+
createLocationPage,
79+
page,
80+
receivingBin,
81+
});
6082
}
61-
62-
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
63-
});
83+
);
6484

6585
test('Assert recipient field filled and disabled', async ({
6686
stockMovementShowPage,

src/tests/receiving/cancelRemainingQty.test.ts

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import AppConfig from '@/config/AppConfig';
12
import { ShipmentType } from '@/constants/ShipmentType';
23
import { expect, test } from '@/fixtures/fixtures';
34
import { StockMovementResponse } from '@/types';
5+
import BinLocationUtils from '@/utils/BinLocationUtils';
46

57
test.describe('Cancel qty in the middle of receipt', () => {
68
let STOCK_MOVEMENT: StockMovementResponse;
@@ -37,24 +39,41 @@ test.describe('Cancel qty in the middle of receipt', () => {
3739
}
3840
);
3941

40-
test.afterEach(async ({ stockMovementShowPage, stockMovementService }) => {
41-
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
42-
const isRollbackLastReceiptButtonVisible =
43-
await stockMovementShowPage.rollbackLastReceiptButton.isVisible();
44-
const isRollbackButtonVisible =
45-
await stockMovementShowPage.rollbackButton.isVisible();
46-
47-
// due to failed test, shipment might not be received which will not show the button
48-
if (isRollbackLastReceiptButtonVisible) {
49-
await stockMovementShowPage.rollbackLastReceiptButton.click();
50-
}
51-
52-
if (isRollbackButtonVisible) {
53-
await stockMovementShowPage.rollbackButton.click();
42+
test.afterEach(
43+
async ({
44+
stockMovementShowPage,
45+
stockMovementService,
46+
mainLocationService,
47+
page,
48+
locationListPage,
49+
createLocationPage,
50+
}) => {
51+
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
52+
const isRollbackLastReceiptButtonVisible =
53+
await stockMovementShowPage.rollbackLastReceiptButton.isVisible();
54+
const isRollbackButtonVisible =
55+
await stockMovementShowPage.rollbackButton.isVisible();
56+
57+
if (isRollbackLastReceiptButtonVisible) {
58+
await stockMovementShowPage.rollbackLastReceiptButton.click();
59+
}
60+
61+
if (isRollbackButtonVisible) {
62+
await stockMovementShowPage.rollbackButton.click();
63+
}
64+
65+
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
66+
const receivingBin =
67+
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
68+
await BinLocationUtils.deactivateReceivingBin({
69+
mainLocationService,
70+
locationListPage,
71+
createLocationPage,
72+
page,
73+
receivingBin,
74+
});
5475
}
55-
56-
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
57-
});
76+
);
5877

5978
test('Cancel remaining qty when receive item partially', async ({
6079
stockMovementShowPage,

0 commit comments

Comments
 (0)