e2e path for travel descriptor
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-11-17 16:52:19 +01:00
parent a7c830d87a
commit 7dc8ae9dbc
3 changed files with 55 additions and 0 deletions

View File

@ -815,6 +815,10 @@ export default {
ticketOne: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(1)', ticketOne: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(1)',
ticketTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(2)' ticketTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(2)'
}, },
travelIndex: {
anySearchResult: 'vn-travel-index vn-tbody > a',
firstSearchResult: 'vn-travel-index vn-tbody > a:nth-child(1)'
},
travelBasicDada: { travelBasicDada: {
reference: 'vn-travel-basic-data vn-textfield[ng-model="$ctrl.travel.ref"]', reference: 'vn-travel-basic-data vn-textfield[ng-model="$ctrl.travel.ref"]',
agency: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.agencyModeFk"]', agency: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.agencyModeFk"]',
@ -841,6 +845,11 @@ export default {
createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr', createdThermograph: 'vn-travel-thermograph-index vn-tbody > vn-tr',
upload: 'vn-travel-thermograph-create button[type=submit]' upload: 'vn-travel-thermograph-create button[type=submit]'
}, },
travelDescriptor: {
filterByAgencyButton: 'vn-descriptor-content .quicklinks > div:nth-child(1) > vn-quick-link > a[vn-tooltip="All travels with current agency"]',
dotMenu: 'vn-travel-descriptor vn-icon-button[icon="more_vert"]',
dotMenuClone: '#clone'
},
zoneIndex: { zoneIndex: {
searchResult: 'vn-zone-index a.vn-tr', searchResult: 'vn-zone-index a.vn-tr',
}, },

View File

@ -0,0 +1,45 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Travel descriptor path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'travel');
await page.accessToSearchResult('3');
await page.waitForState('travel.card.summary');
});
afterAll(async() => {
await browser.close();
});
it('should click the descriptor button to navigate to the travel index showing all travels with current agency', async() => {
await page.waitToClick(selectors.travelDescriptor.filterByAgencyButton);
await page.waitForState('travel.index');
const result = await page.countElement(selectors.travelIndex.anySearchResult);
expect(result).toEqual(8);
});
it('should navigate to the first search result', async() => {
await page.waitToClick(selectors.travelIndex.firstSearchResult);
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);
await page.respondToDialog('accept');
await page.waitForState('travel.create');
const state = await page.getState();
expect(state).toBe('travel.create');
});
});

View File

@ -5,6 +5,7 @@
<vn-menu vn-id="menu"> <vn-menu vn-id="menu">
<vn-list> <vn-list>
<vn-item <vn-item
id="clone"
ng-click="clone.show()" ng-click="clone.show()"
translate> translate>
Clone travel Clone travel