This commit is contained in:
Juan 2018-11-02 13:54:08 +01:00
commit c3401a3d9a
9 changed files with 4320 additions and 4386 deletions

View File

@ -3,7 +3,7 @@
.icon-volume:before { content: '\e801'; } /* '' */ .icon-volume:before { content: '\e801'; } /* '' */
.icon-barcode:before { content: '\e802'; } /* '' */ .icon-barcode:before { content: '\e802'; } /* '' */
.icon-bucket:before { content: '\e803'; } /* '' */ .icon-bucket:before { content: '\e803'; } /* '' */
.icon-accessory:before { content: '\e804'; } /* '' */ .icon-accesory:before { content: '\e804'; } /* '' */
.icon-dfiscales:before { content: '\e805'; } /* '' */ .icon-dfiscales:before { content: '\e805'; } /* '' */
.icon-doc:before { content: '\e806'; } /* '' */ .icon-doc:before { content: '\e806'; } /* '' */
.icon-eye:before { content: '\e807'; } /* '' */ .icon-eye:before { content: '\e807'; } /* '' */
@ -15,6 +15,8 @@
.icon-frozen-1:before { content: '\e80d'; } /* '' */ .icon-frozen-1:before { content: '\e80d'; } /* '' */
.icon-actions:before { content: '\e80e'; } /* '' */ .icon-actions:before { content: '\e80e'; } /* '' */
.icon-details:before { content: '\e80f'; } /* '' */ .icon-details:before { content: '\e80f'; } /* '' */
.icon-delivery:before { content: '\e810'; } /* '' */
.icon-solclaim:before { content: '\e811'; } /* '' */
.icon-noweb:before { content: '\e812'; } /* '' */ .icon-noweb:before { content: '\e812'; } /* '' */
.icon-payment:before { content: '\e813'; } /* '' */ .icon-payment:before { content: '\e813'; } /* '' */
.icon-recovery:before { content: '\e815'; } /* '' */ .icon-recovery:before { content: '\e815'; } /* '' */
@ -37,7 +39,7 @@
.icon-entry:before { content: '\e829'; } /* '' */ .icon-entry:before { content: '\e829'; } /* '' */
.icon-traceability:before { content: '\e82a'; } /* '' */ .icon-traceability:before { content: '\e82a'; } /* '' */
.icon-transaction:before { content: '\e82b'; } /* '' */ .icon-transaction:before { content: '\e82b'; } /* '' */
.icon-greenery:before { content: '\e82c'; } /* '' */ .icon-verde:before { content: '\e82c'; } /* '' */
.icon-regentry:before { content: '\e82d'; } /* '' */ .icon-regentry:before { content: '\e82d'; } /* '' */
.icon-plant:before { content: '\e82e'; } /* '' */ .icon-plant:before { content: '\e82e'; } /* '' */
.icon-artificial:before { content: '\e82f'; } /* '' */ .icon-artificial:before { content: '\e82f'; } /* '' */

View File

@ -6,409 +6,356 @@ describe('Client Edit fiscalData path', () => {
describe('as employee', () => { describe('as employee', () => {
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Clients button of the top bar menu', done => { it('should click on the Clients button of the top bar menu', async () => {
return nightmare const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton) .waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.parsedUrl() .parsedUrl();
.then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
}); });
it('should search for the user Bruce Banner', done => { it('should search for the user Bruce Banner', async () => {
return nightmare const resultCount = await nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.click(selectors.clientsIndex.searchButton) .click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult);
.then(result => {
expect(result).toEqual(1); expect(resultCount).toEqual(1);
done();
}).catch(done.fail);
}); });
// Confirms all addresses have EQtax false for future propagation test step 1 // Confirms all addresses have EQtax false for future propagation test step 1
it(`should click on the search result to access to the client's addresses`, () => { it(`should click on the search result to access to the client's addresses`, async () => {
return nightmare const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index') .waitForURL('/address/index')
.url() .url();
.then(url => {
expect(url).toContain('/address/index'); expect(url).toContain('/address/index');
});
}); });
// Confirms all addresses have EQtax false for future propagation test step 2 // Confirms all addresses have EQtax false for future propagation test step 2
it(`should click on the 1st edit icon to check EQtax isnt checked`, () => { it(`should click on the 1st edit icon to check EQtax isnt checked`, async () => {
return nightmare const result = await nightmare
.waitToClick(selectors.clientAddresses.firstEditButton) .waitToClick(selectors.clientAddresses.firstEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientAddresses.equalizationTaxCheckboxLabel) }, selectors.clientAddresses.equalizationTaxCheckboxLabel);
.then(value => {
expect(value).toBeFalsy(); expect(result).toBeFalsy();
});
}); });
// Confirms all addresses have EQtax false for future propagation test step 3 // Confirms all addresses have EQtax false for future propagation test step 3
it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, () => { it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, async () => {
return nightmare const result = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
.waitToClick(selectors.clientAddresses.secondEditButton) .waitToClick(selectors.clientAddresses.secondEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientAddresses.equalizationTaxCheckboxLabel) }, selectors.clientAddresses.equalizationTaxCheckboxLabel);
.then(value => {
expect(value).toBeFalsy(); expect(result).toBeFalsy();
});
}); });
it(`should click on the fiscal data button`, () => { it(`should click on the fiscal data button`, async () => {
return nightmare const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data') .waitForURL('fiscal-data')
.url() .url();
.then(url => {
expect(url).toContain('fiscal-data'); expect(url).toContain('fiscal-data');
});
}); });
it('should not be able to edit the verified data checkbox', done => { it('should not be able to edit the verified data checkbox', async () => {
return nightmare const result = await nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).disabled; return document.querySelector(selector).disabled;
}, selectors.clientFiscalData.verifiedDataCheckboxInput) }, selectors.clientFiscalData.verifiedDataCheckboxInput);
.then(value => {
expect(value).toBeTruthy(); expect(result).toBeTruthy();
done();
}).catch(done.fail);
}); });
}); });
describe('as administrative', () => { describe('as administrative', () => {
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('administrative'); .waitForLogin('administrative');
}); });
it('should now click on the Clients button of the top bar menu', done => { it('should now click on the Clients button of the top bar menu', async () => {
return nightmare const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton) .waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.parsedUrl() .parsedUrl();
.then(url => {
expect(url.hash).toEqual('#!/client/index'); expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
}); });
it('should now search for the user Bruce Banner', done => { it('should now search for the user Bruce Banner', async () => {
return nightmare const resultCount = await nightmare
.wait(selectors.clientsIndex.searchResult) .wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.click(selectors.clientsIndex.searchButton) .click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult) .countElement(selectors.clientsIndex.searchResult);
.then(result => {
expect(result).toEqual(1); expect(resultCount).toEqual(1);
done();
}).catch(done.fail);
}); });
it(`should access to the client fiscal data`, () => { it(`should access to the client fiscal data`, async () => {
return nightmare const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data') .waitForURL('fiscal-data')
.url() .url();
.then(url => {
expect(url).toContain('fiscal-data'); expect(url).toContain('fiscal-data');
});
}); });
it('should edit the clients fiscal data', done => { it('should edit the clients fiscal data', async () => {
return nightmare const result = await nightmare
.wait(selectors.clientFiscalData.socialNameInput) .wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput) .clearInput(selectors.clientFiscalData.socialNameInput)
.type(selectors.clientFiscalData.socialNameInput, 'SMASH!') .type(selectors.clientFiscalData.socialNameInput, 'SMASH!')
.waitForTextInInput(selectors.clientFiscalData.socialNameInput, 'SMASH!') .waitForTextInInput(selectors.clientFiscalData.socialNameInput, 'SMASH!')
.clearInput(selectors.clientFiscalData.fiscalIdInput) .clearInput(selectors.clientFiscalData.fiscalIdInput)
.type(selectors.clientFiscalData.fiscalIdInput, '94980061C') .type(selectors.clientFiscalData.fiscalIdInput, '94980061C')
.clearInput(selectors.clientFiscalData.addressInput) .clearInput(selectors.clientFiscalData.addressInput)
.type(selectors.clientFiscalData.addressInput, 'Somewhere edited') .type(selectors.clientFiscalData.addressInput, 'Somewhere edited')
.clearInput(selectors.clientFiscalData.postcodeInput) .clearInput(selectors.clientFiscalData.postcodeInput)
.type(selectors.clientFiscalData.postcodeInput, '12345') .type(selectors.clientFiscalData.postcodeInput, '12345')
.clearInput(selectors.clientFiscalData.cityInput) .clearInput(selectors.clientFiscalData.cityInput)
.type(selectors.clientFiscalData.cityInput, 'N/A') .type(selectors.clientFiscalData.cityInput, 'N/A')
.waitToClick(selectors.clientFiscalData.countryInput) .waitToClick(selectors.clientFiscalData.countryInput)
.waitToClick(selectors.clientFiscalData.countryThirdOption) .waitToClick(selectors.clientFiscalData.countryThirdOption)
.waitToClick(selectors.clientFiscalData.provinceInput) .waitToClick(selectors.clientFiscalData.provinceInput)
.waitToClick(selectors.clientFiscalData.provinceFifthOption) .waitToClick(selectors.clientFiscalData.provinceFifthOption)
.waitToClick(selectors.clientFiscalData.activeCheckboxLabel) .waitToClick(selectors.clientFiscalData.activeCheckboxLabel)
.waitToClick(selectors.clientFiscalData.frozenCheckboxLabel) .waitToClick(selectors.clientFiscalData.frozenCheckboxLabel)
.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel) .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
.waitToClick(selectors.clientFiscalData.viesCheckboxInput) .waitToClick(selectors.clientFiscalData.viesCheckboxInput)
.waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel) .waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel)
.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput) .waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel) .waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel)
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
.click(selectors.clientFiscalData.saveButton) .click(selectors.clientFiscalData.saveButton)
.waitForLastSnackbar() .waitForLastSnackbar();
.then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
}); });
it('should propagate the Equalization tax', done => { it('should propagate the Equalization tax', async () => {
return nightmare const result = await nightmare
.waitToClick(selectors.clientFiscalData.acceptPropagationButton) .waitToClick(selectors.clientFiscalData.acceptPropagationButton)
.waitForLastSnackbar() .waitForLastSnackbar();
.then(result => {
expect(result).toEqual('Equivalent tax spreaded'); expect(result).toEqual('Equivalent tax spreaded');
done();
}).catch(done.fail);
}); });
// confirm all addresses have now EQtax checked step 1 // confirm all addresses have now EQtax checked step 1
it(`should click on the addresses button to access to the client's addresses`, () => { it(`should click on the addresses button to access to the client's addresses`, async () => {
return nightmare const url = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index') .waitForURL('/address/index')
.url() .url();
.then(url => {
expect(url).toContain('/address/index'); expect(url).toContain('/address/index');
});
}); });
// confirm all addresses have now EQtax checked step 2 // confirm all addresses have now EQtax checked step 2
it(`should click on the 1st edit icon to confirm EQtax is checked`, () => { it(`should click on the 1st edit icon to confirm EQtax is checked`, async () => {
return nightmare const result = await nightmare
.waitToClick(selectors.clientAddresses.firstEditButton) .waitToClick(selectors.clientAddresses.firstEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientAddresses.equalizationTaxCheckboxLabel) }, selectors.clientAddresses.equalizationTaxCheckboxLabel);
.then(value => {
expect(value).toBeTruthy(); expect(result).toBeTruthy();
});
}); });
// confirm all addresses have now EQtax checked step 3 // confirm all addresses have now EQtax checked step 3
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, () => { it(`should go back to addresses then select the second one and confirm the EQtax is checked`, async () => {
return nightmare const result = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
.waitToClick(selectors.clientAddresses.secondEditButton) .waitToClick(selectors.clientAddresses.secondEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientAddresses.equalizationTaxCheckboxLabel) }, selectors.clientAddresses.equalizationTaxCheckboxLabel);
.then(value => {
expect(value).toBeTruthy(); expect(result).toBeTruthy();
});
}); });
it('should navigate back to fiscal data to confirm its name have been edited', done => { it('should navigate back to fiscal data to confirm its name have been edited', async () => {
return nightmare const result = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.socialNameInput) .wait(selectors.clientFiscalData.socialNameInput)
.getInputValue(selectors.clientFiscalData.socialNameInput) .getInputValue(selectors.clientFiscalData.socialNameInput);
.then(result => {
expect(result).toEqual('SMASH!'); expect(result).toEqual('SMASH!');
done();
}).catch(done.fail);
}); });
it('should confirm the fiscal id have been edited', done => { it('should confirm the fiscal id have been edited', async () => {
return nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.fiscalIdInput) .getInputValue(selectors.clientFiscalData.fiscalIdInput);
.then(result => {
expect(result).toEqual('94980061C'); expect(result).toEqual('94980061C');
done();
}).catch(done.fail);
}); });
it('should confirm the address have been edited', done => { it('should confirm the address have been edited', async () => {
return nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.addressInput) .getInputValue(selectors.clientFiscalData.addressInput);
.then(result => {
expect(result).toEqual('Somewhere edited'); expect(result).toEqual('Somewhere edited');
done();
}).catch(done.fail);
}); });
it('should confirm the postcode have been edited', done => { it('should confirm the postcode have been edited', async () => {
return nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.postcodeInput) .getInputValue(selectors.clientFiscalData.postcodeInput);
.then(result => {
expect(result).toEqual('12345'); expect(result).toEqual('12345');
done();
}).catch(done.fail);
}); });
it('should confirm the city have been edited', done => { it('should confirm the city have been edited', async () => {
return nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.cityInput) .getInputValue(selectors.clientFiscalData.cityInput);
.then(result => {
expect(result).toEqual('N/A'); expect(result).toEqual('N/A');
done();
}).catch(done.fail);
}); });
it(`should confirm the country have been selected`, () => { it(`should confirm the country have been selected`, async () => {
return nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.countryInput) .getInputValue(selectors.clientFiscalData.countryInput);
.then(result => {
expect(result).toEqual('Francia'); expect(result).toEqual('Francia');
});
}); });
it(`should confirm the province have been selected`, () => { it(`should confirm the province have been selected`, async () => {
return nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.provinceInput) .getInputValue(selectors.clientFiscalData.provinceInput);
.then(result => {
expect(result).toEqual('Province two'); expect(result).toEqual('Province two');
});
}); });
it('should confirm active checkbox is unchecked', done => { it('should confirm active checkbox is unchecked', async () => {
return nightmare const result = await nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.activeCheckboxLabel) }, selectors.clientFiscalData.activeCheckboxLabel);
.then(value => {
expect(value).toBeFalsy(); expect(result).toBeFalsy();
done();
}).catch(done.fail);
}); });
it('should confirm frozen checkbox is unchecked', done => { it('should confirm frozen checkbox is unchecked', async () => {
return nightmare const result = await nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.frozenCheckboxLabel) }, selectors.clientFiscalData.frozenCheckboxLabel);
.then(value => {
expect(value).toBeFalsy(); expect(result).toBeFalsy();
done();
}).catch(done.fail);
}); });
it('should confirm Has to invoice checkbox is unchecked', done => { it('should confirm Has to invoice checkbox is unchecked', async () => {
return nightmare const result = await nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.hasToInvoiceCheckboxLabel) }, selectors.clientFiscalData.hasToInvoiceCheckboxLabel);
.then(value => {
expect(value).toBeFalsy(); expect(result).toBeFalsy();
done();
}).catch(done.fail);
}); });
it('should confirm Vies checkbox is checked', done => { it('should confirm Vies checkbox is checked', async () => {
return nightmare const result = await nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.viesCheckboxInput) }, selectors.clientFiscalData.viesCheckboxInput);
.then(value => {
expect(value).toBeTruthy(); expect(result).toBeTruthy();
done();
}).catch(done.fail);
}); });
it('should confirm Invoice by mail checkbox is unchecked', done => { it('should confirm Invoice by mail checkbox is unchecked', async () => {
return nightmare const result = await nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByMailCheckboxLabel) }, selectors.clientFiscalData.invoiceByMailCheckboxLabel);
.then(value => {
expect(value).toBeFalsy(); expect(result).toBeFalsy();
done();
}).catch(done.fail);
}); });
it('should confirm invoice by address checkbox is unchecked', done => { it('should confirm invoice by address checkbox is unchecked', async () => {
return nightmare const result = await nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput) }, selectors.clientFiscalData.invoiceByAddressCheckboxInput);
.then(value => {
expect(value).toBeFalsy(); expect(result).toBeFalsy();
done();
}).catch(done.fail);
}); });
it('should confirm Equalization tax checkbox is checked', done => { it('should confirm Equalization tax checkbox is checked', async () => {
return nightmare const result = await nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.equalizationTaxCheckboxLabel) }, selectors.clientFiscalData.equalizationTaxCheckboxLabel);
.then(value => {
expect(value).toBeTruthy(); expect(result).toBeTruthy();
done();
}).catch(done.fail);
}); });
it('should confirm Verified data checkbox is checked', done => { it('should confirm Verified data checkbox is checked', async () => {
return nightmare const result = await nightmare
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.verifiedDataCheckboxInput) }, selectors.clientFiscalData.verifiedDataCheckboxInput);
.then(value => {
expect(value).toBeTruthy(); expect(result).toBeTruthy();
done();
}).catch(done.fail);
}); });
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1 // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1
it(`should click on the addresses button to access to the client's addresses`, () => { it(`should click on the addresses button to access to the client's addresses`, async () => {
return nightmare const url = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index') .waitForURL('/address/index')
.url() .url();
.then(url => {
expect(url).toContain('/address/index'); expect(url).toContain('/address/index');
});
}); });
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2 // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, () => { it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async () => {
return nightmare const result = await nightmare
.waitToClick(selectors.clientAddresses.firstEditButton) .waitToClick(selectors.clientAddresses.firstEditButton)
.waitToClick(selectors.clientAddresses.equalizationTaxCheckboxLabel) .waitToClick(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.click(selectors.clientAddresses.saveButton) .click(selectors.clientAddresses.saveButton)
.waitForLastSnackbar() .waitForLastSnackbar()
.then(result => { .then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); });
}); });
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3 // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3
it('should navigate back to fiscal data to confirm invoice by address is now checked', done => { it('should navigate back to fiscal data to confirm invoice by address is now checked', async () => {
return nightmare const result = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.invoiceByAddressCheckboxInput) .wait(selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput) }, selectors.clientFiscalData.invoiceByAddressCheckboxInput);
.then(value => {
expect(value).toBeTruthy(); expect(result).toBeTruthy();
done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -1,214 +1,212 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare'; import createNightmare from '../../helpers/nightmare';
describe('Item', () => { describe('Item summary path', () => {
describe('Summary path', () => { const nightmare = createNightmare();
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
nightmare nightmare
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should access to the items index by clicking the items button', async () => { it('should access to the items index by clicking the items button', async () => {
const url = await nightmare const url = await nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl(); .parsedUrl();
expect(url.hash).toEqual('#!/item/index'); expect(url.hash).toEqual('#!/item/index');
}); });
it('should search for the item Gem of Time', async () => { it('should search for the item Gem of Time', async () => {
const result = await nightmare const result = await nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time') .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton) .click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult); .countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(1); expect(result).toEqual(1);
}); });
it(`should click on the search result summary button to open the item summary popup`, async () => { it(`should click on the search result summary button to open the item summary popup`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.isVisible(selectors.itemSummary.basicData) .isVisible(selectors.itemSummary.basicData)
.then((result) => { .then(result => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
return nightmare return nightmare
.waitToClick(selectors.itemsIndex.searchResultPreviewButton) .waitToClick(selectors.itemsIndex.searchResultPreviewButton)
.isVisible(selectors.itemSummary.basicData); .isVisible(selectors.itemSummary.basicData);
}); });
expect(result).toBeTruthy(); expect(result).toBeTruthy();
}); });
it(`should check the item summary preview shows fields from basic data`, async () => { it(`should check the item summary preview shows fields from basic data`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
.getInnerText(selectors.itemSummary.basicData); .getInnerText(selectors.itemSummary.basicData);
expect(result).toContain('Name: Gem of Time'); expect(result).toContain('Name: Gem of Time');
}); });
it(`should check the item summary preview shows fields from tags`, async () => { it(`should check the item summary preview shows fields from tags`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow') .waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow')
.getInnerText(selectors.itemSummary.tags); .getInnerText(selectors.itemSummary.tags);
expect(result).toContain('Color: Yellow'); expect(result).toContain('Color: Yellow');
}); });
it(`should check the item summary preview shows fields from niche`, async () => { it(`should check the item summary preview shows fields from niche`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1') .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1')
.getInnerText(selectors.itemSummary.niche); .getInnerText(selectors.itemSummary.niche);
expect(result).toContain('Warehouse One: A1'); expect(result).toContain('Warehouse One: A1');
}); });
it(`should check the item summary preview shows fields from botanical`, async () => { it(`should check the item summary preview shows fields from botanical`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix') .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix')
.getInnerText(selectors.itemSummary.botanical); .getInnerText(selectors.itemSummary.botanical);
expect(result).toContain('Botanical: Hedera helix'); expect(result).toContain('Botanical: Hedera helix');
}); });
it(`should check the item summary preview shows fields from barcode`, async () => { it(`should check the item summary preview shows fields from barcode`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.barcode, '1') .waitForTextInElement(selectors.itemSummary.barcode, '1')
.getInnerText(selectors.itemSummary.barcode); .getInnerText(selectors.itemSummary.barcode);
expect(result).toContain('1'); expect(result).toContain('1');
}); });
it(`should close the summary popup`, async () => { it(`should close the summary popup`, async () => {
const result = await nightmare const result = await nightmare
.waitToClick(selectors.itemsIndex.closeItemSummaryPreview) .waitToClick(selectors.itemsIndex.closeItemSummaryPreview)
.isVisible(selectors.itemSummary.basicData); .isVisible(selectors.itemSummary.basicData);
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); });
it('should search for the item Gem of Mind', async () => { it('should search for the item Gem of Mind', async () => {
const result = await nightmare const result = await nightmare
.clearInput('body > vn-app > vn-vertical > vn-vertical > ui-view > vn-item-index > div > div > vn-card:nth-child(1) > div > vn-searchbar > form > vn-horizontal > vn-textfield > div > div > div.infix > input') .clearInput('body > vn-app > vn-vertical > vn-vertical > ui-view > vn-item-index > div > div > vn-card:nth-child(1) > div > vn-searchbar > form > vn-horizontal > vn-textfield > div > div > div.infix > input')
.click(selectors.itemsIndex.searchButton) .click(selectors.itemsIndex.searchButton)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Mind') .type(selectors.itemsIndex.searchItemInput, 'Gem of Mind')
.click(selectors.itemsIndex.searchButton) .click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult); .countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(1); expect(result).toEqual(1);
}); });
it(`should now click on the search result summary button to open the item summary popup`, async () => { it(`should now click on the search result summary button to open the item summary popup`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind')
.isVisible(selectors.itemSummary.basicData) .isVisible(selectors.itemSummary.basicData)
.then((result) => { .then(result => {
expect(result).toBeFalsy(); expect(result).toBeFalsy();
return nightmare return nightmare
.waitToClick(selectors.itemsIndex.searchResultPreviewButton) .waitToClick(selectors.itemsIndex.searchResultPreviewButton)
.isVisible(selectors.itemSummary.basicData); .isVisible(selectors.itemSummary.basicData);
}); });
expect(result).toBeTruthy(); expect(result).toBeTruthy();
}); });
it(`should now check the item summary preview shows fields from basic data`, async () => { it(`should now check the item summary preview shows fields from basic data`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind') .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind')
.getInnerText(selectors.itemSummary.basicData); .getInnerText(selectors.itemSummary.basicData);
expect(result).toContain('Name: Gem of Mind'); expect(result).toContain('Name: Gem of Mind');
}); });
it(`should now check the item summary preview shows fields from tags`, async () => { it(`should now check the item summary preview shows fields from tags`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Red') .waitForTextInElement(selectors.itemSummary.tags, 'Color: Red')
.getInnerText(selectors.itemSummary.tags); .getInnerText(selectors.itemSummary.tags);
expect(result).toContain('Color: Red'); expect(result).toContain('Color: Red');
}); });
it(`should now check the item summary preview shows fields from niche`, async () => { it(`should now check the item summary preview shows fields from niche`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A4') .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A4')
.getInnerText(selectors.itemSummary.niche); .getInnerText(selectors.itemSummary.niche);
expect(result).toContain('Warehouse One: A4'); expect(result).toContain('Warehouse One: A4');
}); });
it(`should now check the item summary preview shows fields from botanical`, async () => { it(`should now check the item summary preview shows fields from botanical`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: -') .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: -')
.getInnerText(selectors.itemSummary.botanical); .getInnerText(selectors.itemSummary.botanical);
expect(result).toContain('Botanical: -'); expect(result).toContain('Botanical: -');
}); });
it(`should now check the item summary preview shows fields from barcode`, async () => { it(`should now check the item summary preview shows fields from barcode`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.barcode, '4') .waitForTextInElement(selectors.itemSummary.barcode, '4')
.getInnerText(selectors.itemSummary.barcode); .getInnerText(selectors.itemSummary.barcode);
expect(result).toContain('4'); expect(result).toContain('4');
}); });
it(`should now close the summary popup`, async () => { it(`should now close the summary popup`, async () => {
const result = await nightmare const result = await nightmare
.waitToClick(selectors.itemsIndex.closeItemSummaryPreview) .waitToClick(selectors.itemsIndex.closeItemSummaryPreview)
.isVisible(selectors.itemSummary.basicData); .isVisible(selectors.itemSummary.basicData);
expect(result).toBeFalsy(); expect(result).toBeFalsy();
}); });
it(`should navigate to the one of the items detailed section`, async () => { it(`should navigate to the one of the items detailed section`, async () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitForURL('summary') .waitForURL('summary')
.parsedUrl(); .parsedUrl();
expect(url.hash).toContain('summary'); expect(url.hash).toContain('summary');
}); });
it(`should check the item summary shows fields from basic data section`, async () => { it(`should check the item summary shows fields from basic data section`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind') .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind')
.getInnerText(selectors.itemSummary.basicData); .getInnerText(selectors.itemSummary.basicData);
expect(result).toContain('Name: Gem of Mind'); expect(result).toContain('Name: Gem of Mind');
}); });
it(`should check the item summary shows fields from tags section`, async () => { it(`should check the item summary shows fields from tags section`, async () => {
const result = await nightmare const result = await nightmare
.getInnerText(selectors.itemSummary.tags); .getInnerText(selectors.itemSummary.tags);
expect(result).toContain('Color: Red'); expect(result).toContain('Color: Red');
}); });
it(`should check the item summary shows fields from niches section`, async () => { it(`should check the item summary shows fields from niches section`, async () => {
const result = await nightmare const result = await nightmare
.getInnerText(selectors.itemSummary.niche); .getInnerText(selectors.itemSummary.niche);
expect(result).toContain('Warehouse One: A4'); expect(result).toContain('Warehouse One: A4');
}); });
it(`should check the item summary shows fields from botanical section`, async () => { it(`should check the item summary shows fields from botanical section`, async () => {
const result = await nightmare const result = await nightmare
.getInnerText(selectors.itemSummary.botanical); .getInnerText(selectors.itemSummary.botanical);
expect(result).toContain('Botanical: -'); expect(result).toContain('Botanical: -');
}); });
it(`should check the item summary shows fields from barcodes section`, async () => { it(`should check the item summary shows fields from barcodes section`, async () => {
const result = await nightmare const result = await nightmare
.getInnerText(selectors.itemSummary.barcode); .getInnerText(selectors.itemSummary.barcode);
expect(result).toContain('4'); expect(result).toContain('4');
});
}); });
}); });

View File

@ -1,84 +1,82 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare'; import createNightmare from '../../helpers/nightmare';
describe('Item', () => { describe('Item edit tax path', () => {
describe('Edit tax path', () => { const nightmare = createNightmare();
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('buyer'); .waitForLogin('buyer');
}); });
it('should access to the items index by clicking the items button', async () => { it('should access to the items index by clicking the items button', async () => {
const url = await nightmare const url = await nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl(); .parsedUrl();
expect(url.hash).toEqual('#!/item/index'); expect(url.hash).toEqual('#!/item/index');
}); });
it('should search for the item Gem of Time', async () => { it('should search for the item Gem of Time', async () => {
const resultCount = await nightmare const resultCount = await nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time') .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton) .click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult); .countElement(selectors.itemsIndex.searchResult);
expect(resultCount).toEqual(1); expect(resultCount).toEqual(1);
}); });
it(`should click on the search result to access to the item tax`, async () => { it(`should click on the search result to access to the item tax`, async () => {
const url = await nightmare const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemTax.taxButton) .waitToClick(selectors.itemTax.taxButton)
.waitForURL('tax') .waitForURL('tax')
.url(); .url();
expect(url).toContain('tax'); expect(url).toContain('tax');
}); });
it(`should add the item tax to all countries`, async () => { it(`should add the item tax to all countries`, async () => {
const result = await nightmare const result = await nightmare
.waitToClick(selectors.itemTax.firstClassSelect) .waitToClick(selectors.itemTax.firstClassSelect)
.waitToClick(selectors.itemTax.firstClassSelectOptionTwo) .waitToClick(selectors.itemTax.firstClassSelectOptionTwo)
.waitToClick(selectors.itemTax.secondClassSelect) .waitToClick(selectors.itemTax.secondClassSelect)
.waitToClick(selectors.itemTax.secondClassSelectOptionOne) .waitToClick(selectors.itemTax.secondClassSelectOptionOne)
.waitToClick(selectors.itemTax.thirdClassSelect) .waitToClick(selectors.itemTax.thirdClassSelect)
.waitToClick(selectors.itemTax.thirdClassSelectOptionTwo) .waitToClick(selectors.itemTax.thirdClassSelectOptionTwo)
.click(selectors.itemTax.submitTaxButton) .click(selectors.itemTax.submitTaxButton)
.waitForLastSnackbar(); .waitForLastSnackbar();
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); });
it(`should confirm the first item tax class was edited`, async () => { it(`should confirm the first item tax class was edited`, async () => {
const firstVatType = await nightmare const firstVatType = await nightmare
.click(selectors.itemTags.tagsButton) .click(selectors.itemTags.tagsButton)
.wait(selectors.itemTags.firstTagDisabled) .wait(selectors.itemTags.firstTagDisabled)
.click(selectors.itemTax.taxButton) .click(selectors.itemTax.taxButton)
.waitToClick(selectors.itemTax.taxButton) .waitToClick(selectors.itemTax.taxButton)
.waitForTextInInput(selectors.itemTax.firstClassSelect, 'reduced') .waitForTextInInput(selectors.itemTax.firstClassSelect, 'reduced')
.getInputValue(selectors.itemTax.firstClassSelect); .getInputValue(selectors.itemTax.firstClassSelect);
expect(firstVatType).toEqual('Reduced VAT'); expect(firstVatType).toEqual('Reduced VAT');
}); });
it(`should confirm the second item tax class was edited`, async () => { it(`should confirm the second item tax class was edited`, async () => {
const secondVatType = await nightmare const secondVatType = await nightmare
.getInputValue(selectors.itemTax.secondClassSelect); .getInputValue(selectors.itemTax.secondClassSelect);
expect(secondVatType).toEqual('General VAT'); expect(secondVatType).toEqual('General VAT');
}); });
it(`should confirm the third item tax class was edited`, async () => { it(`should confirm the third item tax class was edited`, async () => {
const thirdVatType = await nightmare const thirdVatType = await nightmare
.getInputValue(selectors.itemTax.thirdClassSelect); .getInputValue(selectors.itemTax.thirdClassSelect);
expect(thirdVatType).toEqual('Reduced VAT'); expect(thirdVatType).toEqual('Reduced VAT');
});
}); });
}); });

View File

@ -1,54 +1,47 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare'; import createNightmare from '../../helpers/nightmare';
describe('Item', () => { describe('Item create tags path', () => {
describe('Create tags path', () => { const nightmare = createNightmare();
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('buyer'); .waitForLogin('buyer');
}); });
it('should access to the items index by clicking the items button', done => { it('should access to the items index by clicking the items button', async () => {
return nightmare const url = await nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl() .parsedUrl();
.then(url => {
expect(url.hash).toEqual('#!/item/index');
done();
}).catch(done.fail);
});
it('should search for the item Gem of Time', done => { expect(url.hash).toEqual('#!/item/index');
return nightmare });
it('should search for the item Gem of Time', async () => {
const resultCount = await nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time') .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton) .click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult);
.then(result => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the search result to access to the item tags`, done => { expect(resultCount).toEqual(1);
return nightmare });
it(`should click on the search result to access to the item tags`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemTags.tagsButton) .waitToClick(selectors.itemTags.tagsButton)
.waitForURL('tags') .waitForURL('tags')
.url() .url();
.then(url => {
expect(url).toContain('tags');
done();
}).catch(done.fail);
});
it(`should create a new tag and delete a former one`, done => { expect(url).toContain('tags');
return nightmare });
it(`should create a new tag and delete a former one`, async () => {
const result = await nightmare
.waitToClick(selectors.itemTags.firstRemoveTagButton) .waitToClick(selectors.itemTags.firstRemoveTagButton)
.waitToClick(selectors.itemTags.addItemTagButton) .waitToClick(selectors.itemTags.addItemTagButton)
.waitToClick(selectors.itemTags.seventhTagSelect) .waitToClick(selectors.itemTags.seventhTagSelect)
@ -57,69 +50,65 @@ describe('Item', () => {
.clearInput(selectors.itemTags.seventhRelevancyInput) .clearInput(selectors.itemTags.seventhRelevancyInput)
.type(selectors.itemTags.seventhRelevancyInput, '1') .type(selectors.itemTags.seventhRelevancyInput, '1')
.click(selectors.itemTags.submitItemTagsButton) .click(selectors.itemTags.submitItemTagsButton)
.waitForLastSnackbar() .waitForLastSnackbar();
.then(result => {
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it(`should reload tags form to check that the changes are saved`, () => { expect(result).toEqual('Data saved!');
return nightmare });
it(`should confirm the first row data is the expected one`, async () => {
let result = await nightmare
.click(selectors.itemBasicData.basicDataButton) .click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput) .wait(selectors.itemBasicData.nameInput)
.click(selectors.itemTags.tagsButton) .click(selectors.itemTags.tagsButton)
.wait('vn-item-tags'); .wait('vn-item-tags')
}); .getProperty(selectors.itemTags.firstTagSelect, 'value');
it(`should confirm the first row data is the expected one`, async() => { expect(result).toEqual('Ancho de la base');
let tag = await nightmare.getProperty(selectors.itemTags.firstTagSelect, 'value'); result = await nightmare.getProperty(selectors.itemTags.firstValueInput, 'value');
let value = await nightmare.getProperty(selectors.itemTags.firstValueInput, 'value');
let relevancy = await nightmare.getProperty(selectors.itemTags.firstRelevancyInput, 'value');
expect(tag).toEqual('Ancho de la base'); expect(result).toEqual('50');
expect(value).toEqual('50'); result = await nightmare.getProperty(selectors.itemTags.firstRelevancyInput, 'value');
expect(relevancy).toEqual('1');
});
it(`should confirm the second row data is the expected one`, async() => { expect(result).toEqual('1');
let tag = await nightmare.getProperty(selectors.itemTags.secondTagSelect, 'value'); });
let value = await nightmare.getProperty(selectors.itemTags.secondValueInput, 'value');
let relevancy = await nightmare.getProperty(selectors.itemTags.secondRelevancyInput, 'value');
expect(tag).toEqual('Variedad'); it(`should confirm the second row data is the expected one`, async () => {
expect(value).toEqual('Gem1'); let tag = await nightmare.getProperty(selectors.itemTags.secondTagSelect, 'value');
expect(relevancy).toEqual('2'); let value = await nightmare.getProperty(selectors.itemTags.secondValueInput, 'value');
}); let relevancy = await nightmare.getProperty(selectors.itemTags.secondRelevancyInput, 'value');
it(`should confirm the second row data is the expected one`, async() => { expect(tag).toEqual('Variedad');
let tag = await nightmare.getProperty(selectors.itemTags.thirdTagSelect, 'value'); expect(value).toEqual('Gem1');
let value = await nightmare.getProperty(selectors.itemTags.thirdValueInput, 'value'); expect(relevancy).toEqual('2');
let relevancy = await nightmare.getProperty(selectors.itemTags.thirdRelevancyInput, 'value'); });
expect(tag).toEqual('Longitud(cm)'); it(`should confirm the third row data is the expected one`, async () => {
expect(value).toEqual('5'); let tag = await nightmare.getProperty(selectors.itemTags.thirdTagSelect, 'value');
expect(relevancy).toEqual('3'); let value = await nightmare.getProperty(selectors.itemTags.thirdValueInput, 'value');
}); let relevancy = await nightmare.getProperty(selectors.itemTags.thirdRelevancyInput, 'value');
it(`should confirm the fourth row data is the expected one`, async() => { expect(tag).toEqual('Longitud(cm)');
let tag = await nightmare.getProperty(selectors.itemTags.fourthTagSelect, 'value'); expect(value).toEqual('5');
let value = await nightmare.getProperty(selectors.itemTags.fourthValueInput, 'value'); expect(relevancy).toEqual('3');
let relevancy = await nightmare.getProperty(selectors.itemTags.fourthRelevancyInput, 'value'); });
expect(tag).toEqual('Proveedor'); it(`should confirm the fourth row data is the expected one`, async () => {
expect(value).toEqual('Marvel1'); let tag = await nightmare.getProperty(selectors.itemTags.fourthTagSelect, 'value');
expect(relevancy).toEqual('4'); let value = await nightmare.getProperty(selectors.itemTags.fourthValueInput, 'value');
}); let relevancy = await nightmare.getProperty(selectors.itemTags.fourthRelevancyInput, 'value');
it(`should confirm the fifth row data is the expected one`, async() => { expect(tag).toEqual('Proveedor');
let tag = await nightmare.getProperty(selectors.itemTags.fifthTagSelect, 'value'); expect(value).toEqual('Marvel1');
let value = await nightmare.getProperty(selectors.itemTags.fifthValueInput, 'value'); expect(relevancy).toEqual('4');
let relevancy = await nightmare.getProperty(selectors.itemTags.fifthRelevancyInput, 'value'); });
expect(tag).toEqual('Color'); it(`should confirm the fifth row data is the expected one`, async () => {
expect(value).toEqual('Yellow'); let tag = await nightmare.getProperty(selectors.itemTags.fifthTagSelect, 'value');
expect(relevancy).toEqual('5'); let value = await nightmare.getProperty(selectors.itemTags.fifthValueInput, 'value');
}); let relevancy = await nightmare.getProperty(selectors.itemTags.fifthRelevancyInput, 'value');
expect(tag).toEqual('Color');
expect(value).toEqual('Yellow');
expect(relevancy).toEqual('5');
}); });
}); });

View File

@ -1,111 +1,93 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare'; import createNightmare from '../../helpers/nightmare';
describe('Item', () => { describe('Item create niche path', () => {
describe('Create niche path', () => { const nightmare = createNightmare();
const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitForLogin('buyer'); .waitForLogin('buyer');
}); });
it('should access to the items index by clicking the items button', done => { it('should access to the items index by clicking the items button', async () => {
return nightmare const url = await nightmare
.click(selectors.moduleAccessView.itemsSectionButton) .click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton) .wait(selectors.itemsIndex.createItemButton)
.parsedUrl() .parsedUrl();
.then(url => {
expect(url.hash).toEqual('#!/item/index');
done();
}).catch(done.fail);
});
it('should search for the item Gem of Time', done => { expect(url.hash).toEqual('#!/item/index');
return nightmare });
it('should search for the item Gem of Time', async () => {
const resultCount = await nightmare
.wait(selectors.itemsIndex.searchResult) .wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time') .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton) .click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult) .countElement(selectors.itemsIndex.searchResult);
.then(result => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
});
it(`should click on the search result to access to the item niches`, done => { expect(resultCount).toEqual(1);
return nightmare });
it(`should click on the search result to access to the item niches`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemNiches.nicheButton) .waitToClick(selectors.itemNiches.nicheButton)
.waitForURL('niche') .waitForURL('niche')
.url() .url();
.then(url => {
expect(url).toContain('niche');
done();
}).catch(done.fail);
});
it(`should click create a new niche and delete a former one`, done => { expect(url).toContain('niche');
return nightmare });
it(`should click create a new niche and delete a former one`, async () => {
const result = await nightmare
.waitToClick(selectors.itemNiches.addNicheButton) .waitToClick(selectors.itemNiches.addNicheButton)
.waitToClick(selectors.itemNiches.secondNicheRemoveButton) .waitToClick(selectors.itemNiches.secondNicheRemoveButton)
.waitToClick(selectors.itemNiches.thirdWarehouseSelect) .waitToClick(selectors.itemNiches.thirdWarehouseSelect)
.waitToClick(selectors.itemNiches.thirdWarehouseSelectFourthOption) .waitToClick(selectors.itemNiches.thirdWarehouseSelectFourthOption)
.type(selectors.itemNiches.thirdCodeInput, 'A4') .type(selectors.itemNiches.thirdCodeInput, 'A4')
.click(selectors.itemNiches.submitNichesButton) .click(selectors.itemNiches.submitNichesButton)
.waitForLastSnackbar() .waitForLastSnackbar();
.then(result => {
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it(`should confirm the first niche is the expected one`, done => { expect(result).toEqual('Data saved!');
return nightmare });
it(`should confirm the first niche is the expected one`, async () => {
let result = await nightmare
.click(selectors.itemBasicData.basicDataButton) .click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput) .wait(selectors.itemBasicData.nameInput)
.click(selectors.itemNiches.nicheButton) .click(selectors.itemNiches.nicheButton)
.waitForTextInInput(selectors.itemNiches.firstWarehouseSelect, 'Warehouse One') .waitForTextInInput(selectors.itemNiches.firstWarehouseSelect, 'Warehouse One')
.getInputValue(selectors.itemNiches.firstWarehouseSelect) .getInputValue(selectors.itemNiches.firstWarehouseSelect);
.then(result => {
expect(result).toEqual('Warehouse One');
return nightmare
.getInputValue(selectors.itemNiches.firstCodeInput);
})
.then(result => {
expect(result).toEqual('A1');
done();
}).catch(done.fail);
});
it(`should confirm the second niche is the expected one`, done => { expect(result).toEqual('Warehouse One');
return nightmare result = await nightmare
.getInputValue(selectors.itemNiches.secondWarehouseSelect) .getInputValue(selectors.itemNiches.firstCodeInput);
.then(result => {
expect(result).toEqual('Warehouse Three');
return nightmare
.getInputValue(selectors.itemNiches.secondCodeInput);
})
.then(result => {
expect(result).toEqual('A3');
done();
}).catch(done.fail);
});
it(`should confirm the third niche is the expected one`, done => { expect(result).toEqual('A1');
return nightmare });
.getInputValue(selectors.itemNiches.thirdWarehouseSelect)
.then(result => { it(`should confirm the second niche is the expected one`, async () => {
expect(result).toEqual('Warehouse Two'); let result = await nightmare
return nightmare .getInputValue(selectors.itemNiches.secondWarehouseSelect);
.getInputValue(selectors.itemNiches.thirdCodeInput);
}) expect(result).toEqual('Warehouse Three');
.then(result => { result = await nightmare
expect(result).toEqual('A4'); .getInputValue(selectors.itemNiches.secondCodeInput);
done();
}).catch(done.fail);
}); expect(result).toEqual('A3');
});
it(`should confirm the third niche is the expected one`, async () => {
let result = await nightmare
.getInputValue(selectors.itemNiches.thirdWarehouseSelect);
expect(result).toEqual('Warehouse Two');
result = await nightmare
.getInputValue(selectors.itemNiches.thirdCodeInput);
expect(result).toEqual('A4');
}); });
}); });

7350
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -325,19 +325,19 @@ INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`)
INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`) INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`)
VALUES VALUES
( 69 , 'CCs', NULL, 30, NULL, 1), ( 69 , 'CCs', NULL, 30, NULL, 0),
( 442 , 'VNL', 241, 30, 2 , 2), ( 442 , 'VNL', 241, 30, 2 , 1),
( 567 , 'VNH', NULL, 30, NULL, 3), ( 567 , 'VNH', NULL, 30, NULL, 4),
( 791 , 'FTH', NULL, 30, NULL, 4), ( 791 , 'FTH', NULL, 30, NULL, 3),
( 1381, 'ORN', NULL, 30, NULL, 5); ( 1381, 'ORN', NULL, 30, NULL, 7);
INSERT INTO `vn`.`invoiceOut`(`id`, `ref`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `pdf`) INSERT INTO `vn`.`invoiceOut`(`id`,`ref`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `pdf`)
VALUES VALUES
( 1, 'T1111111' , 'T', 500 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 101, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), ( 1, '1', 'T', 500 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 101, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
( 2, 'V2222222' , 'V', 350.50 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), ( 2, '1', 'V', 350.50 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
( 3, 'E3333333' , 'E', 90.30 , CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), ( 3, '1', 'E', 90.30 , CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
( 4, 'E4444444' , 'E', 290.30 , DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), ( 4, '1', 'E', 290.30 , DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
( 5, 'E5555555' , 'E', 190.30 , DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1); ( 5, '1', 'R', 190.30 , DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1);
INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `created`) INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `created`)
VALUES VALUES