@@ -9,6 +9,8 @@ test.describe('Export all incomming items', () => {
99 test . afterEach ( async ( { stockMovementService, stockMovementShowPage } ) => {
1010 await stockMovementShowPage . goToPage ( INBOUND_ID ) ;
1111 await stockMovementShowPage . isLoaded ( ) ;
12+ await stockMovementShowPage . rollbackLastReceiptButton . click ( ) ;
13+ await stockMovementShowPage . rollbackLastReceiptButton . click ( ) ;
1214 await stockMovementShowPage . rollbackButton . click ( ) ;
1315 await stockMovementService . deleteStockMovement ( INBOUND_ID ) ;
1416
@@ -26,6 +28,7 @@ test.describe('Export all incomming items', () => {
2628 createInboundPage,
2729 stockMovementShowPage,
2830 stockMovementService,
31+ receivingPage,
2932 } ) => {
3033 const ORIGIN = await supplierLocationService . getLocation ( ) ;
3134 const DESCRIPTION = 'some description' ;
@@ -127,5 +130,107 @@ test.describe('Export all incomming items', () => {
127130 ) ;
128131 expect ( stockMovementItemsFromFile ) . toHaveLength ( 2 ) ;
129132 } ) ;
133+
134+ await test . step ( 'Go to inbound view page' , async ( ) => {
135+ await stockMovementShowPage . goToPage ( INBOUND_ID ) ;
136+ await stockMovementShowPage . isLoaded ( ) ;
137+ } ) ;
138+
139+ await test . step ( 'Go to shipment receiving page' , async ( ) => {
140+ await stockMovementShowPage . receiveButton . click ( ) ;
141+ await receivingPage . receivingStep . isLoaded ( ) ;
142+ } ) ;
143+
144+ await test . step ( 'Select item to receive' , async ( ) => {
145+ await receivingPage . receivingStep . isLoaded ( ) ;
146+ await receivingPage . receivingStep . table
147+ . row ( 1 )
148+ . receivingNowField . textbox . fill ( '12' ) ;
149+ } ) ;
150+
151+ await test . step ( 'Go to Check page' , async ( ) => {
152+ await receivingPage . nextButton . click ( ) ;
153+ } ) ;
154+
155+ await test . step ( 'Receive shipment' , async ( ) => {
156+ await receivingPage . checkStep . isLoaded ( ) ;
157+ await receivingPage . checkStep . receiveShipmentButton . click ( ) ;
158+ await stockMovementShowPage . isLoaded ( ) ;
159+ } ) ;
160+
161+ await test . step ( 'Go to inbound list page' , async ( ) => {
162+ await inboundListPage . goToPage ( ) ;
163+ } ) ;
164+
165+ await test . step ( 'Download file' , async ( ) => {
166+ const { fullFilePath } = await inboundListPage . downloadAllIncomingItems ( ) ;
167+ filePath = fullFilePath ;
168+ } ) ;
169+
170+ await test . step ( 'Read file' , async ( ) => {
171+ downloadedTemplateFile = WorkbookUtils . read ( filePath ) ;
172+ workbooks . push ( downloadedTemplateFile ) ;
173+ } ) ;
174+
175+ await test . step ( 'Assert 1 item from stock movement is included in the epxort file' , async ( ) => {
176+ const { data } = await stockMovementService . getStockMovement ( INBOUND_ID ) ;
177+ const fileData = downloadedTemplateFile . getData ( ) ;
178+
179+ const stockMovementItemsFromFile = fileData . filter (
180+ ( it ) => it [ 5 ] === data . identifier
181+ ) ;
182+ expect ( stockMovementItemsFromFile ) . toHaveLength ( 1 ) ;
183+ } ) ;
184+
185+ await test . step ( 'Go to inbound view page' , async ( ) => {
186+ await stockMovementShowPage . goToPage ( INBOUND_ID ) ;
187+ await stockMovementShowPage . isLoaded ( ) ;
188+ } ) ;
189+
190+ await test . step ( 'Go to shipment receiving page' , async ( ) => {
191+ await stockMovementShowPage . receiveButton . click ( ) ;
192+ await receivingPage . receivingStep . isLoaded ( ) ;
193+ } ) ;
194+
195+ await test . step ( 'Select item to receive' , async ( ) => {
196+ await receivingPage . receivingStep . isLoaded ( ) ;
197+ await receivingPage . receivingStep . table
198+ . row ( 2 )
199+ . receivingNowField . textbox . fill ( '12' ) ;
200+ } ) ;
201+
202+ await test . step ( 'Go to Check page' , async ( ) => {
203+ await receivingPage . nextButton . click ( ) ;
204+ } ) ;
205+
206+ await test . step ( 'Receive shipment' , async ( ) => {
207+ await receivingPage . checkStep . isLoaded ( ) ;
208+ await receivingPage . checkStep . receiveShipmentButton . click ( ) ;
209+ await stockMovementShowPage . isLoaded ( ) ;
210+ } ) ;
211+
212+ await test . step ( 'Go to inbound list page' , async ( ) => {
213+ await inboundListPage . goToPage ( ) ;
214+ } ) ;
215+
216+ await test . step ( 'Download file' , async ( ) => {
217+ const { fullFilePath } = await inboundListPage . downloadAllIncomingItems ( ) ;
218+ filePath = fullFilePath ;
219+ } ) ;
220+
221+ await test . step ( 'Read file' , async ( ) => {
222+ downloadedTemplateFile = WorkbookUtils . read ( filePath ) ;
223+ workbooks . push ( downloadedTemplateFile ) ;
224+ } ) ;
225+
226+ await test . step ( 'Assert received items from stock movement are not included in the epxort file' , async ( ) => {
227+ const { data } = await stockMovementService . getStockMovement ( INBOUND_ID ) ;
228+ const fileData = downloadedTemplateFile . getData ( ) ;
229+
230+ const stockMovementItemsFromFile = fileData . filter (
231+ ( it ) => it [ 5 ] === data . identifier
232+ ) ;
233+ expect ( stockMovementItemsFromFile ) . toHaveLength ( 0 ) ;
234+ } ) ;
130235 } ) ;
131236} ) ;
0 commit comments