Merge pull request '2609-travel_index_addEntry + e2e' (#499) from 2609-travel_index_addEntry into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #499
Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2021-01-20 20:04:10 +00:00
commit f983edf77e
5 changed files with 75 additions and 2 deletions

View File

@ -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"]',

View File

@ -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);

View File

@ -18,6 +18,12 @@
translate>
Clone travel and his entries
</vn-item>
<a class="vn-item"
ui-sref="entry.create({travelFk: $ctrl.travel.id})"
name="addEntry"
translate>
Add entry
</a>
</vn-list>
</vn-menu>

View File

@ -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?

View File

@ -49,6 +49,11 @@
vn-tooltip="Clone"
icon="icon-clone">
</vn-icon-button>
<vn-icon-button
vn-anchor="::{state: 'entry.create', params: {travelFk: travel.id}}"
vn-tooltip="Add entry"
icon="icon-ticket">
</vn-icon-button>
<vn-icon-button
vn-click-stop="$ctrl.preview(travel)"
vn-tooltip="Preview"