-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassertPutawayDetailsPage.test.ts
More file actions
302 lines (273 loc) · 11.2 KB
/
assertPutawayDetailsPage.test.ts
File metadata and controls
302 lines (273 loc) · 11.2 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
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('Assert putaway details page', () => {
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('Assert putaway details page', async ({
stockMovementShowPage,
navbar,
createPutawayPage,
internalLocationService,
putawayDetailsPage,
putawayListPage,
page,
mainLocationService,
}) => {
const internalLocation = await internalLocationService.getLocation();
const receivingBin =
AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier;
const currentLocation = await mainLocationService.getLocation();
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 RefreshCachesUtils.refreshCaches({
navbar
});
});
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).putawayBinSelect.click();
await createPutawayPage.startStep.table
.row(0)
.getPutawayBin(internalLocation.name)
.click();
await createPutawayPage.startStep.saveButton.click();
});
await test.step('Go to putaway list page and assert default filtering', async () => {
await putawayListPage.goToPage();
await putawayListPage.isLoaded();
await expect(putawayListPage.orderTypeFilter).toContainText(
'Putaway Order'
);
await expect(putawayListPage.orderTypeFilter).toBeDisabled();
await expect(putawayListPage.statusFilter).toContainText('Pending');
await expect(putawayListPage.statusFilter).toBeEnabled();
await expect(putawayListPage.table.row(1).statusTag).toHaveText(
'Pending'
);
await expect(putawayListPage.destinationFilter).toContainText(
currentLocation.name
);
});
await test.step('Go to putaway view page and assert page elements', async () => {
const row = putawayListPage.table.row(1);
await row.actionsButton.click();
await row.viewOrderDetails.click();
await putawayDetailsPage.isLoaded();
await expect(putawayDetailsPage.listOrdersButton).toBeVisible();
await expect(putawayDetailsPage.createOrderButton).toBeVisible();
await expect(putawayDetailsPage.showOrderButton).toBeVisible();
await expect(putawayDetailsPage.editButton).toBeVisible();
await expect(putawayDetailsPage.addCommentButton).toBeVisible();
await expect(putawayDetailsPage.addDocumentButton).toBeVisible();
await expect(putawayDetailsPage.generatePutawayListButton).toBeVisible();
});
await test.step('Assert column headers on summary tab', async () => {
await putawayDetailsPage.summaryTab.click();
await expect(
putawayDetailsPage.summaryTable.getColumnHeader('Code')
).toBeVisible();
await expect(
putawayDetailsPage.summaryTable.getColumnHeader('Name')
).toBeVisible();
await expect(
putawayDetailsPage.summaryTable.getColumnHeader('Quantity')
).toBeVisible();
await expect(
putawayDetailsPage.summaryTable.getColumnHeader('UOM')
).toBeVisible();
await expect(
putawayDetailsPage.summaryTable.getColumnHeader('Unit Price')
).toBeVisible();
await expect(
putawayDetailsPage.summaryTable.getColumnHeader('Total Amount').nth(1)
).toBeVisible();
});
await test.step('Assert column headers on items status tab', async () => {
await putawayDetailsPage.itemStatusTab.click();
await expect(
putawayDetailsPage.itemStatusTable.getColumnHeader('Status')
).toBeVisible();
await expect(
putawayDetailsPage.itemStatusTable.getColumnHeader('Code')
).toBeVisible();
await expect(
putawayDetailsPage.itemStatusTable.getColumnHeader('Product')
).toBeVisible();
await expect(
putawayDetailsPage.itemStatusTable.getColumnHeader('Supplier code')
).toBeVisible();
await expect(
putawayDetailsPage.itemStatusTable.getColumnHeader('Unit of measure')
).toBeVisible();
await expect(
putawayDetailsPage.itemStatusTable.getColumnHeader('Quantity')
).toBeVisible();
await expect(
putawayDetailsPage.itemStatusTable.getColumnHeader(
'Serial / Lot Number'
)
).toBeVisible();
await expect(
putawayDetailsPage.itemStatusTable.getColumnHeader('Expiration date')
).toBeVisible();
await expect(
putawayDetailsPage.itemStatusTable.getColumnHeader('Origin Bin')
).toBeVisible();
await expect(
putawayDetailsPage.itemStatusTable.getColumnHeader('Destination Bin')
).toBeVisible();
});
await test.step('Assert content of items status table', async () => {
await expect(
putawayDetailsPage.itemStatusTable.row(1).itemStatus
).toHaveText('PENDING');
await expect(
putawayDetailsPage.itemStatusTable.row(1).originBin
).toHaveText(receivingBin);
await expect(
putawayDetailsPage.itemStatusTable.row(1).destinationBin
).toHaveText(internalLocation.name);
});
await test.step('Assert informations on order header', async () => {
await putawayDetailsPage.isLoaded();
await expect(
putawayDetailsPage.orderHeaderTable.statusRowValue
).toContainText('Pending');
await expect(
putawayDetailsPage.orderHeaderTable.orderTypeValue
).toContainText('Putaway Order');
});
await test.step('Assert options on summary action menu', async () => {
await putawayDetailsPage.summaryActionsButton.click();
await expect(
putawayDetailsPage.actionsViewOrderDetailsButton
).toBeVisible();
await expect(putawayDetailsPage.actionsAddCommentButton).toBeVisible();
await expect(putawayDetailsPage.actionsAddDocumentsButton).toBeVisible();
await expect(
putawayDetailsPage.actionsGeneratePutawayListButton
).toBeVisible();
await expect(putawayDetailsPage.actionsDeleteButton).toBeVisible();
await putawayDetailsPage.summaryActionsButton.click();
});
const putawayOrderIdentifier =
await putawayDetailsPage.orderHeaderTable.orderNumberValue.textContent();
await test.step('Download putaway pdf', async () => {
const generatePutawayPdfFileName =
'Putaway ' + `${putawayOrderIdentifier}`.toString().trim() + '.pdf';
await putawayDetailsPage.generatePutawayListButton.click();
const downloadPromise = page.waitForEvent('download');
const download = await downloadPromise;
await expect(download.suggestedFilename()).toBe(
generatePutawayPdfFileName
);
});
await test.step('Edit pending putaway and reload without losing data', async () => {
await putawayDetailsPage.editButton.click();
await createPutawayPage.startStep.isLoaded();
await page.reload();
await createPutawayPage.startStep.isLoaded();
});
await test.step('Complete putaway', async () => {
await createPutawayPage.startStep.nextButton.click();
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 expect(
putawayDetailsPage.orderHeaderTable.statusRowValue
).toContainText('Completed');
});
await test.step('Assert completed putaway on list putaway', async () => {
await putawayListPage.goToPage();
await putawayListPage.clearFilteringButton.click();
await expect(putawayListPage.destinationFilter).toContainText(
currentLocation.name
);
await putawayListPage.searchField.fill(
`${putawayOrderIdentifier}`.toString().trim()
);
await putawayListPage.searchButton.click();
await expect(putawayListPage.table.row(1).statusTag).toHaveText(
'Completed'
);
});
});
});