2018-02-15 11:28:05 +00:00
|
|
|
import config from '../../helpers/config.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import {catchErrors} from '../../../services/utils/jasmineHelpers';
|
2017-12-11 11:33:27 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
const moduleAccessViewHashURL = '#!/';
|
|
|
|
|
2017-12-13 10:25:50 +00:00
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
|
|
|
|
|
|
|
describe('Edit pay method path', () => {
|
2017-12-11 11:33:27 +00:00
|
|
|
it('should log in', done => {
|
|
|
|
nightmare
|
|
|
|
.login()
|
|
|
|
.waitForURL(moduleAccessViewHashURL)
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toEqual(config.url + moduleAccessViewHashURL);
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should make sure the language is English', done => {
|
|
|
|
nightmare
|
|
|
|
.changeLanguageToEnglish()
|
|
|
|
.then(() => {
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should click on the Clients button of the top bar menu', done => {
|
|
|
|
nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.clientsButton)
|
|
|
|
.wait(selectors.clientsIndex.createClientButton)
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toEqual(config.url + '#!/clients');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search for the user Bruce Banner', done => {
|
|
|
|
nightmare
|
|
|
|
.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);
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result to access to the client's pay method`, done => {
|
|
|
|
nightmare
|
|
|
|
.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');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should edit the Pay method to any without IBAN`, done => {
|
|
|
|
nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodInput)
|
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodOptionOne)
|
2017-12-11 11:33:27 +00:00
|
|
|
.wait(200)
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
|
|
.waitToClick(selectors.clientPayMethod.cancelNotificationButton)
|
2017-12-11 11:33:27 +00:00
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the Pay method have been selected`, done => {
|
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
2018-02-15 11:28:05 +00:00
|
|
|
.click(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.click(selectors.clientPayMethod.payMethodButton)
|
2017-12-11 11:33:27 +00:00
|
|
|
.wait(200)
|
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 one');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should receive an error when changing payMethod to IBAN without an IBAN entered`, done => {
|
|
|
|
nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodInput)
|
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodIBANOption)
|
2017-12-11 11:33:27 +00:00
|
|
|
.wait(200)
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
|
|
.waitToClick(selectors.clientPayMethod.cancelNotificationButton)
|
2017-12-11 11:33:27 +00:00
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
2017-12-15 12:35:36 +00:00
|
|
|
expect(result).toContain('Error');
|
2017-12-11 11:33:27 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should add the IBAN`, done => {
|
|
|
|
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)
|
2017-12-11 11:33:27 +00:00
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the IBAN pay method is sucessfully saved`, done => {
|
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
2018-02-15 11:28:05 +00:00
|
|
|
.click(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.click(selectors.clientPayMethod.payMethodButton)
|
2017-12-11 11:33:27 +00:00
|
|
|
.wait(200)
|
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');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2018-01-09 12:51:41 +00:00
|
|
|
it(`should edit the due day`, done => {
|
|
|
|
nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.clearInput(selectors.clientPayMethod.dueDayInput)
|
|
|
|
.type(selectors.clientPayMethod.dueDayInput, '60')
|
|
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
|
|
.waitToClick(selectors.clientPayMethod.cancelNotificationButton)
|
2018-01-09 12:51:41 +00:00
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the due day have been edited', done => {
|
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodButton)
|
|
|
|
.wait(selectors.clientPayMethod.dueDayInput)
|
|
|
|
.getInputValue(selectors.clientPayMethod.dueDayInput)
|
2018-01-09 12:51:41 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('60');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should uncheck the Received core VNH checkbox', done => {
|
|
|
|
nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.receivedCoreVNHCheckbox)
|
|
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
2018-01-09 12:51:41 +00:00
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm Received core VNH checkbox is unchecked', done => {
|
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodButton)
|
|
|
|
.wait(selectors.clientPayMethod.receivedCoreVNHCheckbox)
|
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();
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should uncheck the Received core VNL checkbox', done => {
|
|
|
|
nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox)
|
|
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
2018-01-09 12:51:41 +00:00
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm Received core VNL checkbox is unchecked', done => {
|
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodButton)
|
|
|
|
.wait(selectors.clientPayMethod.receivedCoreVNLCheckbox)
|
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();
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should uncheck the Received B2B VNL checkbox', done => {
|
|
|
|
nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox)
|
|
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
2018-01-09 12:51:41 +00:00
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm Received B2B VNL checkbox is unchecked', done => {
|
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.waitToClick(selectors.clientPayMethod.payMethodButton)
|
|
|
|
.wait(selectors.clientPayMethod.receivedB2BVNLCheckbox)
|
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();
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
2017-12-11 11:33:27 +00:00
|
|
|
});
|