2823-e2e_travel_create #562
|
@ -855,6 +855,14 @@ export default {
|
||||||
anySearchResult: 'vn-travel-index vn-tbody > a',
|
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"]',
|
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: {
|
travelExtraCommunity: {
|
||||||
anySearchResult: 'vn-travel-extra-community > vn-data-viewer div > vn-tbody > vn-tr',
|
anySearchResult: 'vn-travel-extra-community > vn-data-viewer div > vn-tbody > vn-tr',
|
||||||
|
@ -865,6 +873,7 @@ export default {
|
||||||
travelBasicData: {
|
travelBasicData: {
|
||||||
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"]',
|
||||||
|
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"]',
|
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"]',
|
outputWarehouse: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.warehouseOutFk"]',
|
||||||
inputWarehouse: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.warehouseInFk"]',
|
inputWarehouse: 'vn-travel-basic-data vn-autocomplete[ng-model="$ctrl.travel.warehouseInFk"]',
|
||||||
|
|
|
@ -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');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue