From 7b5bf2235fa6cbf0f7f1e287df1c8d2c6eba0296 Mon Sep 17 00:00:00 2001
From: Carlos Jimenez <=>
Date: Mon, 12 Mar 2018 09:19:50 +0100
Subject: [PATCH 1/4] renamed e2e tasks to call docker task instead of
docker-rebuild
---
gulpfile.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gulpfile.js b/gulpfile.js
index 7c9be4d95..e1b3df473 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -63,11 +63,11 @@ gulp.task('services-only', async () => {
/**
* Runs the e2e tests, restoring the fixtures first.
*/
-gulp.task('e2e', ['docker-rebuild'], async () => {
+gulp.task('e2e', ['docker'], async () => {
await runSequenceP('e2e-only');
});
-gulp.task('smokes', ['docker-rebuild'], async () => {
+gulp.task('smokes', ['docker'], async () => {
await runSequenceP('smokes-only');
});
@@ -416,7 +416,7 @@ gulp.task('docker', async () => {
* Does the minium effort to start the docker, if it doesn't exists calls
* the 'docker-run' task, if it is started does nothing. Keep in mind that when
* you do not rebuild the docker you may be using an outdated version of it.
- * See the 'docker-rebuild' task for more info.
+ * See the 'docker' task for more info.
*/
gulp.task('docker-start', async () => {
let state;
From ca2b84f73c7fb580c80fbef6bc442887178d8fd8 Mon Sep 17 00:00:00 2001
From: Carlos Jimenez <=>
Date: Mon, 12 Mar 2018 10:23:24 +0100
Subject: [PATCH 2/4] fixed descriptor test
---
client/client/src/descriptor/descriptor.spec.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/client/src/descriptor/descriptor.spec.js b/client/client/src/descriptor/descriptor.spec.js
index a5139298f..19e2d2c7c 100644
--- a/client/client/src/descriptor/descriptor.spec.js
+++ b/client/client/src/descriptor/descriptor.spec.js
@@ -17,7 +17,7 @@ describe('Descriptor', () => {
}));
describe('_getClientDebt()', () => {
- it(`should call _getClientDebt() and define the client.debt value on the controller`, () => {
+ it(`should call _getClientDebt() and define the clientDebt value on the controller`, () => {
controller.client = {};
let response = {debt: 100};
$httpBackend.whenGET(`/client/api/Clients/101/getDebt`).respond(response);
@@ -25,7 +25,7 @@ describe('Descriptor', () => {
controller._getClientDebt(101);
$httpBackend.flush();
- expect(controller.client.debt).toEqual(100);
+ expect(controller.clientDebt).toEqual(100);
});
});
From edf2e61bd073da46a97fc83925eb89e9bc416396 Mon Sep 17 00:00:00 2001
From: Carlos Jimenez <=>
Date: Mon, 12 Mar 2018 11:10:05 +0100
Subject: [PATCH 3/4] #168 client permissions plus e2e path verified data
update
---
.../client/src/address-edit/address-edit.html | 6 +-
.../client/src/billing-data/billing-data.html | 34 +++-
.../client/src/fiscal-data/fiscal-data.html | 30 +--
.../item/src/descriptor/item-descriptor.html | 2 +-
.../12_lock_of_verified_data.spec.js | 191 +++++++++++++++++-
5 files changed, 238 insertions(+), 25 deletions(-)
diff --git a/client/client/src/address-edit/address-edit.html b/client/client/src/address-edit/address-edit.html
index a5830d715..55154a996 100644
--- a/client/client/src/address-edit/address-edit.html
+++ b/client/client/src/address-edit/address-edit.html
@@ -15,7 +15,11 @@
Address
-
+
+
diff --git a/client/client/src/billing-data/billing-data.html b/client/client/src/billing-data/billing-data.html
index b9d117d31..2a097179a 100644
--- a/client/client/src/billing-data/billing-data.html
+++ b/client/client/src/billing-data/billing-data.html
@@ -10,30 +10,50 @@
Pay method
-
-
+
+
+
+
-
+
+
-
+
+
-
+
+
-
+
@@ -37,14 +37,14 @@
vn-two
label="Street"
field="$ctrl.client.street"
- vn-acl="administrative, salesPerson"
+ vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
@@ -53,7 +53,7 @@
vn-one
label="Postcode"
field="$ctrl.client.postcode"
- vn-acl="administrative, salesPerson"
+ vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
@@ -84,21 +84,21 @@
vn-one
label="Active"
field="$ctrl.client.isActive"
- vn-acl="administrative, salesPerson"
+ vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
+ vn-acl="administrative, salesAssistant, salesAssistant">
@@ -106,21 +106,21 @@
vn-one
label="Has to invoice"
field="$ctrl.client.hasToInvoice"
- vn-acl="administrative, salesPerson"
+ vn-acl="administrative, salesAssistant, salesPerson"
acl-conditional-to-salesPerson="{{!$ctrl.client.isTaxDataChecked}}">
@@ -128,7 +128,7 @@
diff --git a/client/item/src/descriptor/item-descriptor.html b/client/item/src/descriptor/item-descriptor.html
index e9a225502..38002ed5a 100644
--- a/client/item/src/descriptor/item-descriptor.html
+++ b/client/item/src/descriptor/item-descriptor.html
@@ -18,7 +18,7 @@
+ vn-visible-by="administrative, salesAssistant">
diff --git a/e2e/paths/client-module/12_lock_of_verified_data.spec.js b/e2e/paths/client-module/12_lock_of_verified_data.spec.js
index a3d8a3dae..ae94d8107 100644
--- a/e2e/paths/client-module/12_lock_of_verified_data.spec.js
+++ b/e2e/paths/client-module/12_lock_of_verified_data.spec.js
@@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
-describe('lock verified data path', () => {
+fdescribe('lock verified data path', () => {
const nightmare = createNightmare();
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');
+ });
+ });
+ });
});
From 783d1b2b219a4e78d8c9c080f07ca3372fed82eb Mon Sep 17 00:00:00 2001
From: Carlos Jimenez <=>
Date: Mon, 12 Mar 2018 11:17:06 +0100
Subject: [PATCH 4/4] #168 verified data spec update
---
e2e/paths/client-module/12_lock_of_verified_data.spec.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/e2e/paths/client-module/12_lock_of_verified_data.spec.js b/e2e/paths/client-module/12_lock_of_verified_data.spec.js
index ae94d8107..764476e62 100644
--- a/e2e/paths/client-module/12_lock_of_verified_data.spec.js
+++ b/e2e/paths/client-module/12_lock_of_verified_data.spec.js
@@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
-fdescribe('lock verified data path', () => {
+describe('lock verified data path', () => {
const nightmare = createNightmare();
describe('as salesPerson', () => {