refactor on all e2e paths plus addresses path test for EQtax propagation

This commit is contained in:
Carlos Jimenez 2017-12-14 14:56:20 +01:00
parent 59061927c6
commit 3bffedf86d
7 changed files with 132 additions and 70 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-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"]`,
@ -97,7 +97,9 @@ export default {
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',
firstEditButton: `${components.vnIconButton}[icon='edit']`,
secondEditButton: `vn-horizontal:nth-child(3) > vn-one > vn-horizontal > a > ${components.vnIconButton}[icon='edit']`,
activeCheckboxLabel: `${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)
@ -367,35 +427,35 @@ describe('Edit fiscalData path', () => {
.catch(catchErrors(done));
});
it('should check the invoice by address checkbox', done => {
nightmare
.waitToClick(selectors.fiscalData.invoiceByAddressCheckboxInput)
.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 check the invoice by address checkbox', done => {
// nightmare
// .waitToClick(selectors.fiscalData.invoiceByAddressCheckboxInput)
// .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 invoice by address checkbox is checked', done => {
nightmare
.waitForSnackbarReset()
.waitToClick(selectors.basicData.basicDataButton)
.wait(selectors.basicData.nameInput)
.waitToClick(selectors.fiscalData.fiscalDataButton)
.wait(selectors.fiscalData.invoiceByAddressCheckboxInput)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.fiscalData.invoiceByAddressCheckboxInput)
.then(value => {
expect(value).toBeTruthy();
done();
})
.catch(catchErrors(done));
});
// it('should confirm invoice by address checkbox is checked', done => {
// nightmare
// .waitForSnackbarReset()
// .waitToClick(selectors.basicData.basicDataButton)
// .wait(selectors.basicData.nameInput)
// .waitToClick(selectors.fiscalData.fiscalDataButton)
// .wait(selectors.fiscalData.invoiceByAddressCheckboxInput)
// .evaluate(selector => {
// return document.querySelector(selector).checked;
// }, selectors.fiscalData.invoiceByAddressCheckboxInput)
// .then(value => {
// expect(value).toBeTruthy();
// done();
// })
// .catch(catchErrors(done));
// });
it('should check the Verified data checkbox', done => {
nightmare