diff --git a/db/changes/230601/00-ticket_canAdvance.sql b/db/changes/230601/00-ticket_canAdvance.sql index af1819c77..68942a286 100644 --- a/db/changes/230601/00-ticket_canAdvance.sql +++ b/db/changes/230601/00-ticket_canAdvance.sql @@ -80,7 +80,7 @@ BEGIN JOIN vn.state st ON st.id = ts.stateFk JOIN vn.agencyMode am ON t.agencyModeFk = am.id LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk - LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk + LEFT JOIN tmp.stock st ON st.itemFk = i.id JOIN (SELECT t2.id ticketFk, t2.addressFk, @@ -105,7 +105,7 @@ BEGIN GROUP BY t2.id) t2 ON t2.addressFk = t.addressFk WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture) AND t.warehouseFk = vWarehouseFk - GROUP BY id, futureId + GROUP BY t.id ) sub WHERE hasStock != 0; diff --git a/e2e/paths/05-ticket/22_advance.spec.js b/e2e/paths/05-ticket/22_advance.spec.js index e94600066..49ab5b0fc 100644 --- a/e2e/paths/05-ticket/22_advance.spec.js +++ b/e2e/paths/05-ticket/22_advance.spec.js @@ -4,6 +4,7 @@ import getBrowser from '../../helpers/puppeteer'; describe('Ticket Advance path', () => { let browser; let page; + const httpRequests = []; beforeAll(async() => { browser = await getBrowser(); @@ -47,53 +48,70 @@ describe('Ticket Advance path', () => { it('should search with the required data', async() => { await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); + + expect(httpRequests.length).toBeGreaterThan(0); }); it('should search with the origin IPT', async() => { - await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); - await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal'); - await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); - - await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); - await page.clearInput(selectors.ticketAdvance.ipt); - await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); - }); - - it('should search with the destination IPT', async() => { await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'Horizontal'); await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); + + const request = httpRequests.find(req => req.includes(('futureIpt=H'))); + + expect(request).toBeDefined(); + + httpRequests.splice(httpRequests.indexOf(request), 1); await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); await page.clearInput(selectors.ticketAdvance.futureIpt); await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); + }); + + it('should search with the destination IPT', async() => { + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal'); + await page.waitToClick(selectors.ticketAdvance.submit); + + const request = httpRequests.find(req => req.includes(('ipt=H'))); + + expect(request).toBeDefined(); + + httpRequests.splice(httpRequests.indexOf(request), 1); + + await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); + await page.clearInput(selectors.ticketAdvance.ipt); + await page.waitToClick(selectors.ticketAdvance.submit); }); it('should search in smart-table with an IPT Origin', async() => { await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'Vertical'); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); + + const request = httpRequests.find(req => req.includes(('ipt'))); + + expect(request).toBeDefined(); + + httpRequests.splice(httpRequests.indexOf(request), 1); await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); }); it('should search in smart-table with an IPT Destination', async() => { await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'Vertical'); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); + + const request = httpRequests.find(req => req.includes(('futureIpt'))); + + expect(request).toBeDefined(); + + httpRequests.splice(httpRequests.indexOf(request), 1); await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); await page.waitToClick(selectors.ticketAdvance.submit); - await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1); }); it('should check the one ticket and move to the present', async() => { diff --git a/modules/ticket/front/advance/index.html b/modules/ticket/front/advance/index.html index c700a1cc3..48023955e 100644 --- a/modules/ticket/front/advance/index.html +++ b/modules/ticket/front/advance/index.html @@ -100,13 +100,6 @@ vn-click-stop> -