2018-02-15 11:28:05 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-02-20 09:00:19 +00:00
|
|
|
import createNightmare from '../../helpers/helpers';
|
2017-12-13 10:25:50 +00:00
|
|
|
|
|
|
|
describe('Edit pay method path', () => {
|
2018-02-20 09:00:19 +00:00
|
|
|
const nightmare = createNightmare();
|
2017-12-11 11:33:27 +00:00
|
|
|
|
2018-03-02 11:15:17 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitForLogin('developer');
|
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should click on the Clients button of the top bar menu', () => {
|
|
|
|
return nightmare
|
2017-12-11 11:33:27 +00:00
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.clientsButton)
|
|
|
|
.wait(selectors.clientsIndex.createClientButton)
|
2018-02-20 21:35:54 +00:00
|
|
|
.parsedUrl()
|
2017-12-11 11:33:27 +00:00
|
|
|
.then(url => {
|
2018-02-20 09:00:19 +00:00
|
|
|
expect(url.hash).toEqual('#!/clients');
|
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should search for the user Bruce Banner', () => {
|
|
|
|
return nightmare
|
2017-12-11 11:33:27 +00:00
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
|
|
|
.countSearchResults(selectors.clientsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it(`should click on the search result to access to the client's pay method`, () => {
|
|
|
|
return nightmare
|
2017-12-11 11:33:27 +00:00
|
|
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
|
|
|
|
.waitToClick(selectors.clientsIndex.searchResult)
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodButton)
|
2017-12-11 11:33:27 +00:00
|
|
|
.waitForURL('billing-data')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('billing-data');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
});
|
|
|
|
|
2018-03-02 17:42:35 +00:00
|
|
|
it(`should attempt to edit the Pay method without an IBAN but fail`, () => {
|
2018-02-20 09:00:19 +00:00
|
|
|
return nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodInput)
|
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodIBANOption)
|
2018-03-02 17:42:35 +00:00
|
|
|
.clearInput(selectors.clientPayMethod.dueDayInput)
|
|
|
|
.type(selectors.clientPayMethod.dueDayInput, '60')
|
|
|
|
.waitToClick(selectors.clientPayMethod.receivedCoreVNHCheckbox)
|
|
|
|
.waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox)
|
|
|
|
.waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox)
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
|
|
.waitToClick(selectors.clientPayMethod.cancelNotificationButton)
|
2018-02-20 09:00:19 +00:00
|
|
|
.waitForSnackbar()
|
2017-12-11 11:33:27 +00:00
|
|
|
.then(result => {
|
2017-12-15 12:35:36 +00:00
|
|
|
expect(result).toContain('Error');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it(`should add the IBAN`, () => {
|
|
|
|
return nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.clearInput(selectors.clientPayMethod.IBANInput)
|
|
|
|
.type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
|
|
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
|
|
.waitToClick(selectors.clientPayMethod.cancelNotificationButton)
|
2018-02-20 09:00:19 +00:00
|
|
|
.waitForSnackbar()
|
2017-12-11 11:33:27 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Data saved!');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it(`should confirm the IBAN pay method is sucessfully saved`, () => {
|
|
|
|
return nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.getInputValue(selectors.clientPayMethod.payMethodInput)
|
2017-12-11 11:33:27 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('PayMethod with IBAN');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should confirm the due day have been edited', () => {
|
|
|
|
return nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.getInputValue(selectors.clientPayMethod.dueDayInput)
|
2018-01-09 12:51:41 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('60');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2018-01-09 12:51:41 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should confirm Received core VNH checkbox is unchecked', () => {
|
|
|
|
return nightmare
|
2018-01-09 12:51:41 +00:00
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).checked;
|
2018-02-15 11:28:05 +00:00
|
|
|
}, selectors.clientPayMethod.receivedCoreVNHCheckbox)
|
2018-01-09 12:51:41 +00:00
|
|
|
.then(value => {
|
|
|
|
expect(value).toBeFalsy();
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2018-01-09 12:51:41 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should confirm Received core VNL checkbox is unchecked', () => {
|
|
|
|
return nightmare
|
2018-01-09 12:51:41 +00:00
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).checked;
|
2018-02-15 11:28:05 +00:00
|
|
|
}, selectors.clientPayMethod.receivedCoreVNLCheckbox)
|
2018-01-09 12:51:41 +00:00
|
|
|
.then(value => {
|
|
|
|
expect(value).toBeFalsy();
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2018-01-09 12:51:41 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should confirm Received B2B VNL checkbox is unchecked', () => {
|
|
|
|
return nightmare
|
2018-01-09 12:51:41 +00:00
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).checked;
|
2018-02-15 11:28:05 +00:00
|
|
|
}, selectors.clientPayMethod.receivedB2BVNLCheckbox)
|
2018-01-09 12:51:41 +00:00
|
|
|
.then(value => {
|
|
|
|
expect(value).toBeFalsy();
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2018-01-09 12:51:41 +00:00
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
});
|