From 49486f302eb92131113d0dc14272163e9713cbe5 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Tue, 9 Jan 2018 15:31:25 +0100 Subject: [PATCH 1/2] corrected maxTimer usage in gulpfile watiForMySQL task plus some more e2e tests for the greuge path --- e2e/helpers/selectors.js | 3 ++ e2e/paths/09_add_greuge.spec.js | 53 +++++++++++++++++++++++++-------- gulpfile.js | 2 +- 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index a63c03beb8..514abb232d 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -129,6 +129,9 @@ export default { greugeButton: `${components.vnMenuItem}[ui-sref="clientCard.greuge.list"]`, addGreugeFloatButton: `${components.vnFloatButton}`, amountInput: `${components.vnTextfield}[name="Amount"]`, + descriptionInput: `${components.vnTextfield}[name="Description"]`, + typeInput: `${components.vnAutocomplete}[field="$ctrl.greuge.greugeTypeFk"] > vn-vertical > ${components.vnTextfield}`, + typeSecondOption: `${components.vnAutocomplete}[field="$ctrl.greuge.greugeTypeFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-auto:nth-child(2) > ul > li`, saveButton: `${components.vnSubmit}` // firstGreugeText: '' } diff --git a/e2e/paths/09_add_greuge.spec.js b/e2e/paths/09_add_greuge.spec.js index 83c18702a5..838f6dcddf 100644 --- a/e2e/paths/09_add_greuge.spec.js +++ b/e2e/paths/09_add_greuge.spec.js @@ -96,7 +96,19 @@ fdescribe('Add greuge path', () => { .catch(catchErrors(done)); }); - it(`should add a new greuge`, done => { + it(`should receive an error if all fields are empty but date on submit`, done => { + nightmare + .click(selectors.credit.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Error'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should receive an error if all fields are empty but date and amount on submit`, done => { nightmare .type(selectors.greuge.amountInput, 999) .click(selectors.credit.saveButton) @@ -109,15 +121,32 @@ fdescribe('Add greuge path', () => { .catch(catchErrors(done)); }); - // it('should confirm the credit was updated', done => { - // nightmare - // .waitForSnackbarReset() - // .wait(selectors.credit.firstCreditText) - // .getInnerText(selectors.credit.firstCreditText) - // .then(value => { - // expect(value).toContain(999); - // done(); - // }) - // .catch(catchErrors(done)); - // }); + it(`should receive an error if all fields are empty but date and amount on submit`, done => { + nightmare + .clearInput(selectors.greuge.amountInput) + .type(selectors.greuge.descriptionInput, 'Bat-flying suite with anti-APCR rounds') + .click(selectors.credit.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Error'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should receive an error if all fields are empty but date and type on submit`, done => { + nightmare + .clearInput(selectors.greuge.descriptionInput) + .waitToClick(selectors.greuge.typeInput) + .waitToClick(selectors.greuge.typeSecondOption) + .click(selectors.credit.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toContain('Error'); + done(); + }) + .catch(catchErrors(done)); + }); }); diff --git a/gulpfile.js b/gulpfile.js index 51a2e77180..4c961ba077 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -188,7 +188,7 @@ gulp.task('waitForMySQL', callback => { } }); } else { - console.log('MySQL connection not established whithin 15 secs!'); + console.log(`MySQL connection not established whithin ${maxInterval / 1000} secs!`); clearInterval(waitForLocaldb); } }, interval); From b2bfcb7b3f5d6bc67436af2e0234cc8275a26570 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Wed, 10 Jan 2018 14:03:52 +0100 Subject: [PATCH 2/2] docker container time correction plus small refactor on validator.js --- client/core/src/lib/validator.js | 2 +- e2e/paths/09_add_greuge.spec.js | 2 +- services/db/Dockerfile | 1 + services/production/common/models/ticket-state.js | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/core/src/lib/validator.js b/client/core/src/lib/validator.js index 580f1fc5e8..704961318e 100644 --- a/client/core/src/lib/validator.js +++ b/client/core/src/lib/validator.js @@ -14,7 +14,7 @@ export const validators = { min: conf.min || conf.is, max: conf.max || conf.is }; - let val = String(value); + let val = value ? String(value) : ''; if (!validator.isLength(val, options)) { if (conf.is) { throw new Error(`Value should be ${conf.is} characters long`); diff --git a/e2e/paths/09_add_greuge.spec.js b/e2e/paths/09_add_greuge.spec.js index 838f6dcddf..0846ab5aa2 100644 --- a/e2e/paths/09_add_greuge.spec.js +++ b/e2e/paths/09_add_greuge.spec.js @@ -7,7 +7,7 @@ const moduleAccessViewHashURL = '#!/'; jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; -fdescribe('Add greuge path', () => { +describe('Add greuge path', () => { describe('warm up', () => { it('should warm up login and fixtures', done => { nightmare diff --git a/services/db/Dockerfile b/services/db/Dockerfile index ba6c150b10..075a63b516 100644 --- a/services/db/Dockerfile +++ b/services/db/Dockerfile @@ -1,6 +1,7 @@ FROM mysql:5.6.37 ENV MYSQL_ALLOW_EMPTY_PASSWORD yes +ENV TZ GMT-1 COPY localDB01StructureAccount.sql /docker-entrypoint-initdb.d COPY localDB02StructureVn2008.sql /docker-entrypoint-initdb.d diff --git a/services/production/common/models/ticket-state.js b/services/production/common/models/ticket-state.js index 4c320c203f..2580d98db2 100644 --- a/services/production/common/models/ticket-state.js +++ b/services/production/common/models/ticket-state.js @@ -1,4 +1,4 @@ module.exports = function(Self) { require('../methods/ticket-state/change-state.js')(Self); -}; \ No newline at end of file +};