merge
This commit is contained in:
commit
7a2431a66b
|
@ -22,7 +22,7 @@
|
||||||
<h6>{{$ctrl.item.name}}</h6>
|
<h6>{{$ctrl.item.name}}</h6>
|
||||||
<div><vn-label translate>Id</vn-label> {{$ctrl.item.id}}</div>
|
<div><vn-label translate>Id</vn-label> {{$ctrl.item.id}}</div>
|
||||||
<div ng-repeat="itemTag in $ctrl.itemTags | limitTo:4">
|
<div ng-repeat="itemTag in $ctrl.itemTags | limitTo:4">
|
||||||
<div><span translate>{{$ctrl.tags[itemTag.tagFk].name}}</span>: <b>{{itemTag.value}}</b></div>
|
<div><vn-label translate>{{$ctrl.tags[itemTag.tagFk].name}}</vn-label>: {{itemTag.value}}</div>
|
||||||
</div>
|
</div>
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
|
|
|
@ -143,6 +143,10 @@ export default {
|
||||||
mandateButton: `${components.vnMenuItem}[ui-sref="clientCard.mandate"]`,
|
mandateButton: `${components.vnMenuItem}[ui-sref="clientCard.mandate"]`,
|
||||||
firstMandateText: 'vn-client-mandate .list-element'
|
firstMandateText: 'vn-client-mandate .list-element'
|
||||||
},
|
},
|
||||||
|
clientInvoices: {
|
||||||
|
invoicesButton: `${components.vnMenuItem}[ui-sref="clientCard.invoices"]`,
|
||||||
|
firstInvoiceText: 'vn-client-invoices .list-element'
|
||||||
|
},
|
||||||
itemsIndex: {
|
itemsIndex: {
|
||||||
createItemButton: `${components.vnFloatButton}`,
|
createItemButton: `${components.vnFloatButton}`,
|
||||||
searchResult: `vn-item-product a`,
|
searchResult: `vn-item-product a`,
|
||||||
|
|
|
@ -0,0 +1,283 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import createNightmare from '../../helpers/helpers';
|
||||||
|
|
||||||
|
describe('mandate path', () => {
|
||||||
|
const nightmare = createNightmare();
|
||||||
|
|
||||||
|
describe('as salesPerson', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
return nightmare
|
||||||
|
.waitForLogin('salesPerson');
|
||||||
|
});
|
||||||
|
|
||||||
|
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 Petter Parker', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.clientsIndex.searchResult)
|
||||||
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||||
|
.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 fiscal data`, () => {
|
||||||
|
return nightmare
|
||||||
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||||
|
.waitToClick(selectors.clientsIndex.searchResult)
|
||||||
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
|
.waitForURL('fiscal-data')
|
||||||
|
.parsedUrl()
|
||||||
|
.then(url => {
|
||||||
|
expect(url.hash).toContain('fiscal-data');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should click on the fiscal data button to start editing`, () => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
|
.waitForURL('fiscal-data')
|
||||||
|
.parsedUrl()
|
||||||
|
.then(url => {
|
||||||
|
expect(url.hash).toContain('fiscal-data');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm verified data button is disabled for salesPerson', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
|
.evaluate(selector => {
|
||||||
|
return document.querySelector(selector).className;
|
||||||
|
}, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(3) > label')
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toContain('is-disabled');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should edit the social name', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
|
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||||
|
.type(selectors.clientFiscalData.socialNameInput, 'salesPerson was here')
|
||||||
|
.click(selectors.clientFiscalData.saveButton)
|
||||||
|
.waitForSnackbar()
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm the social name have been edited', () => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
||||||
|
.wait(selectors.clientBasicData.nameInput)
|
||||||
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
|
.getInputValue(selectors.clientFiscalData.socialNameInput)
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual('salesPerson was here');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('as administrative', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.globalItems.logOutButton)
|
||||||
|
.waitForLogin('administrative');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should navigate to clients index', () => {
|
||||||
|
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 again for the user Petter Parker', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.clientsIndex.searchResult)
|
||||||
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||||
|
.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 Petter Parkers fiscal data`, () => {
|
||||||
|
return nightmare
|
||||||
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||||
|
.waitToClick(selectors.clientsIndex.searchResult)
|
||||||
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
|
.waitForURL('fiscal-data')
|
||||||
|
.parsedUrl()
|
||||||
|
.then(url => {
|
||||||
|
expect(url.hash).toContain('fiscal-data');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should click on the fiscal data button`, () => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
|
.waitForURL('fiscal-data')
|
||||||
|
.parsedUrl()
|
||||||
|
.then(url => {
|
||||||
|
expect(url.hash).toContain('fiscal-data');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm verified data button is enabled for administrative', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
|
.evaluate(selector => {
|
||||||
|
return document.querySelector(selector).className;
|
||||||
|
}, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(3) > label')
|
||||||
|
.then(result => {
|
||||||
|
expect(result).not.toContain('is-disabled');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should check the Verified data checkbox', () => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
|
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||||
|
.waitForSnackbar()
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm Verified data checkbox is checked', () => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
||||||
|
.wait(selectors.clientBasicData.nameInput)
|
||||||
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
|
.evaluate(selector => {
|
||||||
|
return document.querySelector(selector).checked;
|
||||||
|
}, selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
|
.then(value => {
|
||||||
|
expect(value).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should again edit the social name', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
|
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||||
|
.type(selectors.clientFiscalData.socialNameInput, 'administrative was here')
|
||||||
|
.click(selectors.clientFiscalData.saveButton)
|
||||||
|
.waitForSnackbar()
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm the social name have been edited once and for all', () => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
||||||
|
.wait(selectors.clientBasicData.nameInput)
|
||||||
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
|
.getInputValue(selectors.clientFiscalData.socialNameInput)
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual('administrative was here');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('as salesPerson second run', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.globalItems.logOutButton)
|
||||||
|
.waitForLogin('salesPerson');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should again 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 again search for the user Petter Parker', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.clientsIndex.searchResult)
|
||||||
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||||
|
.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 fiscal data`, () => {
|
||||||
|
return nightmare
|
||||||
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||||
|
.waitToClick(selectors.clientsIndex.searchResult)
|
||||||
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
|
.waitForURL('fiscal-data')
|
||||||
|
.parsedUrl()
|
||||||
|
.then(url => {
|
||||||
|
expect(url.hash).toContain('fiscal-data');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should click on the fiscal data button to start editing`, () => {
|
||||||
|
return nightmare
|
||||||
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
|
.waitForURL('fiscal-data')
|
||||||
|
.parsedUrl()
|
||||||
|
.then(url => {
|
||||||
|
expect(url.hash).toContain('fiscal-data');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm verified data button is disabled once again for salesPerson', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
|
.evaluate(selector => {
|
||||||
|
return document.querySelector(selector).className;
|
||||||
|
}, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(3) > label')
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toContain('is-disabled');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm the form have been disabled for salesPerson', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
|
.evaluate(selector => {
|
||||||
|
return document.querySelector(selector).className;
|
||||||
|
}, 'vn-textfield[field="$ctrl.client.socialName"] > div')
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toContain('is-disabled');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,58 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import createNightmare from '../../helpers/helpers';
|
||||||
|
|
||||||
|
describe('mandate path', () => {
|
||||||
|
const nightmare = createNightmare();
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
return nightmare
|
||||||
|
.waitForLogin('developer');
|
||||||
|
});
|
||||||
|
|
||||||
|
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 Petter Parker', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.clientsIndex.searchResult)
|
||||||
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||||
|
.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 invoices`, () => {
|
||||||
|
return nightmare
|
||||||
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter')
|
||||||
|
.waitToClick(selectors.clientsIndex.searchResult)
|
||||||
|
.waitToClick(selectors.clientInvoices.invoicesButton)
|
||||||
|
.waitForURL('invoices')
|
||||||
|
.parsedUrl()
|
||||||
|
.then(url => {
|
||||||
|
expect(url.hash).toContain('invoices');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm the client has an invoice', () => {
|
||||||
|
return nightmare
|
||||||
|
.wait(selectors.clientInvoices.firstInvoiceText)
|
||||||
|
.getInnerText(selectors.clientInvoices.firstInvoiceText)
|
||||||
|
.then(value => {
|
||||||
|
expect(value).toContain('V1800001');
|
||||||
|
expect(value).toContain('02/03/2018');
|
||||||
|
expect(value).toContain('350.50');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -40,4 +40,4 @@ module.exports = function(Client) {
|
||||||
callback(null, false);
|
callback(null, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
Loading…
Reference in New Issue