This commit is contained in:
Vicente Falco 2017-11-09 07:34:17 +01:00
commit 14820fbb3e
21 changed files with 121 additions and 93 deletions

5
Jenkinsfile vendored
View File

@ -34,6 +34,11 @@ node
stage ("docker") stage ("docker")
{ {
stage ("install modules loopback service")
{
sh "cd ./services/loopback && npm install"
}
stage ("Stopping/Removing Docker") stage ("Stopping/Removing Docker")
{ {
sh "docker-compose down --rmi all" sh "docker-compose down --rmi all"

View File

@ -11,10 +11,10 @@
<vn-title>Fiscal data</vn-title> <vn-title>Fiscal data</vn-title>
<vn-horizontal> <vn-horizontal>
<vn-one> <vn-one>
<vn-check label="Facturar" field="$ctrl.client.hasToInvoice"></vn-check> <vn-check label="Has to invoice" field="$ctrl.client.hasToInvoice"></vn-check>
</vn-one> </vn-one>
<vn-one> <vn-one>
<vn-check label="Factura impresa" field="$ctrl.client.invoiceByEmail"></vn-check> <vn-check label="Invoice by mail" field="$ctrl.client.invoiceByEmail"></vn-check>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
@ -37,7 +37,7 @@
url="/client/api/Countries" url="/client/api/Countries"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="País"> label="CountryFk">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
</vn-vertical> </vn-vertical>

View File

@ -1,5 +1,8 @@
{ {
"Client": "Cliente", "Client": "Cliente",
"Clients": "Clientes", "Clients": "Clientes",
"Fiscal data": "Datos Fiscales" "Fiscal data": "Datos Fiscales",
"Has to invoice": "Factura",
"Invoice by mail": "Factura impresa",
"CountryFk": "País"
} }

View File

@ -1,6 +1,7 @@
<paging <paging
page="$ctrl.currentPage" page="$ctrl.currentPage"
page-size="$ctrl.numPerPage" page-size="$ctrl.numPerPage"
ng-if="$ctrl.numPages>1"
total="$ctrl.numItems" total="$ctrl.numItems"
show-prev-next="true" show-prev-next="true"
show-first-last="false" show-first-last="false"

View File

@ -138,7 +138,6 @@ export default class ProductionIndex {
this.hourItems.push({id: i, name: hour}); this.hourItems.push({id: i, name: hour});
} }
this.filter.warehouseFk = this.$.displayValue = this.userProfile.warehouseId; this.filter.warehouseFk = this.$.displayValue = this.userProfile.warehouseId;
// this.searchTickets(this.filter);
} }
} }

View File

@ -4,7 +4,7 @@ export class ProductionTable {
constructor($filter) { constructor($filter) {
this.$filter = $filter; this.$filter = $filter;
this._tickets = []; this._tickets = [];
this.itemsDisplayedInList = 14; this.itemsDisplayedInList = 16;
this._checkAll = 0; this._checkAll = 0;
this.pageTable = { this.pageTable = {
filter: { filter: {

View File

@ -87,6 +87,8 @@ services:
- "80" - "80"
ports: ports:
- "80:80" - "80:80"
depends_on:
- route
links: links:
- "${BRANCH_NAME}-auth:auth" - "${BRANCH_NAME}-auth:auth"
- "${BRANCH_NAME}-salix:salix" - "${BRANCH_NAME}-salix:salix"

View File

@ -13,5 +13,6 @@ export default {
vnItemClient: 'vn-item-client', vnItemClient: 'vn-item-client',
vnFloatButton: 'vn-float-button > button', vnFloatButton: 'vn-float-button > button',
vnMenuItem: 'vn-menu-item > li > a', vnMenuItem: 'vn-menu-item > li > a',
vnAutocomplete: 'vn-autocomplete' vnAutocomplete: 'vn-autocomplete',
vnCheck: 'vn-check'
}; };

View File

@ -27,7 +27,7 @@ Nightmare.action('getInnerText', function(selector, done) {
Nightmare.action('getInputValue', function(selector, done) { Nightmare.action('getInputValue', function(selector, done) {
this.wait(selector) this.wait(selector)
.evaluate_now(function(elementToSelect) { .evaluate_now(function(elementToSelect) {
return document.querySelectorAll(elementToSelect)[0].value; return document.querySelector(elementToSelect).value;
}, done, selector); }, done, selector);
}); });

View File

@ -1,16 +1,6 @@
// eslint max-len: ["error", 500] // eslint max-len: ["error", 500]
// eslint key-spacing: ["error", 500] // eslint key-spacing: ["error", 500]
import components from './selector_variables.js'; import components from './components_selectors.js';
function checkElement(selector, attributeValue) {
let aux = selector.split(' ');
if (aux[0] === 'vn-autocomplete') {
return selector.replace(aux[0], `${aux[0]}[field="${attributeValue}"]`);
}
if (aux[0] === 'vn-textfield') {
return selector.replace(aux[4], `${aux[4]}[name="${attributeValue}"]`);
}
}
export default { export default {
login: { login: {
@ -35,34 +25,34 @@ export default {
createClientButton: `${components.vnFloatButton}` createClientButton: `${components.vnFloatButton}`
}, },
createClientView: { createClientView: {
name: `${checkElement(components.vnTextfield, 'name')}`, name: `${components.vnTextfield}[name="name"]`,
taxNumber: `${checkElement(components.vnTextfield, 'fi')}`, taxNumber: `${components.vnTextfield}[name="fi"]`,
socialName: `${checkElement(components.vnTextfield, 'socialName')}`, socialName: `${components.vnTextfield}[name="socialName"]`,
userName: `${checkElement(components.vnTextfield, 'userName')}`, userName: `${components.vnTextfield}[name="userName"]`,
email: `${checkElement(components.vnTextfield, 'email')}`, email: `${components.vnTextfield}[name="email"]`,
createButton: `${components.vnSubmit}` createButton: `${components.vnSubmit}`
}, },
basicData: { basicData: {
basicDataButton: `${components.vnMenuItem}`, basicDataButton: `${components.vnMenuItem}[ui-sref="clientCard.basicData"]`,
nameInput: `${checkElement(components.vnTextfield, 'name')}`, nameInput: `${components.vnTextfield}[name="name"]`,
taxNumberInput: `${checkElement(components.vnTextfield, 'fi')}`, taxNumberInput: `${components.vnTextfield}[name="fi"]`,
socialNameInput: `${checkElement(components.vnTextfield, 'socialName')}`, socialNameInput: `${components.vnTextfield}[name="socialName"]`,
phoneInput: `${checkElement(components.vnTextfield, 'phone')}`, phoneInput: `${components.vnTextfield}[name="phone"]`,
mobileInput: `${checkElement(components.vnTextfield, 'mobile')}`, mobileInput: `${components.vnTextfield}[name="mobile"]`,
faxInput: `${checkElement(components.vnTextfield, 'fax')}`, faxInput: `${components.vnTextfield}[name="fax"]`,
emailInput: `${checkElement(components.vnTextfield, 'email')}`, emailInput: `${components.vnTextfield}[name="email"]`,
salesPersonInput: `${checkElement(components.vnAutocomplete, '$ctrl.client.salesPersonFk')}`, salesPersonInput: `${components.vnAutocomplete}[field="$ctrl.client.salesPersonFk"]`,
channelInput: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-basic-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(4) > vn-autocomplete:nth-child(3) > vn-vertical > vn-textfield > div > input', channelInput: `${components.vnAutocomplete}[field="$ctrl.client.contactChannelFk"] > vn-vertical > ${components.vnTextfield}`,
channelMetropolisOption: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-basic-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(4) > vn-autocomplete:nth-child(3) > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(2) > ul > li:nth-child(3)', channelMetropolisOption: `${components.vnAutocomplete}[field="$ctrl.client.contactChannelFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(2) > ul > li:nth-child(3)`,
saveButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-basic-data > form > vn-button-bar > vn-submit > input' saveButton: `${components.vnSubmit}`
}, },
fiscalData: { fiscalData: {
fiscalDataButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-empty > vn-left-menu > vn-card > div > vn-vertical > vn-actions > vn-horizontal > ul > vn-menu-item:nth-child(2) > li > a', fiscalDataButton: `${components.vnMenuItem}[ui-sref="clientCard.fiscalData"]`,
addressInput: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(3) > vn-textfield:nth-child(1) > div > input', hasToInvoiceCheckboxLabel: `${components.vnCheck}[label='Has to invoice'] > label`,
hasToInvoiceCheckboxLabel: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-one:nth-child(1) > vn-check > label', hasToInvoiceCheckboxInput: `${components.vnCheck}[label='Has to invoice'] > label > label > input`,
hasToInvoiceCheckboxInput: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-one:nth-child(1) > vn-check > label > input', invoiceByMailCheckboxLabel: `${components.vnCheck}[label='Invoice by mail'] > label`,
// printToInvoiceCheckboxLabel: '', invoiceByMailCheckboxInput: `${components.vnCheck}[label='Invoice by mail'] > label > label > input`,
// printInvoiceCheckboxInput: '', addressInput: `${components.vnTextfield}[name="street"]`,
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' 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'
} }
}; };

View File

@ -25,7 +25,7 @@ describe('create client path', () => {
.waitForURL(moduleAccessViewHashURL) .waitForURL(moduleAccessViewHashURL)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + moduleAccessViewHashURL); expect(url).toEqual(config.url + moduleAccessViewHashURL);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -37,7 +37,7 @@ describe('create client path', () => {
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + '#!/clients'); expect(url).toEqual(config.url + '#!/clients');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -51,7 +51,7 @@ describe('create client path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 0)
.countSearchResults(selectors.clientsIndex.searchResult) .countSearchResults(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toBe(0); expect(result).toEqual(0);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -63,7 +63,7 @@ describe('create client path', () => {
.wait(selectors.createClientView.createButton) .wait(selectors.createClientView.createButton)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + '#!/create'); expect(url).toEqual(config.url + '#!/create');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -75,7 +75,7 @@ describe('create client path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe('No hay cambios que guardar'); expect(result).toEqual('No hay cambios que guardar');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -149,7 +149,7 @@ describe('create client path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`Algunos campos no son válidos`); expect(result).toEqual(`Algunos campos no son válidos`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -198,7 +198,7 @@ describe('create client path', () => {
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + '#!/clients'); expect(url).toEqual(config.url + '#!/clients');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -212,7 +212,7 @@ describe('create client path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult) .countSearchResults(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toBe(1); expect(result).toEqual(1);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));

View File

@ -25,7 +25,7 @@ describe('Edit basicData path', () => {
.waitForURL(moduleAccessViewHashURL) .waitForURL(moduleAccessViewHashURL)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + moduleAccessViewHashURL); expect(url).toEqual(config.url + moduleAccessViewHashURL);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -39,7 +39,7 @@ describe('Edit basicData path', () => {
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + '#!/clients'); expect(url).toEqual(config.url + '#!/clients');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -53,7 +53,7 @@ describe('Edit basicData path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult) .countSearchResults(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toBe(1); expect(result).toEqual(1);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -81,7 +81,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -96,7 +96,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.nameInput) .wait(selectors.basicData.nameInput)
.getInputValue(selectors.basicData.nameInput) .getInputValue(selectors.basicData.nameInput)
.then(result => { .then(result => {
expect(result).toBe(`Carol Danvers Edited`); expect(result).toEqual(`Carol Danvers Edited`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -111,7 +111,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -126,7 +126,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.taxNumberInput) .wait(selectors.basicData.taxNumberInput)
.getInputValue(selectors.basicData.taxNumberInput) .getInputValue(selectors.basicData.taxNumberInput)
.then(result => { .then(result => {
expect(result).toBe(`AVG tax Edited`); expect(result).toEqual(`AVG tax Edited`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -141,7 +141,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -156,7 +156,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.socialNameInput) .wait(selectors.basicData.socialNameInput)
.getInputValue(selectors.basicData.socialNameInput) .getInputValue(selectors.basicData.socialNameInput)
.then(result => { .then(result => {
expect(result).toBe(`Avengers Team Edited`); expect(result).toEqual(`Avengers Team Edited`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -171,7 +171,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -186,7 +186,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.phoneInput) .wait(selectors.basicData.phoneInput)
.getInputValue(selectors.basicData.phoneInput) .getInputValue(selectors.basicData.phoneInput)
.then(result => { .then(result => {
expect(result).toBe('123456789'); expect(result).toEqual('123456789');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -201,7 +201,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -216,7 +216,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.mobileInput) .wait(selectors.basicData.mobileInput)
.getInputValue(selectors.basicData.mobileInput) .getInputValue(selectors.basicData.mobileInput)
.then(result => { .then(result => {
expect(result).toBe('987654321'); expect(result).toEqual('987654321');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -231,7 +231,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -246,7 +246,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.faxInput) .wait(selectors.basicData.faxInput)
.getInputValue(selectors.basicData.faxInput) .getInputValue(selectors.basicData.faxInput)
.then(result => { .then(result => {
expect(result).toBe('432198765'); expect(result).toEqual('432198765');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -261,7 +261,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -276,7 +276,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.emailInput) .wait(selectors.basicData.emailInput)
.getInputValue(selectors.basicData.emailInput) .getInputValue(selectors.basicData.emailInput)
.then(result => { .then(result => {
expect(result).toBe('CarolDanversEdited@verdnatura.es'); expect(result).toEqual('CarolDanversEdited@verdnatura.es');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -290,7 +290,7 @@ describe('Edit basicData path', () => {
// .wait(selectors.globalItems.snackbarIsActive) // .wait(selectors.globalItems.snackbarIsActive)
// .getInnerText(selectors.globalItems.snackbarIsActive) // .getInnerText(selectors.globalItems.snackbarIsActive)
// .then(result => { // .then(result => {
// expect(result).toBe(`¡Datos guardados!`); // expect(result).toEqual(`¡Datos guardados!`);
// done(); // done();
// }) // })
// .catch(catchErrors(done)); // .catch(catchErrors(done));
@ -305,7 +305,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -320,7 +320,7 @@ describe('Edit basicData path', () => {
.wait(100) .wait(100)
.getInputValue(selectors.basicData.channelInput) .getInputValue(selectors.basicData.channelInput)
.then(result => { .then(result => {
expect(result).toBe('Metropolis newspaper'); expect(result).toEqual('Metropolis newspaper');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));

View File

@ -25,7 +25,7 @@ describe('Edit fiscalData path', () => {
.waitForURL(moduleAccessViewHashURL) .waitForURL(moduleAccessViewHashURL)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + moduleAccessViewHashURL); expect(url).toEqual(config.url + moduleAccessViewHashURL);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -39,7 +39,7 @@ describe('Edit fiscalData path', () => {
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + '#!/clients'); expect(url).toEqual(config.url + '#!/clients');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -53,7 +53,7 @@ describe('Edit fiscalData path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult) .countSearchResults(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toBe(1); expect(result).toEqual(1);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -80,7 +80,7 @@ describe('Edit fiscalData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe('¡Datos guardados!'); expect(result).toEqual('¡Datos guardados!');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -95,7 +95,37 @@ describe('Edit fiscalData path', () => {
.wait(selectors.fiscalData.hasToInvoiceCheckboxLabel) .wait(selectors.fiscalData.hasToInvoiceCheckboxLabel)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.fiscalData.hasToInvoiceCheckboxInput) }, selectors.fiscalData.hasToInvoiceCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
done();
})
.catch(catchErrors(done));
});
it(`should uncheck the invoiceByMail checkbox`, done => {
nightmare
.waitToClick(selectors.fiscalData.invoiceByMailCheckboxLabel)
.waitToClick(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 invoiceByMail checkbox is unchecked`, done => {
nightmare
.waitForSnackbarReset()
.waitToClick(selectors.basicData.basicDataButton)
.wait(selectors.basicData.nameInput)
.waitToClick(selectors.fiscalData.fiscalDataButton)
.wait(selectors.fiscalData.invoiceByMailCheckboxLabel)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.fiscalData.invoiceByMailCheckboxLabel)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
done(); done();

View File

@ -4,8 +4,6 @@ COPY auth /app
COPY loopback /loopback COPY loopback /loopback
RUN npm install loopback
WORKDIR /app WORKDIR /app
RUN npm install RUN npm install

View File

@ -4,8 +4,6 @@ COPY client /app
COPY loopback /loopback COPY loopback /loopback
RUN npm install loopback
WORKDIR /app WORKDIR /app
RUN npm install RUN npm install

View File

@ -13,6 +13,7 @@
"url": "https://git.verdnatura.es/salix" "url": "https://git.verdnatura.es/salix"
}, },
"dependencies": { "dependencies": {
"loopback-context": "^3.3.0" "loopback-context": "^3.3.0",
"request": "^2.83.0"
} }
} }

View File

@ -4,8 +4,6 @@ COPY production /app
COPY loopback /loopback COPY loopback /loopback
RUN npm install loopback
WORKDIR /app WORKDIR /app
RUN npm install RUN npm install

View File

@ -28,6 +28,13 @@ module.exports = function(Self) {
onFinish(err); onFinish(err);
} }
reBuildFilter();
let where = Self.dataSource.connector.buildWhere(Self.modelName, filter.where);
let query = `SELECT * FROM tmp.production ${where.sql} GROUP BY RouteFk ORDER BY routeFk`;
conn.query(query, where.params, onFinish);
}
function reBuildFilter() {
if (filter.where && filter.where.q) { if (filter.where && filter.where.q) {
let regexQ = new RegExp(filter.where.q); let regexQ = new RegExp(filter.where.q);
delete filter.where.q; delete filter.where.q;
@ -53,14 +60,10 @@ module.exports = function(Self) {
} }
filter.where = newFilter; filter.where = newFilter;
} }
let where = Self.dataSource.connector.buildWhere(Self.modelName, filter.where);
let query = `SELECT * FROM FakeProduction_tmp ${where.sql} GROUP BY RouteFk ORDER BY routeFk`;
conn.query(query, where.params, onFinish);
} }
function onFinish(err, results) { function onFinish(err, results) {
conn.query('DROP TEMPORARY TABLE IF EXISTS FakeProduction_tmp'); conn.query('DROP TEMPORARY TABLE IF EXISTS tmp.production');
conn.release(); conn.release();
if (err) if (err)
callback(err); callback(err);

View File

@ -12,5 +12,8 @@
"url": "https://git.verdnatura.es/salix" "url": "https://git.verdnatura.es/salix"
}, },
"license": "GPL-3.0", "license": "GPL-3.0",
"description": "vn-production" "description": "vn-production",
"dependencies": {
"uuid": "^3.1.0"
}
} }

View File

@ -4,8 +4,6 @@ COPY route /app
COPY loopback /loopback COPY loopback /loopback
RUN npm install loopback
WORKDIR /app WORKDIR /app
RUN npm install RUN npm install

View File

@ -4,8 +4,6 @@ COPY salix /app
COPY loopback /loopback COPY loopback /loopback
RUN npm install loopback
WORKDIR /app WORKDIR /app
RUN npm install RUN npm install