2823-e2e_travel_create #562

Merged
carlosjr merged 5 commits from 2823-e2e_travel_create into dev 2021-03-05 12:43:07 +00:00
3 changed files with 85 additions and 0 deletions
Showing only changes of commit 1e6292ed13 - Show all commits

View File

@ -855,6 +855,14 @@ export default {
anySearchResult: 'vn-travel-index vn-tbody > a',
firstSearchResult: 'vn-travel-index vn-tbody > a:nth-child(1)',
firstTravelAddEntryButton: 'vn-travel-index a:nth-child(1) vn-icon[icon="icon-ticket"]',
newTravelButton: 'vn-travel-index button vn-icon[icon="add"]',
reference: 'vn-travel-create vn-textfield[ng-model="$ctrl.travel.ref"]',
agency: 'vn-travel-create vn-autocomplete[ng-model="$ctrl.travel.agencyModeFk"]',
shipDate: 'vn-travel-create vn-date-picker[ng-model="$ctrl.travel.shipped"]',
landingDate: 'vn-travel-create vn-date-picker[ng-model="$ctrl.travel.landed"]',
warehouseOut: 'vn-travel-create vn-autocomplete[ng-model="$ctrl.travel.warehouseOutFk"]',
warehouseIn: 'vn-travel-create vn-autocomplete[ng-model="$ctrl.travel.warehouseInFk"]',
save: 'vn-travel-create vn-submit > button'
},
travelExtraCommunity: {
anySearchResult: 'vn-travel-extra-community > vn-data-viewer div > vn-tbody > vn-tr',
@ -865,6 +873,7 @@ export default {
travelBasicData: {
reference: 'vn-travel-basic-data vn-textfield[ng-model="$ctrl.travel.ref"]',
agency: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.agencyModeFk"]',
shippedDate: 'vn-travel-basic-data vn-date-picker[ng-model="$ctrl.travel.shipped"]',
deliveryDate: 'vn-travel-basic-data vn-date-picker[ng-model="$ctrl.travel.landed"]',
outputWarehouse: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.warehouseOutFk"]',
inputWarehouse: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.warehouseInFk"]',

View File

@ -0,0 +1,76 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Travel create path', () => {
let browser;
let page;
const date = new Date();
const day = 15;
date.setDate(day);
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'travel');
});
afterAll(async() => {
await browser.close();
});
it('should open the create travel form by clicking on the "new" button', async() => {
await page.waitToClick(selectors.travelIndex.newTravelButton);
await page.waitForState('travel.create');
});
it('should fill the reference, agency and ship date then save the form', async() => {
await page.write(selectors.travelIndex.reference, 'Testing reference');
await page.autocompleteSearch(selectors.travelIndex.agency, 'inhouse pickup');
await page.pickDate(selectors.travelIndex.shipDate, date);
await page.waitToClick(selectors.travelIndex.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should check the user was redirected to the travel basic data upon creation', async() => {
await page.waitForState('travel.card.basicData');
});
it('should check the travel was created with the correct reference', async() => {
const reference = await page.waitToGetProperty(selectors.travelBasicData.reference, 'value');
expect(reference).toContain('Testing reference');
});
it('should check the travel was created with the correct agency', async() => {
const agency = await page.waitToGetProperty(selectors.travelBasicData.agency, 'value');
expect(agency).toContain('inhouse pickup');
});
it('should check the travel was created with the correct shiping date', async() => {
const shipDate = await page.waitToGetProperty(selectors.travelBasicData.shippedDate, 'value');
expect(shipDate).toContain(day);
});
it('should check the travel was created with the correct landing date', async() => {
const landingDate = await page.waitToGetProperty(selectors.travelBasicData.deliveryDate, 'value');
expect(landingDate).toContain(day);
});
it('should check the travel was created with the correct warehouseOut', async() => {
const warehouseOut = await page.waitToGetProperty(selectors.travelBasicData.outputWarehouse, 'value');
expect(warehouseOut).toContain('Warehouse One');
});
it('should check the travel was created with the correct warehouseIn', async() => {
const warehouseIn = await page.waitToGetProperty(selectors.travelBasicData.inputWarehouse, 'value');
expect(warehouseIn).toContain('Warehouse Five');
});
});