Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
Daniel Herrero 2017-12-14 15:09:46 +01:00
commit c04020d0e7
7 changed files with 109 additions and 47 deletions

View File

@ -12,7 +12,7 @@
<vn-horizontal>
<vn-textfield autofocus vn-two label="Social name" field="$ctrl.client.socialName" vn-acl="administrative"></vn-textfield>
<vn-textfield vn-one label="Tax number" field="$ctrl.client.fi" vn-acl="administrative"></vn-textfield>
<vn-check vn-one label="Equalization tax" field="$ctrl.client.isEqualizated" vn-acl="administrative"></vn-check>
<vn-check vn-one label="Is equalizated" field="$ctrl.client.isEqualizated" vn-acl="administrative"></vn-check>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-two label="Street" field="$ctrl.client.street" vn-focus vn-acl="administrative"></vn-textfield>

View File

@ -53,8 +53,8 @@ export default {
fiscalDataButton: `${components.vnMenuItem}[ui-sref="clientCard.fiscalData"]`,
socialNameInput: `${components.vnTextfield}[name="socialName"]`,
fiscalIdInput: `${components.vnTextfield}[name="fi"]`,
equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Equalization tax'] > label`,
cancelPropagationButton: `body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > vn-dialog > div > form > div.button-bar > tpl-buttons > button:nth-child(1)`,
equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Is equalizated'] > label > input`,
acceptPropagationButton: `body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > vn-dialog > div > form > div.button-bar > tpl-buttons > button:nth-child(2)`,
addressInput: `${components.vnTextfield}[name="street"]`,
cityInput: `${components.vnTextfield}[name="city"]`,
postcodeInput: `${components.vnTextfield}[name="postcode"]`,
@ -77,7 +77,7 @@ export default {
payMethodOptionOne: `${components.vnAutocomplete}[field="$ctrl.client.payMethodFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`,
IBANInput: `${components.vnTextfield}[name="iban"]`,
dueDayInput: `${components.vnTextfield}[name="dueDay"]`,
cancelNotificationButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-one > vn-vertical > vn-client-billing-data > vn-dialog > div > form > div.button-bar > tpl-buttons > button:nth-child(1)',
cancelNotificationButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-billing-data > vn-dialog > div > form > div.button-bar > tpl-buttons > button:nth-child(1)',
saveButton: `${components.vnSubmit}`
},
addresses: {
@ -94,10 +94,12 @@ export default {
agenctySecondOption: `${components.vnAutocomplete}[field="$ctrl.address.agencyFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`,
phoneInput: `${components.vnTextfield}[name="phone"]`,
mobileInput: `${components.vnTextfield}[name="mobile"]`,
defaultAddress: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-addresses > vn-vertical > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-one > vn-horizontal > vn-one > div:nth-child(2)',
secondMakeDefaultStar: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-addresses > vn-vertical > vn-card > div > vn-vertical > vn-horizontal:nth-child(3) > vn-one > vn-horizontal > vn-none > i',
defaultAddress: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-addresses > vn-vertical > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-one > vn-horizontal > vn-one > div:nth-child(2)',
secondMakeDefaultStar: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-addresses > vn-vertical > vn-card > div > vn-vertical > vn-horizontal:nth-child(3) > vn-one > vn-horizontal > vn-none > i',
firstEditButton: `${components.vnIconButton}[icon='edit']`,
activeCheckboxLabel: `${components.vnCheck}[label='Enabled'] > label > input`,
secondEditButton: `vn-horizontal:nth-child(3) > vn-one > vn-horizontal > a > ${components.vnIconButton}[icon='edit']`,
activeCheckbox: `${components.vnCheck}[label='Enabled'] > label > input`,
equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Is equalizated'] > label > input`,
saveButton: `${components.vnSubmit}`
}
};

View File

@ -70,10 +70,55 @@ describe('Edit fiscalData path', () => {
.catch(catchErrors(done));
});
it(`should click on the search result to access to the client's fiscal data`, done => {
describe('Confirm all addresses have EQtax for future propagation test', () => {
it(`should click on the search result to access to the client's addresses`, done => {
nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.addresses.addressesButton)
.waitForURL('/addresses/list')
.url()
.then(url => {
expect(url).toContain('/addresses/list');
done();
})
.catch(catchErrors(done));
});
it(`should click on the 1st edit icon to check EQtax is checked`, done => {
nightmare
.waitToClick(selectors.addresses.firstEditButton)
.wait(selectors.addresses.equalizationTaxCheckboxLabel)
.wait(200)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.addresses.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeTruthy();
done();
})
.catch(catchErrors(done));
});
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, done => {
nightmare
.waitToClick(selectors.addresses.addressesButton)
.waitToClick(selectors.addresses.secondEditButton)
.wait(selectors.addresses.equalizationTaxCheckboxLabel)
.wait(200)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.addresses.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeTruthy();
done();
})
.catch(catchErrors(done));
});
});
it(`should click on the fiscal data button to start editing`, done => {
nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.fiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.url()
@ -157,10 +202,9 @@ describe('Edit fiscalData path', () => {
.catch(catchErrors(done));
});
// there should be a test to confirm propagation on addresses view once equalization tax propagation is shown on each address
it('should not propagate the Equalization tax', done => {
it('should propagate the Equalization tax', done => {
nightmare
.waitToClick(selectors.fiscalData.cancelPropagationButton)
.waitToClick(selectors.fiscalData.acceptPropagationButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
@ -187,11 +231,57 @@ describe('Edit fiscalData path', () => {
.catch(catchErrors(done));
});
it('should edit the address', done => {
describe('Confirm all addresses havent got EQtax as uncheck was propagated', () => {
it(`should click on the addresses button to access to the client's addresses`, done => {
nightmare
.waitToClick(selectors.addresses.addressesButton)
.waitForURL('/addresses/list')
.url()
.then(url => {
expect(url).toContain('/addresses/list');
done();
})
.catch(catchErrors(done));
});
it(`should click on the 1st edit icon to check EQtax is unchecked`, done => {
nightmare
.waitToClick(selectors.addresses.firstEditButton)
.wait(selectors.addresses.equalizationTaxCheckboxLabel)
.wait(200)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.addresses.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
done();
})
.catch(catchErrors(done));
});
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, done => {
nightmare
.waitToClick(selectors.addresses.addressesButton)
.waitToClick(selectors.addresses.secondEditButton)
.wait(selectors.addresses.equalizationTaxCheckboxLabel)
.wait(200)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.addresses.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
done();
})
.catch(catchErrors(done));
});
});
it('should go to fiscal data then edit the address', done => {
nightmare
.waitToClick(selectors.fiscalData.fiscalDataButton)
.wait(selectors.fiscalData.addressInput)
.clearInput(selectors.fiscalData.addressInput)
.type(selectors.fiscalData.addressInput, 'Somewhere in New York edited')
.type(selectors.fiscalData.addressInput, 'Somewhere edited')
.click(selectors.fiscalData.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
@ -211,7 +301,7 @@ describe('Edit fiscalData path', () => {
.wait(selectors.fiscalData.addressInput)
.getInputValue(selectors.fiscalData.addressInput)
.then(result => {
expect(result).toEqual('Somewhere in New York edited');
expect(result).toEqual('Somewhere edited');
done();
})
.catch(catchErrors(done));
@ -307,36 +397,6 @@ describe('Edit fiscalData path', () => {
.catch(catchErrors(done));
});
it(`should edit the country`, done => {
nightmare
.waitToClick(selectors.fiscalData.countryInput)
.waitToClick(selectors.fiscalData.countryThirdOption)
.wait(200)
.waitToClick(selectors.fiscalData.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toEqual('Data saved!');
done();
})
.catch(catchErrors(done));
});
it(`should confirm the country have been selected`, done => {
nightmare
.waitForSnackbarReset()
.click(selectors.basicData.basicDataButton)
.wait(selectors.basicData.nameInput)
.click(selectors.fiscalData.fiscalDataButton)
.wait(200)
.getInputValue(selectors.fiscalData.countryInput)
.then(result => {
expect(result).toEqual('Holanda');
done();
})
.catch(catchErrors(done));
});
it('should uncheck the active checkbox', done => {
nightmare
.waitToClick(selectors.fiscalData.activeCheckboxLabel)

View File

@ -288,7 +288,7 @@ describe('Edit addresses path', () => {
it(`should click on the active checkbox and receive an error to save it becouse it is the default address`, done => {
nightmare
.waitForSnackbarReset()
.waitToClick(selectors.addresses.activeCheckboxLabel)
.waitToClick(selectors.addresses.activeCheckbox)
.waitToClick(selectors.addresses.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)