-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateMoreThan1PutawayForTheSameItem.test.ts
More file actions
230 lines (205 loc) · 8.45 KB
/
createMoreThan1PutawayForTheSameItem.test.ts
File metadata and controls
230 lines (205 loc) · 8.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import AppConfig from '@/config/AppConfig';
import { ShipmentType } from '@/constants/ShipmentType';
import { expect, test } from '@/fixtures/fixtures';
import { StockMovementResponse } from '@/types';
import RefreshCachesUtils from '@/utils/RefreshCaches';
import { getShipmentId, getShipmentItemId } from '@/utils/shipmentUtils';
test.describe('Create more than 1 putaway from the same item', () => {
let STOCK_MOVEMENT: StockMovementResponse;
test.beforeEach(
async ({
supplierLocationService,
stockMovementService,
productService,
receivingService,
}) => {
const supplierLocation = await supplierLocationService.getLocation();
STOCK_MOVEMENT = await stockMovementService.createInbound({
originId: supplierLocation.id,
});
productService.setProduct('5');
const product = await productService.getProduct();
await stockMovementService.addItemsToInboundStockMovement(
STOCK_MOVEMENT.id,
[{ productId: product.id, quantity: 10 }]
);
await stockMovementService.sendInboundStockMovement(STOCK_MOVEMENT.id, {
shipmentType: ShipmentType.AIR,
});
const { data: stockMovement } =
await stockMovementService.getStockMovement(STOCK_MOVEMENT.id);
const shipmentId = getShipmentId(stockMovement);
const { data: receipt } = await receivingService.getReceipt(shipmentId);
const receivingBin =
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
await receivingService.createReceivingBin(shipmentId, receipt);
await receivingService.updateReceivingItems(shipmentId, [
{
shipmentItemId: getShipmentItemId(receipt, 0, 0),
quantityReceiving: 10,
binLocationName: receivingBin,
},
]);
await receivingService.completeReceipt(shipmentId);
}
);
test.afterEach(
async ({
stockMovementShowPage,
stockMovementService,
navbar,
transactionListPage,
oldViewShipmentPage,
}) => {
await navbar.configurationButton.click();
await navbar.transactions.click();
await transactionListPage.table.row(1).actionsButton.click();
await transactionListPage.table.deleteButton.click();
await expect(transactionListPage.successMessage).toBeVisible();
await transactionListPage.table.row(1).actionsButton.click();
await transactionListPage.table.deleteButton.click();
await expect(transactionListPage.successMessage).toBeVisible();
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
await stockMovementShowPage.detailsListTable.oldViewShipmentPage.click();
await oldViewShipmentPage.undoStatusChangeButton.click();
await stockMovementShowPage.isLoaded();
await stockMovementShowPage.rollbackButton.click();
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
}
);
test('Create more than 1 putaway from the same item', async ({
stockMovementShowPage,
navbar,
createPutawayPage,
internalLocationService,
productShowPage,
putawayDetailsPage,
productService,
}) => {
productService.setProduct('5');
const product = await productService.getProduct();
const internalLocation = await internalLocationService.getLocation();
const receivingBin =
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
await test.step('Go to stock movement show page and assert received status', async () => {
await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id);
await stockMovementShowPage.isLoaded();
await expect(stockMovementShowPage.statusTag).toHaveText('Received');
await navbar.profileButton.click();
await navbar.refreshCachesButton.click();
});
await test.step('Go to create putaway page', async () => {
await navbar.inbound.click();
await navbar.createPutaway.click();
await createPutawayPage.isLoaded();
});
await test.step('Start putaway', async () => {
await createPutawayPage.table.row(0).checkbox.click();
await createPutawayPage.startPutawayButton.click();
await createPutawayPage.startStep.isLoaded();
});
await test.step('Select bin to putaway', async () => {
await createPutawayPage.startStep.table.row(0).editButton.click();
await createPutawayPage.startStep.table.row(0).quantityInput.fill('5');
await createPutawayPage.startStep.table.row(0).putawayBinSelect.click();
await createPutawayPage.startStep.table
.row(0)
.getPutawayBin(internalLocation.name)
.click();
await createPutawayPage.startStep.nextButton.click();
});
await test.step('Complete putaway and assert displayed dialog', async () => {
await createPutawayPage.completeStep.isLoaded();
await createPutawayPage.completeStep.completePutawayButton.click();
await expect(
createPutawayPage.completeStep.confirmPutawayDialog
).toBeVisible();
await expect(
createPutawayPage.completeStep.confirmPutawayDialog
).toContainText(
`Qty5 of item ${product.name} is still in the receiving bin. Do you want to continue?`
);
await expect(
createPutawayPage.completeStep.noButtonOnConfirmPutawayDialog
).toBeVisible();
await createPutawayPage.completeStep.noButtonOnConfirmPutawayDialog
.last()
.click();
await createPutawayPage.completeStep.isLoaded();
});
await test.step('Accept dialog and complete putaway', async () => {
await createPutawayPage.completeStep.isLoaded();
await createPutawayPage.completeStep.completePutawayButton.click();
await expect(
createPutawayPage.completeStep.confirmPutawayDialog
).toBeVisible();
await createPutawayPage.completeStep.yesButtonOnConfirmPutawayDialog
.last()
.click();
});
await test.step('Assert completing putaway', async () => {
await putawayDetailsPage.isLoaded();
await expect(putawayDetailsPage.statusTag).toHaveText('Completed');
});
await test.step('Assert putaway bin and qty on stock card', async () => {
await putawayDetailsPage.summaryTab.click();
await productShowPage.goToPage(product.id);
await productShowPage.inStockTab.click();
await productShowPage.inStockTabSection.isLoaded();
await expect(
productShowPage.inStockTabSection.row(1).binLocation
).toHaveText(internalLocation.name);
await expect(
productShowPage.inStockTabSection.row(1).quantityOnHand
).toHaveText('5');
await RefreshCachesUtils.refreshCaches({
navbar
});
});
await test.step('Go to create putaway page and assert receiving bin', async () => {
await navbar.inbound.click();
await navbar.createPutaway.click();
await createPutawayPage.isLoaded();
await createPutawayPage.table
.row(0)
.getExpandBinLocation(receivingBin)
.click();
await expect(
createPutawayPage.table.row(1).getProductName(product.name)
).toBeVisible();
});
await test.step('Start putaway', async () => {
await createPutawayPage.table.row(1).checkbox.click();
await createPutawayPage.startPutawayButton.click();
await createPutawayPage.startStep.isLoaded();
});
await test.step('Select bin to putaway', async () => {
await createPutawayPage.startStep.table.row(0).putawayBinSelect.click();
await createPutawayPage.startStep.table
.row(0)
.getPutawayBin(internalLocation.name)
.click();
await createPutawayPage.startStep.nextButton.click();
});
await test.step('Complete putaway', async () => {
await createPutawayPage.completeStep.isLoaded();
await createPutawayPage.completeStep.completePutawayButton.click();
});
await test.step('Assert completing putaway', async () => {
await putawayDetailsPage.isLoaded();
await expect(putawayDetailsPage.statusTag).toHaveText('Completed');
});
await test.step('Assert putaway bin and qty on stock card', async () => {
await putawayDetailsPage.summaryTab.click();
await productShowPage.goToPage(product.id);
await productShowPage.inStockTab.click();
await productShowPage.inStockTabSection.isLoaded();
await expect(
productShowPage.inStockTabSection.row(1).binLocation
).toHaveText(internalLocation.name);
await expect(
productShowPage.inStockTabSection.row(1).quantityOnHand
).toHaveText('10');
});
});
});