From d2491bfbf4aa2e43d0969ac2fbb84babb575d440 Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Thu, 9 Nov 2017 08:54:41 +0100 Subject: [PATCH 1/6] refact production list --- services/production/common/methods/fake-production/list.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/services/production/common/methods/fake-production/list.js b/services/production/common/methods/fake-production/list.js index fddb9c310..0ad582160 100644 --- a/services/production/common/methods/fake-production/list.js +++ b/services/production/common/methods/fake-production/list.js @@ -2,9 +2,6 @@ module.exports = function(Self) { Self.defineScope(); Self.list = function(ctx, filter, callback) { - var page = filter.page - 1; - var limit = filter.limit * page; - var offset = (page + 1) * filter.limit; let daysTickets = 0; let warehouseFk = filter.where.warehouseFk; delete filter.limit; @@ -80,7 +77,7 @@ module.exports = function(Self) { }, this); obj.m3 = obj.m3.toFixed(2); obj.total = tickets.length; - obj.tickets = tickets.slice(limit, offset); + obj.tickets = tickets; return obj; } }; From 3d33c21cc81754ef820a74bbd3eaf34cca78fb2e Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Thu, 9 Nov 2017 08:59:40 +0100 Subject: [PATCH 2/6] removed eslint errors --- services/loopback/common/models/vn-model.js | 30 ++++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/services/loopback/common/models/vn-model.js b/services/loopback/common/models/vn-model.js index 72605a808..3305cb67d 100644 --- a/services/loopback/common/models/vn-model.js +++ b/services/loopback/common/models/vn-model.js @@ -45,18 +45,20 @@ module.exports = function(Self) { }); this.list = function(ctx, clientFilter, cb) { - var clientFields = (clientFilter && clientFilter.fields) ? clientFilter.fields : []; - var serverFields = (serverFilter && serverFilter.fields) ? serverFilter.fields : []; - var fields = clientFields.filter(itemC => { + let clientFields = (clientFilter && clientFilter.fields) ? clientFilter.fields : []; + let serverFields = (serverFilter && serverFilter.fields) ? serverFilter.fields : []; + let fields = clientFields.filter(itemC => { return serverFields.some(itemS => itemS === itemC); }); + let and = []; + let order; + let limit; + let filter = {order: order, limit: limit}; - var and = []; - (clientFilter && clientFilter.where) && and.push(clientFilter.where); - (serverFilter && serverFilter.where) && and.push(serverFilter.where); - - var order; - var limit; + if (clientFilter && clientFilter.where) + and.push(clientFilter.where); + if (serverFilter && serverFilter.where) + and.push(serverFilter.where); if (clientFilter && clientFilter.order) order = clientFilter.order; @@ -68,12 +70,14 @@ module.exports = function(Self) { else if (clientFilter && clientFilter.limit) limit = clientFilter.limit; - var filter = {order: order, limit: limit}; filter.where = (and.length > 0) && {and: and}; filter.fields = fields; this.find(filter, function(err, states) { - (err) ? cb(err, null) : cb(null, states); + if (err) + cb(err, null); + else + cb(null, states); }); }; }; @@ -198,8 +202,8 @@ function removeEmpty(o) { let array = []; for (let item of o) { let i = removeEmpty(item); - if (!isEmpty(item)) - array.push(item); + if (!isEmpty(i)) + array.push(i); } if (array.length > 0) return array; From bc43d5c3c42b0f77783a00b898ecf773c565edc5 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 09:03:41 +0100 Subject: [PATCH 3/6] refactor on e2e selectors and discal data spec --- .gitignore | 3 +- e2e/helpers/selectors.js | 1 + e2e/paths/edit_fiscal_data.spec.js | 60 ++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c78df1df6..81519f667 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ +.DS_Store node_modules build npm-debug.log debug.log datasources.development.json -.idea \ No newline at end of file +.idea diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 97c496bbf..1b772561c 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -53,6 +53,7 @@ export default { invoiceByMailCheckboxLabel: `${components.vnCheck}[label='Invoice by mail'] > label`, invoiceByMailCheckboxInput: `${components.vnCheck}[label='Invoice by mail'] > label > label > input`, addressInput: `${components.vnTextfield}[name="street"]`, + cityInput: `${components.vnTextfield}[name="city"]`, saveButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-button-bar > vn-submit > input' } }; diff --git a/e2e/paths/edit_fiscal_data.spec.js b/e2e/paths/edit_fiscal_data.spec.js index add095d7c..686700b37 100644 --- a/e2e/paths/edit_fiscal_data.spec.js +++ b/e2e/paths/edit_fiscal_data.spec.js @@ -132,4 +132,64 @@ describe('Edit fiscalData path', () => { }) .catch(catchErrors(done)); }); + + it(`should edit the address`, done => { + nightmare + .wait(selectors.fiscalData.addressInput) + .clearInput(selectors.fiscalData.addressInput) + .type(selectors.fiscalData.addressInput, 'Alpha Flight Low-Orbit') + .click(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual(`¡Datos guardados!`); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should confirm the address have been edited`, done => { + nightmare + .waitForSnackbarReset() + .click(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .click(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.addressInput) + .getInputValue(selectors.fiscalData.addressInput) + .then(result => { + expect(result).toEqual(`Alpha Flight Low-Orbit`); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should edit the city`, done => { + nightmare + .wait(selectors.fiscalData.cityInput) + .clearInput(selectors.fiscalData.cityInput) + .type(selectors.fiscalData.cityInput, 'N/A') + .click(selectors.fiscalData.saveButton) + .wait(selectors.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual(`¡Datos guardados!`); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should confirm the acity have been edited`, done => { + nightmare + .waitForSnackbarReset() + .click(selectors.basicData.basicDataButton) + .wait(selectors.basicData.nameInput) + .click(selectors.fiscalData.fiscalDataButton) + .wait(selectors.fiscalData.cityInput) + .getInputValue(selectors.fiscalData.cityInput) + .then(result => { + expect(result).toEqual(`N/A`); + done(); + }) + .catch(catchErrors(done)); + }); }); From 792bf6ce66da771fdea260a2ce65718bf8254669 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 09:25:26 +0100 Subject: [PATCH 4/6] encoding UTF-8 --- e2e/paths/edit_basic_data.spec.js | 18 +++++++++--------- e2e/paths/edit_fiscal_data.spec.js | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/e2e/paths/edit_basic_data.spec.js b/e2e/paths/edit_basic_data.spec.js index 0c8436a0c..233e3311f 100644 --- a/e2e/paths/edit_basic_data.spec.js +++ b/e2e/paths/edit_basic_data.spec.js @@ -81,7 +81,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -111,7 +111,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -141,7 +141,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -171,7 +171,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -201,7 +201,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -231,7 +231,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -261,7 +261,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -290,7 +290,7 @@ describe('Edit basicData path', () => { // .wait(selectors.globalItems.snackbarIsActive) // .getInnerText(selectors.globalItems.snackbarIsActive) // .then(result => { - // expect(result).toEqual(`¡Datos guardados!`); + // expect(result).toEqual(`ยกDatos guardados!`); // done(); // }) // .catch(catchErrors(done)); @@ -305,7 +305,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); diff --git a/e2e/paths/edit_fiscal_data.spec.js b/e2e/paths/edit_fiscal_data.spec.js index 686700b37..9bbecb328 100644 --- a/e2e/paths/edit_fiscal_data.spec.js +++ b/e2e/paths/edit_fiscal_data.spec.js @@ -80,7 +80,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('ยกDatos guardados!'); done(); }) .catch(catchErrors(done)); @@ -110,7 +110,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('¡Datos guardados!'); + expect(result).toEqual('ยกDatos guardados!'); done(); }) .catch(catchErrors(done)); @@ -142,7 +142,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); @@ -172,7 +172,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual(`ยกDatos guardados!`); done(); }) .catch(catchErrors(done)); From 297c0afe76e256fa5151cfccb6c92d080f8d2d9e Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 09:27:27 +0100 Subject: [PATCH 5/6] encoding bug corrected --- e2e/paths/edit_basic_data.spec.js | 18 +++++++++--------- e2e/paths/edit_fiscal_data.spec.js | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/e2e/paths/edit_basic_data.spec.js b/e2e/paths/edit_basic_data.spec.js index 233e3311f..0c8436a0c 100644 --- a/e2e/paths/edit_basic_data.spec.js +++ b/e2e/paths/edit_basic_data.spec.js @@ -81,7 +81,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -111,7 +111,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -141,7 +141,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -171,7 +171,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -201,7 +201,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -231,7 +231,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -261,7 +261,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -290,7 +290,7 @@ describe('Edit basicData path', () => { // .wait(selectors.globalItems.snackbarIsActive) // .getInnerText(selectors.globalItems.snackbarIsActive) // .then(result => { - // expect(result).toEqual(`ยกDatos guardados!`); + // expect(result).toEqual(`¡Datos guardados!`); // done(); // }) // .catch(catchErrors(done)); @@ -305,7 +305,7 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); diff --git a/e2e/paths/edit_fiscal_data.spec.js b/e2e/paths/edit_fiscal_data.spec.js index 9bbecb328..686700b37 100644 --- a/e2e/paths/edit_fiscal_data.spec.js +++ b/e2e/paths/edit_fiscal_data.spec.js @@ -80,7 +80,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('ยกDatos guardados!'); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); @@ -110,7 +110,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual('ยกDatos guardados!'); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); @@ -142,7 +142,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); @@ -172,7 +172,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`ยกDatos guardados!`); + expect(result).toEqual(`¡Datos guardados!`); done(); }) .catch(catchErrors(done)); From 8763b24416c311d80d90a554902aacdd9a7f9492 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 09:41:05 +0100 Subject: [PATCH 6/6] renamed files with encoding conflicts --- e2e/paths/{edit_basic_data.spec.js => _edit_basic_data.spec.js} | 0 .../{edit_fiscal_data.spec.js => _edit_fiscal_data.spec.js} | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename e2e/paths/{edit_basic_data.spec.js => _edit_basic_data.spec.js} (100%) rename e2e/paths/{edit_fiscal_data.spec.js => _edit_fiscal_data.spec.js} (99%) diff --git a/e2e/paths/edit_basic_data.spec.js b/e2e/paths/_edit_basic_data.spec.js similarity index 100% rename from e2e/paths/edit_basic_data.spec.js rename to e2e/paths/_edit_basic_data.spec.js diff --git a/e2e/paths/edit_fiscal_data.spec.js b/e2e/paths/_edit_fiscal_data.spec.js similarity index 99% rename from e2e/paths/edit_fiscal_data.spec.js rename to e2e/paths/_edit_fiscal_data.spec.js index 686700b37..231399b54 100644 --- a/e2e/paths/edit_fiscal_data.spec.js +++ b/e2e/paths/_edit_fiscal_data.spec.js @@ -178,7 +178,7 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it(`should confirm the acity have been edited`, done => { + it(`should confirm the city have been edited`, done => { nightmare .waitForSnackbarReset() .click(selectors.basicData.basicDataButton)