201 lines
7.5 KiB
JavaScript
201 lines
7.5 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import createNightmare from '../../helpers/helpers';
|
|
|
|
describe('Edit pay method path', () => {
|
|
const nightmare = createNightmare();
|
|
|
|
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 => {
|
|
expect(url.hash).toEqual('#!/clients');
|
|
});
|
|
});
|
|
|
|
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)
|
|
.countSearchResults(selectors.clientsIndex.searchResult)
|
|
.then(result => {
|
|
expect(result).toEqual(1);
|
|
});
|
|
});
|
|
|
|
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');
|
|
});
|
|
});
|
|
|
|
it(`should edit the Pay method to any without IBAN`, () => {
|
|
return nightmare
|
|
.waitToClick(selectors.clientPayMethod.payMethodInput)
|
|
.waitToClick(selectors.clientPayMethod.payMethodOptionOne)
|
|
.wait(200)
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
.waitToClick(selectors.clientPayMethod.cancelNotificationButton)
|
|
.waitForSnackbar()
|
|
.then(result => {
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
});
|
|
|
|
it(`should confirm the Pay method have been selected`, () => {
|
|
return nightmare
|
|
.click(selectors.clientBasicData.basicDataButton)
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
.click(selectors.clientPayMethod.payMethodButton)
|
|
.wait(200)
|
|
.getInputValue(selectors.clientPayMethod.payMethodInput)
|
|
.then(result => {
|
|
expect(result).toEqual('PayMethod one');
|
|
});
|
|
});
|
|
|
|
it(`should receive an error when changing payMethod to IBAN without an IBAN entered`, () => {
|
|
return nightmare
|
|
.waitToClick(selectors.clientPayMethod.payMethodInput)
|
|
.waitToClick(selectors.clientPayMethod.payMethodIBANOption)
|
|
.wait(200)
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
.waitToClick(selectors.clientPayMethod.cancelNotificationButton)
|
|
.waitForSnackbar()
|
|
.then(result => {
|
|
expect(result).toContain('Error');
|
|
});
|
|
});
|
|
|
|
it(`should add the IBAN`, () => {
|
|
return nightmare
|
|
.clearInput(selectors.clientPayMethod.IBANInput)
|
|
.type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
.waitToClick(selectors.clientPayMethod.cancelNotificationButton)
|
|
.waitForSnackbar()
|
|
.then(result => {
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
});
|
|
|
|
it(`should confirm the IBAN pay method is sucessfully saved`, () => {
|
|
return nightmare
|
|
.click(selectors.clientBasicData.basicDataButton)
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
.click(selectors.clientPayMethod.payMethodButton)
|
|
.wait(200)
|
|
.getInputValue(selectors.clientPayMethod.payMethodInput)
|
|
.then(result => {
|
|
expect(result).toEqual('PayMethod with IBAN');
|
|
});
|
|
});
|
|
|
|
it(`should edit the due day`, () => {
|
|
return nightmare
|
|
.clearInput(selectors.clientPayMethod.dueDayInput)
|
|
.type(selectors.clientPayMethod.dueDayInput, '60')
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
.waitToClick(selectors.clientPayMethod.cancelNotificationButton)
|
|
.waitForSnackbar()
|
|
.then(result => {
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
});
|
|
|
|
it('should confirm the due day have been edited', () => {
|
|
return nightmare
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
.waitToClick(selectors.clientPayMethod.payMethodButton)
|
|
.wait(selectors.clientPayMethod.dueDayInput)
|
|
.getInputValue(selectors.clientPayMethod.dueDayInput)
|
|
.then(result => {
|
|
expect(result).toEqual('60');
|
|
});
|
|
});
|
|
|
|
it('should uncheck the Received core VNH checkbox', () => {
|
|
return nightmare
|
|
.waitToClick(selectors.clientPayMethod.receivedCoreVNHCheckbox)
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
.waitForSnackbar()
|
|
.then(result => {
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
});
|
|
|
|
it('should confirm Received core VNH checkbox is unchecked', () => {
|
|
return nightmare
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
.waitToClick(selectors.clientPayMethod.payMethodButton)
|
|
.wait(selectors.clientPayMethod.receivedCoreVNHCheckbox)
|
|
.evaluate(selector => {
|
|
return document.querySelector(selector).checked;
|
|
}, selectors.clientPayMethod.receivedCoreVNHCheckbox)
|
|
.then(value => {
|
|
expect(value).toBeFalsy();
|
|
});
|
|
});
|
|
|
|
it('should uncheck the Received core VNL checkbox', () => {
|
|
return nightmare
|
|
.waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox)
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
.waitForSnackbar()
|
|
.then(result => {
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
});
|
|
|
|
it('should confirm Received core VNL checkbox is unchecked', () => {
|
|
return nightmare
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
.waitToClick(selectors.clientPayMethod.payMethodButton)
|
|
.wait(selectors.clientPayMethod.receivedCoreVNLCheckbox)
|
|
.evaluate(selector => {
|
|
return document.querySelector(selector).checked;
|
|
}, selectors.clientPayMethod.receivedCoreVNLCheckbox)
|
|
.then(value => {
|
|
expect(value).toBeFalsy();
|
|
});
|
|
});
|
|
|
|
it('should uncheck the Received B2B VNL checkbox', () => {
|
|
return nightmare
|
|
.waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox)
|
|
.waitToClick(selectors.clientPayMethod.saveButton)
|
|
.waitForSnackbar()
|
|
.then(result => {
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
});
|
|
|
|
it('should confirm Received B2B VNL checkbox is unchecked', () => {
|
|
return nightmare
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
.waitToClick(selectors.clientPayMethod.payMethodButton)
|
|
.wait(selectors.clientPayMethod.receivedB2BVNLCheckbox)
|
|
.evaluate(selector => {
|
|
return document.querySelector(selector).checked;
|
|
}, selectors.clientPayMethod.receivedB2BVNLCheckbox)
|
|
.then(value => {
|
|
expect(value).toBeFalsy();
|
|
});
|
|
});
|
|
});
|