#168 client permissions plus e2e path verified data update

This commit is contained in:
Carlos Jimenez 2018-03-12 11:10:05 +01:00
parent ca2b84f73c
commit edf2e61bd0
5 changed files with 238 additions and 25 deletions

View File

@ -15,7 +15,11 @@
<vn-title>Address</vn-title> <vn-title>Address</vn-title>
<vn-horizontal> <vn-horizontal>
<vn-check vn-one label="Enabled" field="$ctrl.address.isActive"></vn-check> <vn-check vn-one label="Enabled" field="$ctrl.address.isActive"></vn-check>
<vn-check vn-one label="Is equalizated" field="$ctrl.address.isEqualizated" vn-acl="administrative"></vn-check> <vn-check
vn-one label="Is equalizated"
field="$ctrl.address.isEqualizated"
vn-acl="administrative, salesAssistant">
</vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Consignee" field="$ctrl.address.nickname" vn-focus></vn-textfield> <vn-textfield vn-one label="Consignee" field="$ctrl.address.nickname" vn-focus></vn-textfield>

View File

@ -10,30 +10,50 @@
<vn-title>Pay method</vn-title> <vn-title>Pay method</vn-title>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-two <vn-autocomplete vn-two
vn-acl="administrative" vn-acl="administrative, salesAssistant"
field="$ctrl.client.payMethodFk" field="$ctrl.client.payMethodFk"
url="/client/api/PayMethods" url="/client/api/PayMethods"
select-fields="ibanRequired" select-fields="ibanRequired"
initial-data="$ctrl.client.payMethod" initial-data="$ctrl.client.payMethod"
label="Pay method"> label="Pay method">
</vn-autocomplete> </vn-autocomplete>
<vn-textfield vn-two label="IBAN" field="$ctrl.client.iban" vn-acl="administrative"></vn-textfield> <vn-textfield
<vn-textfield vn-one label="Due day" field="$ctrl.client.dueDay" vn-acl="administrative"></vn-textfield> vn-two label="IBAN"
field="$ctrl.client.iban"
vn-acl="administrative, salesAssistant">
</vn-textfield>
<vn-textfield
vn-one label="Due day"
field="$ctrl.client.dueDay"
vn-acl="administrative, salesAssistant">
</vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal margin-medium-bottom> <vn-horizontal margin-medium-bottom>
<vn-one> <vn-one>
<vn-check label="Received core VNH" field="$ctrl.client.hasCoreVnh" vn-acl="administrative"></vn-check> <vn-check
label="Received core VNH"
field="$ctrl.client.hasCoreVnh"
vn-acl="administrative, salesAssistant">
</vn-check>
</vn-one> </vn-one>
<vn-one> <vn-one>
<vn-check label="Received core VNL" field="$ctrl.client.hasCoreVnl" vn-acl="administrative"></vn-check> <vn-check
label="Received core VNL"
field="$ctrl.client.hasCoreVnl"
vn-acl="administrative, salesAssistant">
</vn-check>
</vn-one> </vn-one>
<vn-one> <vn-one>
<vn-check label="Received B2B VNL" field="$ctrl.client.hasSepaVnl" vn-acl="administrative"></vn-check> <vn-check
label="Received B2B VNL"
field="$ctrl.client.hasSepaVnl"
vn-acl="administrative, salesAssistant">
</vn-check>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-button-bar> <vn-button-bar>
<vn-submit label="Save" vn-acl="administrative"></vn-submit> <vn-submit label="Save" vn-acl="administrative, salesAssistant"></vn-submit>
</vn-button-bar> </vn-button-bar>
</form> </form>
<vn-confirm <vn-confirm

View File

@ -14,21 +14,21 @@
vn-focus vn-focus
label="Social name" label="Social name"
field="$ctrl.client.socialName" field="$ctrl.client.socialName"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
vn-one vn-one
label="Tax number" label="Tax number"
field="$ctrl.client.fi" field="$ctrl.client.fi"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-textfield> </vn-textfield>
<vn-check <vn-check
vn-one vn-one
label="Is equalizated" label="Is equalizated"
field="$ctrl.client.isEqualizated" field="$ctrl.client.isEqualizated"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
@ -37,14 +37,14 @@
vn-two vn-two
label="Street" label="Street"
field="$ctrl.client.street" field="$ctrl.client.street"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-textfield> </vn-textfield>
<vn-textfield <vn-textfield
vn-one vn-one
label="City" label="City"
field="$ctrl.client.city" field="$ctrl.client.city"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
@ -53,7 +53,7 @@
vn-one vn-one
label="Postcode" label="Postcode"
field="$ctrl.client.postcode" field="$ctrl.client.postcode"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-textfield> </vn-textfield>
<vn-autocomplete <vn-autocomplete
@ -64,7 +64,7 @@
show-field="name" show-field="name"
value-field="id" value-field="id"
label="Province" label="Province"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete <vn-autocomplete
@ -75,7 +75,7 @@
show-field="country" show-field="country"
value-field="id" value-field="id"
label="Country" label="Country"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
@ -84,21 +84,21 @@
vn-one vn-one
label="Active" label="Active"
field="$ctrl.client.isActive" field="$ctrl.client.isActive"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-check> </vn-check>
<vn-check <vn-check
vn-one vn-one
label="Invoice by address" label="Invoice by address"
field="$ctrl.client.hasToInvoiceByAddress" field="$ctrl.client.hasToInvoiceByAddress"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-check> </vn-check>
<vn-check <vn-check
vn-one vn-one
label="Verified data" label="Verified data"
field="$ctrl.client.isTaxDataChecked" field="$ctrl.client.isTaxDataChecked"
vn-acl="administrative"> vn-acl="administrative, salesAssistant, salesAssistant">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
@ -106,21 +106,21 @@
vn-one vn-one
label="Has to invoice" label="Has to invoice"
field="$ctrl.client.hasToInvoice" field="$ctrl.client.hasToInvoice"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-check> </vn-check>
<vn-check <vn-check
vn-one vn-one
label="Invoice by mail" label="Invoice by mail"
field="$ctrl.client.isToBeMailed" field="$ctrl.client.isToBeMailed"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-check> </vn-check>
<vn-check <vn-check
vn-one vn-one
label="Vies" label="Vies"
field="$ctrl.client.isVies" field="$ctrl.client.isVies"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
@ -128,7 +128,7 @@
<vn-button-bar> <vn-button-bar>
<vn-submit <vn-submit
label="Save" label="Save"
vn-acl="administrative, salesPerson" vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}"> acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
</vn-submit> </vn-submit>
</vn-button-bar> </vn-button-bar>

View File

@ -18,7 +18,7 @@
<vn-float-button <vn-float-button
icon="edit" icon="edit"
style="position: absolute; margin: 1em; bottom: 0; right: 0;" style="position: absolute; margin: 1em; bottom: 0; right: 0;"
vn-visible-by="administrative"> vn-visible-by="administrative, salesAssistant">
</vn-float-button> </vn-float-button>
</a> </a>
</vn-auto> </vn-auto>

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers'; import createNightmare from '../../helpers/helpers';
describe('lock verified data path', () => { fdescribe('lock verified data path', () => {
const nightmare = createNightmare(); const nightmare = createNightmare();
describe('as salesPerson', () => { describe('as salesPerson', () => {
@ -280,4 +280,193 @@ describe('lock verified data path', () => {
}); });
}); });
}); });
describe('as salesAssistant', () => {
beforeAll(() => {
return nightmare
.waitToClick(selectors.globalItems.logOutButton)
.waitForLogin('salesAssistant');
});
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 salesAssistant', () => {
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 uncheck 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 unchecked', () => {
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).toBeFalsy();
});
});
it('should again edit the social name', () => {
return nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
.type(selectors.clientFiscalData.socialNameInput, 'salesAssistant 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('salesAssistant was here');
});
});
});
describe('as salesPerson third 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 once 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 enabled once again', () => {
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 is enabled 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).not.toContain('is-disabled');
});
});
});
}); });