Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
118ec97106
|
@ -1,4 +1,4 @@
|
|||
fdescribe('Currency filter', () => {
|
||||
describe('Currency filter', () => {
|
||||
let compile;
|
||||
let $element;
|
||||
|
||||
|
@ -11,17 +11,31 @@ fdescribe('Currency filter', () => {
|
|||
});
|
||||
};
|
||||
|
||||
it('should return the value formatted with two decimals when the value is a number and you set it a 2 as param', () => {
|
||||
it('should return a ONE decimal number as per the argument', () => {
|
||||
let html = `<div id="test" >{{200 | currency: '€': 1}}</div>`;
|
||||
compile(html);
|
||||
|
||||
expect($element[0].innerHTML).toEqual('200.0 €');
|
||||
});
|
||||
|
||||
it('should return a TWO decimals number as per the argument', () => {
|
||||
let html = `<div id="test" >{{200 | currency: '€': 2}}</div>`;
|
||||
compile(html);
|
||||
|
||||
expect($element[0].innerHTML).toBe('200.00 €');
|
||||
expect($element[0].innerHTML).toEqual('200.00 €');
|
||||
});
|
||||
|
||||
it('should return a TEN decimals number as per the argument', () => {
|
||||
let html = `<div id="test" >{{200 | currency: '€': 10}}</div>`;
|
||||
compile(html);
|
||||
|
||||
expect($element[0].innerHTML).toEqual('200.0000000000 €');
|
||||
});
|
||||
|
||||
it('sould return nothing when the value is not set', () => {
|
||||
let html = `<div id="test" >{{null | currency: '€': 2}}</div>`;
|
||||
compile(html);
|
||||
|
||||
expect($element[0].innerHTML).toBe('');
|
||||
expect($element[0].innerHTML).toEqual('');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -168,6 +168,15 @@ export default {
|
|||
lastModificationPreviousValue: 'vn-client-log vn-table vn-td.before',
|
||||
lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after'
|
||||
|
||||
},
|
||||
clientRisk: {
|
||||
riskButton: `vn-left-menu a[ui-sref="client.card.risk.index"]`,
|
||||
newPaymentButton: `${components.vnFloatButton}`,
|
||||
newPaymentBankInut: `vn-client-risk-create > form > vn-card > div > vn-horizontal:nth-child(3) > vn-textfield:nth-child(1) > div > div > div.infix > input`,
|
||||
newPaymentAmountInput: `vn-client-risk-create > form > vn-card > div > vn-horizontal:nth-child(3) > vn-textfield:nth-child(2) > div > div > div.infix > input`,
|
||||
saveButton: `${components.vnSubmit}`,
|
||||
firstRiskLineBalance: 'vn-client-risk-index > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)'
|
||||
|
||||
},
|
||||
itemsIndex: {
|
||||
goBackToModuleIndexButton: `vn-ticket-descriptor a[href="#!/ticket/index"]`,
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
|
||||
describe('Client risk path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
return nightmare
|
||||
.waitForLogin('administrative');
|
||||
});
|
||||
|
||||
it('should click on the Clients button of the top bar menu', async () => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.clientsButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/index');
|
||||
});
|
||||
|
||||
it('should search for the user Petter Parker', async () => {
|
||||
let resultCount = await nightmare
|
||||
.wait(selectors.clientsIndex.searchResult)
|
||||
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||
.click(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
|
||||
expect(resultCount).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the client's risk`, async () => {
|
||||
let url = await nightmare
|
||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||
.waitToClick(selectors.clientsIndex.searchResult)
|
||||
.waitToClick(selectors.clientRisk.riskButton)
|
||||
.waitForURL('/risk')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/risk');
|
||||
});
|
||||
|
||||
it('should click the new payment button', async () => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientRisk.newPaymentButton)
|
||||
.waitForURL('/risk')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/risk');
|
||||
});
|
||||
|
||||
it('should create a new payment that clears the debt', async () => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientRisk.newPaymentBankInut)
|
||||
.type(selectors.clientRisk.newPaymentBankInut, '2')
|
||||
.waitToClick(selectors.clientRisk.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now 0', async () => {
|
||||
let result = await nightmare
|
||||
.waitProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText')
|
||||
.getProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText');
|
||||
|
||||
expect(result).toEqual('0.00 €');
|
||||
});
|
||||
|
||||
it('should now click the new payment button', async () => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientRisk.newPaymentButton)
|
||||
.waitForURL('/risk')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/risk');
|
||||
});
|
||||
|
||||
it('should create a new payment that sets the balance to positive value', async () => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientRisk.newPaymentAmountInput)
|
||||
.type(selectors.clientRisk.newPaymentAmountInput, '100')
|
||||
.waitToClick(selectors.clientRisk.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now 100', async () => {
|
||||
let result = await nightmare
|
||||
.waitProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText')
|
||||
.getProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText');
|
||||
|
||||
expect(result).toEqual('100.00 €');
|
||||
});
|
||||
|
||||
it('should again click the new payment button', async () => {
|
||||
let url = await nightmare
|
||||
.waitToClick(selectors.clientRisk.newPaymentButton)
|
||||
.waitForURL('/risk')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/risk');
|
||||
});
|
||||
|
||||
it('should create a new payment that sets the balance back to the original negative value', async () => {
|
||||
let result = await nightmare
|
||||
.clearInput(selectors.clientRisk.newPaymentAmountInput)
|
||||
.type(selectors.clientRisk.newPaymentAmountInput, '-150')
|
||||
.waitToClick(selectors.clientRisk.saveButton)
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should check balance is now -50', async () => {
|
||||
let result = await nightmare
|
||||
.waitProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText')
|
||||
.getProperty(selectors.clientRisk.firstRiskLineBalance, 'innerText');
|
||||
|
||||
expect(result).toEqual('-50.00 €');
|
||||
});
|
||||
|
||||
it('should now click on the Clients button of the top bar menu', async () => {
|
||||
let url = await nightmare
|
||||
.waitForLogin('employee')
|
||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||
.waitToClick(selectors.globalItems.clientsButton)
|
||||
.wait(selectors.clientsIndex.createClientButton)
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toEqual('#!/client/index');
|
||||
});
|
||||
|
||||
it('should now search for the user Petter Parker', async () => {
|
||||
let resultCount = await nightmare
|
||||
.wait(selectors.clientsIndex.searchResult)
|
||||
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||
.click(selectors.clientsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||
.countElement(selectors.clientsIndex.searchResult);
|
||||
|
||||
expect(resultCount).toEqual(1);
|
||||
});
|
||||
|
||||
it(`should click on the search result to access to the client's risk`, async () => {
|
||||
let url = await nightmare
|
||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||
.waitToClick(selectors.clientsIndex.searchResult)
|
||||
.waitToClick(selectors.clientRisk.riskButton)
|
||||
.waitForURL('/risk')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/risk');
|
||||
});
|
||||
|
||||
it('should not be able to click the new payment button as it isnt present', async () => {
|
||||
let result = await nightmare
|
||||
.exists(selectors.clientRisk.newPaymentButton);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue