Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2145_e2e_linux_fix
This commit is contained in:
commit
9f8035f066
|
@ -32,3 +32,5 @@ rules:
|
|||
indent: [error, 4]
|
||||
arrow-parens: [error, as-needed]
|
||||
jasmine/no-focused-tests: 0
|
||||
no-multiple-empty-lines: ["error", { "max": 1, "maxEOF": 1 }]
|
||||
space-in-parens: ["error", "never"]
|
|
@ -24,8 +24,14 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.sendCheckingPresence = async(ctx, workerId, message) => {
|
||||
if (!workerId) return false;
|
||||
|
||||
const models = Self.app.models;
|
||||
const account = await models.Account.findById(workerId);
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
|
||||
if (!account)
|
||||
throw new Error(`Could not send message "${message}" to worker id ${workerId} from user ${userId}`);
|
||||
|
||||
const query = `SELECT worker_isWorking(?) isWorking`;
|
||||
const [result] = await Self.rawSql(query, [workerId]);
|
||||
|
@ -37,7 +43,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
const department = workerDepartment && workerDepartment.department();
|
||||
const channelName = department.chatName;
|
||||
const channelName = department && department.chatName;
|
||||
|
||||
if (channelName)
|
||||
return Self.send(ctx, `#${channelName}`, `@${account.name} => ${message}`);
|
||||
|
|
|
@ -511,14 +511,16 @@ export default {
|
|||
},
|
||||
ticketRequests: {
|
||||
addRequestButton: 'vn-ticket-request-index > a > vn-float-button > button',
|
||||
request: 'vn-ticket-request-index vn-table vn-tr',
|
||||
descriptionInput: 'vn-ticket-request-create [ng-model="$ctrl.ticketRequest.description"]',
|
||||
atender: 'vn-ticket-request-create vn-autocomplete[ng-model="$ctrl.ticketRequest.attenderFk"]',
|
||||
quantity: 'vn-ticket-request-create vn-input-number[ng-model="$ctrl.ticketRequest.quantity"]',
|
||||
price: 'vn-ticket-request-create vn-input-number[ng-model="$ctrl.ticketRequest.price"]',
|
||||
firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)',
|
||||
firstRequestQuantity: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(6) vn-input-number',
|
||||
secondRequestQuantity: 'vn-ticket-request-index vn-table vn-tr:nth-child(2) > vn-td:nth-child(6) vn-input-number',
|
||||
thirdDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(3) > vn-td:nth-child(2) vn-textfield',
|
||||
thirdRemoveRequestButton: 'vn-ticket-request-index vn-tr:nth-child(3) vn-icon[icon="delete"]',
|
||||
thirdRequestQuantity: 'vn-ticket-request-index vn-table vn-tr:nth-child(3) > vn-td:nth-child(6) vn-input-number',
|
||||
saveButton: 'vn-ticket-request-create button[type=submit]',
|
||||
firstDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(2) vn-textfield',
|
||||
|
||||
},
|
||||
ticketLog: {
|
||||
|
|
|
@ -70,13 +70,13 @@ describe('Client Add address path', () => {
|
|||
});
|
||||
|
||||
it(`should confirm the new address exists and it's the default one`, async() => {
|
||||
await page.waitFor(2000); // needs more than a single second to load the section
|
||||
const result = await page.waitToGetProperty(selectors.clientAddresses.defaultAddress, 'innerText');
|
||||
|
||||
expect(result).toContain('320 Park Avenue New York');
|
||||
});
|
||||
|
||||
it(`should click on the make default icon of the second address`, async() => {
|
||||
await page.waitForContentLoaded();
|
||||
it('should click on the make default icon of the second address', async() => {
|
||||
await page.waitToClick(selectors.clientAddresses.secondMakeDefaultStar);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ describe('Ticket purchase request path', () => {
|
|||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('salesPerson', 'ticket');
|
||||
await page.accessToSearchResult('16');
|
||||
await page.accessToSearchResult('1');
|
||||
await page.accessToSection('ticket.card.request.index');
|
||||
});
|
||||
|
||||
|
@ -17,10 +17,10 @@ describe('Ticket purchase request path', () => {
|
|||
await browser.close();
|
||||
});
|
||||
|
||||
it(`should add a new request`, async() => {
|
||||
it('should add a new request', async() => {
|
||||
await page.waitToClick(selectors.ticketRequests.addRequestButton);
|
||||
await page.write(selectors.ticketRequests.descriptionInput, 'New stuff');
|
||||
await page.write(selectors.ticketRequests.quantity, '99');
|
||||
await page.write(selectors.ticketRequests.quantity, '9');
|
||||
await page.autocompleteSearch(selectors.ticketRequests.atender, 'buyerNick');
|
||||
await page.write(selectors.ticketRequests.price, '999');
|
||||
await page.waitToClick(selectors.ticketRequests.saveButton);
|
||||
|
@ -29,29 +29,52 @@ describe('Ticket purchase request path', () => {
|
|||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should have been redirected to the request index`, async() => {
|
||||
it('should have been redirected to the request index', async() => {
|
||||
let url = await page.expectURL('/request');
|
||||
|
||||
expect(url).toBe(true);
|
||||
});
|
||||
|
||||
it(`should confirm the new request was added`, async() => {
|
||||
await page.reloadSection('ticket.card.request.index');
|
||||
const result = await page.waitToGetProperty(selectors.ticketRequests.firstDescription, 'value');
|
||||
|
||||
expect(result).toEqual('New stuff');
|
||||
});
|
||||
|
||||
it(`should delete the added request`, async() => {
|
||||
await page.waitToClick(selectors.ticketRequests.firstRemoveRequestButton);
|
||||
it(`should edit the third request quantity as it's state is still new`, async() => {
|
||||
await page.waitFor(2000); // looks like it needs more than a single second some times to load
|
||||
await page.write(selectors.ticketRequests.thirdRequestQuantity, '9');
|
||||
await page.keyboard.press('Enter');
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the request was deleted`, async() => {
|
||||
it('should confirm the new request was added', async() => {
|
||||
await page.reloadSection('ticket.card.request.index');
|
||||
const result = await page.waitToGetProperty(selectors.ticketRequests.thirdRequestQuantity, 'value');
|
||||
|
||||
expect(result).toEqual('99');
|
||||
});
|
||||
|
||||
it(`should confirm first request can't be edited as its state is different to new`, async() => {
|
||||
await page.waitForClassPresent(selectors.ticketRequests.firstRequestQuantity, 'disabled');
|
||||
const result = await page.isDisabled(selectors.ticketRequests.firstRequestQuantity);
|
||||
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it(`should confirm second request can't be edited as its state is different to new`, async() => {
|
||||
await page.waitForClassPresent(selectors.ticketRequests.secondRequestQuantity, 'disabled');
|
||||
const result = await page.isDisabled(selectors.ticketRequests.secondRequestQuantity);
|
||||
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should delete the added request', async() => {
|
||||
await page.waitToClick(selectors.ticketRequests.thirdRemoveRequestButton);
|
||||
const result = await page.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it('should confirm the request was deleted', async() => {
|
||||
await page.reloadSection('ticket.card.request.index');
|
||||
await page.wait(selectors.ticketRequests.addRequestButton);
|
||||
await page.waitForSelector(selectors.ticketRequests.request, {hidden: true});
|
||||
await page.waitForSelector(selectors.ticketRequests.thirdDescription, {hidden: true});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -24,14 +24,15 @@ export default class Controller extends Component {
|
|||
const filter = encodeURIComponent(JSON.stringify(filterObj));
|
||||
const query = `Clients/findOne?filter=${filter}`;
|
||||
this.$http.get(query).then(res => {
|
||||
if (res.data.id) {
|
||||
const params = {clientId: res.data.id};
|
||||
const question = $t('Found a client with this phone or email', params, null, null, 'sanitizeParameters');
|
||||
|
||||
this.client.despiteOfClient = params.clientId;
|
||||
this.$.confirmDuplicatedClient.question = question;
|
||||
this.$.confirmDuplicatedClient.show();
|
||||
}
|
||||
}).catch(error => {
|
||||
if (error.status == 404)
|
||||
this.save();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ module.exports = Self => {
|
|||
type: 'Number',
|
||||
description: 'The totalEntries filter',
|
||||
http: {source: 'query'}
|
||||
}, {
|
||||
arg: 'ref',
|
||||
type: 'string',
|
||||
description: 'The reference'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
|
@ -80,9 +84,11 @@ module.exports = Self => {
|
|||
let where = buildFilter(ctx.args, (param, value) => {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return {'t.id': value};
|
||||
return /^\d+$/.test(value)
|
||||
? {'t.id': value}
|
||||
: {'t.ref': {like: `%${value}%`}};
|
||||
case 'ref':
|
||||
return {[param]: {regexp: value}};
|
||||
return {'t.ref': {like: `%${value}%`}};
|
||||
case 'shippedFrom':
|
||||
return {'t.shipped': {gte: value}};
|
||||
case 'shippedTo':
|
||||
|
|
|
@ -2,38 +2,53 @@ const app = require('vn-loopback/server/server');
|
|||
|
||||
describe('Travel filter()', () => {
|
||||
it('should return the travel matching "search"', async() => {
|
||||
let ctx = {
|
||||
const ctx = {
|
||||
args: {
|
||||
search: 1
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.Travel.filter(ctx);
|
||||
const result = await app.models.Travel.filter(ctx);
|
||||
const firstRow = result[0];
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].id).toEqual(1);
|
||||
expect(firstRow.id).toEqual(1);
|
||||
});
|
||||
|
||||
it('should return the travel matching "search" by ref', async() => {
|
||||
const ctx = {
|
||||
args: {
|
||||
search: 'third'
|
||||
}
|
||||
};
|
||||
|
||||
const result = await app.models.Travel.filter(ctx);
|
||||
const firstRow = result[0];
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(firstRow.id).toEqual(3);
|
||||
});
|
||||
|
||||
it('should return the travel matching "warehouse out"', async() => {
|
||||
let ctx = {
|
||||
const ctx = {
|
||||
args: {
|
||||
warehouseOutFk: 2
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.Travel.filter(ctx);
|
||||
const result = await app.models.Travel.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(8);
|
||||
});
|
||||
|
||||
it('should return the travel matching "total entries"', async() => {
|
||||
let ctx = {
|
||||
const ctx = {
|
||||
args: {
|
||||
totalEntries: 1,
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.Travel.filter(ctx);
|
||||
const result = await app.models.Travel.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(5);
|
||||
});
|
||||
|
@ -44,14 +59,14 @@ describe('Travel filter()', () => {
|
|||
from.setHours(0, 0, 0, 0);
|
||||
to.setHours(23, 59, 59, 999);
|
||||
to.setDate(to.getDate() + 1);
|
||||
let ctx = {
|
||||
const ctx = {
|
||||
args: {
|
||||
shippedFrom: from,
|
||||
shippedTo: to
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.Travel.filter(ctx);
|
||||
const result = await app.models.Travel.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"name": {
|
||||
"type": "String"
|
||||
},
|
||||
"rgb": {
|
||||
"hexColour": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"id": true
|
||||
"type": "Number"
|
||||
},
|
||||
"dmsFk": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"required": true,
|
||||
"mysql": {
|
||||
|
|
Loading…
Reference in New Issue