refs #5517 Travel create E2E fixes
This commit is contained in:
parent
805e678ca7
commit
ea5b032b40
|
@ -1,12 +1,9 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Travel create path', () => {
|
||||
fdescribe('Travel create path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
const date = Date.vnNew();
|
||||
const day = 15;
|
||||
date.setDate(day);
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
|
@ -18,60 +15,28 @@ describe('Travel create path', () => {
|
|||
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.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); // this line autocompletes another 3 fields
|
||||
await page.waitForTimeout(1000);
|
||||
await page.waitToClick(selectors.travelIndex.save);
|
||||
const values = {
|
||||
reference: 'Testing reference',
|
||||
agencyMode: 'inhouse pickup',
|
||||
shipped: date,
|
||||
landed: date,
|
||||
warehouseOut: 'Warehouse One',
|
||||
warehouseIn: 'Warehouse Five'
|
||||
};
|
||||
|
||||
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() => {
|
||||
const message = await page.sendForm('vn-travel-create form', values);
|
||||
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() => {
|
||||
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');
|
||||
expect(message.isSuccess).toBeTrue();
|
||||
expect(formValues).toEqual(values);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
<vn-textfield
|
||||
vn-one
|
||||
label="Reference"
|
||||
ng-model="$ctrl.travel.ref">
|
||||
ng-model="$ctrl.travel.ref"
|
||||
vn-name="reference">
|
||||
</vn-textfield>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
|
@ -25,25 +26,29 @@
|
|||
url="AgencyModes"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Agency">
|
||||
label="Agency"
|
||||
vn-name="agencyMode">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Shipped"
|
||||
ng-model="$ctrl.travel.shipped">
|
||||
ng-model="$ctrl.travel.shipped"
|
||||
vn-name="shipped">
|
||||
</vn-date-picker>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Landed"
|
||||
ng-model="$ctrl.travel.landed">
|
||||
ng-model="$ctrl.travel.landed"
|
||||
vn-name="landed">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.travel.warehouseOutFk"
|
||||
vn-name="warehouseOut"
|
||||
data="warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
|
@ -52,6 +57,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.travel.warehouseInFk"
|
||||
vn-name="warehouseIn"
|
||||
data="warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
|
|
|
@ -10,11 +10,13 @@
|
|||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
label="Reference"
|
||||
ng-model="$ctrl.travel.ref">
|
||||
ng-model="$ctrl.travel.ref"
|
||||
vn-name="reference">
|
||||
</vn-textfield>
|
||||
<vn-autocomplete
|
||||
label="Agency"
|
||||
ng-model="$ctrl.travel.agencyModeFk"
|
||||
vn-name="agencyMode"
|
||||
url="AgencyModes">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
|
@ -22,22 +24,26 @@
|
|||
<vn-date-picker
|
||||
on-change="$ctrl.onShippedChange(value)"
|
||||
label="Shipped"
|
||||
ng-model="$ctrl.travel.shipped">
|
||||
ng-model="$ctrl.travel.shipped"
|
||||
vn-name="shipped">
|
||||
</vn-date-picker>
|
||||
<vn-date-picker
|
||||
label="Landed"
|
||||
ng-model="$ctrl.travel.landed">
|
||||
ng-model="$ctrl.travel.landed"
|
||||
vn-name="landed">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
label="Warehouse Out"
|
||||
ng-model="$ctrl.travel.warehouseOutFk"
|
||||
vn-name="warehouseOut"
|
||||
url="Warehouses">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
label="Warehouse In"
|
||||
ng-model="$ctrl.travel.warehouseInFk"
|
||||
vn-name="warehouseIn"
|
||||
url="Warehouses">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
|
|
Loading…
Reference in New Issue