diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 42c01ac07..ad81b9b3a 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -840,7 +840,8 @@ export default { }, travelIndex: { anySearchResult: 'vn-travel-index vn-tbody > a', - firstSearchResult: 'vn-travel-index vn-tbody > a:nth-child(1)' + firstSearchResult: 'vn-travel-index vn-tbody > a:nth-child(1)', + firstTravelAddEntryButton: 'vn-travel-index a:nth-child(1) vn-icon[icon="icon-ticket"]', }, travelExtraCommunity: { anySearchResult: 'vn-travel-extra-community > vn-data-viewer div > vn-tbody > vn-tr', @@ -879,6 +880,7 @@ export default { dotMenu: 'vn-travel-descriptor vn-icon-button[icon="more_vert"]', dotMenuClone: '#clone', dotMenuCloneWithEntries: '#cloneWithEntries', + dotMenuAddEntry: '[name="addEntry"]', acceptClonation: 'tpl-buttons > button[response="accept"]' }, travelCreate: { @@ -909,6 +911,10 @@ export default { volumetric: 'vn-zone-basic-data vn-check[ng-model="$ctrl.zone.isVolumetric"]', saveButton: 'vn-zone-basic-data vn-submit > button', }, + entryCreate: { + travel: 'vn-entry-create vn-autocomplete[ng-model="$ctrl.entry.travelFk"]', + company: 'vn-entry-create vn-autocomplete[ng-model="$ctrl.entry.companyFk"]' + }, entrySummary: { header: 'vn-entry-summary > vn-card > h5', reference: 'vn-entry-summary vn-label-value[label="Reference"]', diff --git a/e2e/paths/10-travel/03_descriptor.spec.js b/e2e/paths/10-travel/03_descriptor.spec.js index cdca379ad..a1a035317 100644 --- a/e2e/paths/10-travel/03_descriptor.spec.js +++ b/e2e/paths/10-travel/03_descriptor.spec.js @@ -33,6 +33,61 @@ describe('Travel descriptor path', () => { expect(state).toBe('travel.card.summary'); }); + it('should be redirected to the create entry view', async() => { + await page.waitToClick(selectors.travelDescriptor.dotMenu); + await page.waitToClick(selectors.travelDescriptor.dotMenuAddEntry); + await page.waitForState('entry.create'); + const state = await page.getState(); + + expect(state).toBe('entry.create'); + }); + + it('should check some data was imported from the travel', async() => { + const travel = await page.waitToGetProperty(selectors.entryCreate.travel, 'value'); + const campany = await page.waitToGetProperty(selectors.entryCreate.company, 'value'); + + expect(travel).toContain('Warehouse'); + expect(campany).toContain('VNL'); + }); + + it('should navigate back to the travel index', async() => { + await page.waitToClick('.cancel'); + await page.waitToClick(selectors.globalItems.homeButton); + await page.selectModule('travel'); + await page.waitForState('travel.index'); + const state = await page.getState(); + + expect(state).toBe('travel.index'); + }); + + it('should click on the add entry button of the third result to be redirected to create entry', async() => { + await page.keyboard.press('Enter'); + await page.waitToClick(selectors.travelIndex.firstTravelAddEntryButton); + await page.waitForState('entry.create'); + const state = await page.getState(); + + expect(state).toBe('entry.create'); + }); + + it('should check again some data was imported from the travel', async() => { + const travel = await page.waitToGetProperty(selectors.entryCreate.travel, 'value'); + const campany = await page.waitToGetProperty(selectors.entryCreate.company, 'value'); + + expect(travel).toContain('Warehouse'); + expect(campany).toContain('VNL'); + }); + + it('should navigate to the travel summary of a given travel', async() => { + await page.waitToClick('.cancel'); + await page.waitToClick(selectors.globalItems.homeButton); + await page.selectModule('travel'); + await page.accessToSearchResult('3'); + await page.waitForState('travel.card.summary'); + const state = await page.getState(); + + expect(state).toBe('travel.card.summary'); + }); + it('should be redirected to the create travel when using the clone option of the dot menu', async() => { await page.waitToClick(selectors.travelDescriptor.dotMenu); await page.waitToClick(selectors.travelDescriptor.dotMenuClone); diff --git a/modules/travel/front/descriptor-menu/index.html b/modules/travel/front/descriptor-menu/index.html index 171aa89ec..c7edcd59e 100644 --- a/modules/travel/front/descriptor-menu/index.html +++ b/modules/travel/front/descriptor-menu/index.html @@ -18,6 +18,12 @@ translate> Clone travel and his entries + + Add entry + diff --git a/modules/travel/front/descriptor-menu/locale/es.yml b/modules/travel/front/descriptor-menu/locale/es.yml index ca61c4e01..b764ba0cd 100644 --- a/modules/travel/front/descriptor-menu/locale/es.yml +++ b/modules/travel/front/descriptor-menu/locale/es.yml @@ -1,3 +1,4 @@ Clone travel: Clonar envío +Add entry: Añadir entrada Clone travel and his entries: Clonar travel y sus entradas -Do you want to clone this travel and all containing entries?: ¿Quieres clonar este travel y todas las entradas que contiene? \ No newline at end of file +Do you want to clone this travel and all containing entries?: ¿Quieres clonar este travel y todas las entradas que contiene? diff --git a/modules/travel/front/index/index.html b/modules/travel/front/index/index.html index d85b62a4c..1a0f59e14 100644 --- a/modules/travel/front/index/index.html +++ b/modules/travel/front/index/index.html @@ -49,6 +49,11 @@ vn-tooltip="Clone" icon="icon-clone"> + +