salix/e2e/paths/client-module/04_edit_pay_method.spec.js

126 lines
5.0 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
2018-10-16 11:06:58 +00:00
xdescribe('Client', () => {
describe('Edit pay method path', () => {
const nightmare = createNightmare();
2017-12-11 11:33:27 +00:00
beforeAll(() => {
return nightmare
2018-10-11 07:14:26 +00:00
.waitForLogin('administrative');
});
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
2018-05-23 12:26:51 +00:00
expect(url.hash).toEqual('#!/client/index');
});
});
2017-12-11 11:33:27 +00:00
it('should search for the user Bruce Banner', () => {
return nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
});
});
2017-12-11 11:33:27 +00:00
it(`should click on the search result to access to the client's pay method`, () => {
return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientPayMethod.payMethodButton)
.waitForURL('billing-data')
.url()
.then(url => {
expect(url).toContain('billing-data');
});
});
2017-12-11 11:33:27 +00:00
it(`should attempt to edit the Pay method without an IBAN but fail`, () => {
return nightmare
.waitToClick(selectors.clientPayMethod.payMethodInput)
.waitToClick(selectors.clientPayMethod.payMethodIBANOption)
.waitForTextInInput(selectors.clientPayMethod.payMethodInput, 'PayMethod with IBAN')
.clearInput(selectors.clientPayMethod.dueDayInput)
.type(selectors.clientPayMethod.dueDayInput, '60')
.waitForTextInInput(selectors.clientPayMethod.dueDayInput, '60')
.waitToClick(selectors.clientPayMethod.receivedCoreLCRCheckbox)
.waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox)
.waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox)
.waitToClick(selectors.clientPayMethod.saveButton)
.waitForLastSnackbar()
.then(result => {
expect(result).toEqual('That payment method requires an IBAN');
});
});
2017-12-11 11:33:27 +00:00
it(`should add the IBAN`, () => {
return nightmare
.clearInput(selectors.clientPayMethod.IBANInput)
.type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
.waitForTextInInput(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
.waitToClick(selectors.clientPayMethod.saveButton)
.waitForSnackbar()
.then(result => {
2018-06-19 06:12:36 +00:00
expect(result).toEqual(jasmine.arrayContaining(['Data saved!', 'Notification sent!']));
});
});
2017-12-11 11:33:27 +00:00
it(`should confirm the IBAN pay method is sucessfully saved`, () => {
return nightmare
.getInputValue(selectors.clientPayMethod.payMethodInput)
.then(result => {
expect(result).toEqual('PayMethod with IBAN');
});
});
2017-12-11 11:33:27 +00:00
it('should confirm the due day have been edited', () => {
return nightmare
.getInputValue(selectors.clientPayMethod.dueDayInput)
.then(result => {
expect(result).toEqual('60');
});
});
2018-07-11 09:03:34 +00:00
it('should confirm Received LCR checkbox is checked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedCoreLCRCheckbox)
.then(value => {
2018-07-11 09:03:34 +00:00
expect(value).toBeTruthy();
});
});
it('should confirm Received core VNL checkbox is unchecked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedCoreVNLCheckbox)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should confirm Received B2B VNL checkbox is unchecked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedB2BVNLCheckbox)
.then(value => {
expect(value).toBeFalsy();
});
});
});
2017-12-11 11:33:27 +00:00
});