231801_test_to_master #1519

Merged
alexm merged 490 commits from 231801_test_to_master into master 2023-05-12 06:29:59 +00:00
3 changed files with 37 additions and 60 deletions
Showing only changes of commit ea5b032b40 - Show all commits

View File

@ -1,12 +1,9 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
describe('Travel create path', () => { fdescribe('Travel create path', () => {
let browser; let browser;
let page; let page;
const date = Date.vnNew();
const day = 15;
date.setDate(day);
beforeAll(async() => { beforeAll(async() => {
browser = await getBrowser(); browser = await getBrowser();
@ -18,60 +15,28 @@ describe('Travel create path', () => {
await browser.close(); await browser.close();
}); });
it('should open the create travel form by clicking on the "new" button', async() => { it('should create a new travel and check it was created with the correct data', async() => {
const date = Date.vnNew();
date.setDate(15);
date.setUTCHours(0, 0, 0, 0);
await page.waitToClick(selectors.travelIndex.newTravelButton); await page.waitToClick(selectors.travelIndex.newTravelButton);
await page.waitForState('travel.create'); await page.waitForState('travel.create');
});
it('should fill the reference, agency and ship date then save the form', async() => { const values = {
await page.write(selectors.travelIndex.reference, 'Testing reference'); reference: 'Testing reference',
await page.autocompleteSearch(selectors.travelIndex.agency, 'inhouse pickup'); agencyMode: 'inhouse pickup',
await page.pickDate(selectors.travelIndex.shipDate, date); // this line autocompletes another 3 fields shipped: date,
await page.waitForTimeout(1000); landed: date,
await page.waitToClick(selectors.travelIndex.save); warehouseOut: 'Warehouse One',
warehouseIn: 'Warehouse Five'
};
const message = await page.waitForSnackbar(); const message = await page.sendForm('vn-travel-create form', values);
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'); await page.waitForState('travel.card.basicData');
}); const formValues = await page.fetchForm('vn-travel-basic-data form', Object.keys(values));
it('should check the travel was created with the correct reference', async() => { expect(message.isSuccess).toBeTrue();
const reference = await page.waitToGetProperty(selectors.travelBasicData.reference, 'value'); expect(formValues).toEqual(values);
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');
}); });
}); });

View File

@ -17,7 +17,8 @@
<vn-textfield <vn-textfield
vn-one vn-one
label="Reference" label="Reference"
ng-model="$ctrl.travel.ref"> ng-model="$ctrl.travel.ref"
vn-name="reference">
</vn-textfield> </vn-textfield>
<vn-autocomplete <vn-autocomplete
vn-one vn-one
@ -25,25 +26,29 @@
url="AgencyModes" url="AgencyModes"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Agency"> label="Agency"
vn-name="agencyMode">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-date-picker <vn-date-picker
vn-one vn-one
label="Shipped" label="Shipped"
ng-model="$ctrl.travel.shipped"> ng-model="$ctrl.travel.shipped"
vn-name="shipped">
</vn-date-picker> </vn-date-picker>
<vn-date-picker <vn-date-picker
vn-one vn-one
label="Landed" label="Landed"
ng-model="$ctrl.travel.landed"> ng-model="$ctrl.travel.landed"
vn-name="landed">
</vn-date-picker> </vn-date-picker>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="$ctrl.travel.warehouseOutFk" ng-model="$ctrl.travel.warehouseOutFk"
vn-name="warehouseOut"
data="warehouses" data="warehouses"
show-field="name" show-field="name"
value-field="id" value-field="id"
@ -52,6 +57,7 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="$ctrl.travel.warehouseInFk" ng-model="$ctrl.travel.warehouseInFk"
vn-name="warehouseIn"
data="warehouses" data="warehouses"
show-field="name" show-field="name"
value-field="id" value-field="id"

View File

@ -10,11 +10,13 @@
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield
label="Reference" label="Reference"
ng-model="$ctrl.travel.ref"> ng-model="$ctrl.travel.ref"
vn-name="reference">
</vn-textfield> </vn-textfield>
<vn-autocomplete <vn-autocomplete
label="Agency" label="Agency"
ng-model="$ctrl.travel.agencyModeFk" ng-model="$ctrl.travel.agencyModeFk"
vn-name="agencyMode"
url="AgencyModes"> url="AgencyModes">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
@ -22,22 +24,26 @@
<vn-date-picker <vn-date-picker
on-change="$ctrl.onShippedChange(value)" on-change="$ctrl.onShippedChange(value)"
label="Shipped" label="Shipped"
ng-model="$ctrl.travel.shipped"> ng-model="$ctrl.travel.shipped"
vn-name="shipped">
</vn-date-picker> </vn-date-picker>
<vn-date-picker <vn-date-picker
label="Landed" label="Landed"
ng-model="$ctrl.travel.landed"> ng-model="$ctrl.travel.landed"
vn-name="landed">
</vn-date-picker> </vn-date-picker>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete <vn-autocomplete
label="Warehouse Out" label="Warehouse Out"
ng-model="$ctrl.travel.warehouseOutFk" ng-model="$ctrl.travel.warehouseOutFk"
vn-name="warehouseOut"
url="Warehouses"> url="Warehouses">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete <vn-autocomplete
label="Warehouse In" label="Warehouse In"
ng-model="$ctrl.travel.warehouseInFk" ng-model="$ctrl.travel.warehouseInFk"
vn-name="warehouseIn"
url="Warehouses"> url="Warehouses">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>