fix test and refactor transferlines
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Bernat Exposito Domenech 2020-09-30 12:24:33 +02:00
parent eb99ce2f43
commit 1bff4e3c4e
8 changed files with 37 additions and 35 deletions

View File

@ -20,7 +20,8 @@ export default {
userConfigFirstAutocomplete: '#localWarehouse', userConfigFirstAutocomplete: '#localWarehouse',
userConfigSecondAutocomplete: '#localBank', userConfigSecondAutocomplete: '#localBank',
userConfigThirdAutocomplete: '#localCompany', userConfigThirdAutocomplete: '#localCompany',
acceptButton: '.vn-confirm.shown button[response=accept]' acceptButton: '.vn-confirm.shown button[response=accept]',
searchButton: 'vn-searchbar vn-icon[icon="search"]',
}, },
clientsIndex: { clientsIndex: {
topbarSearch: 'vn-topbar', topbarSearch: 'vn-topbar',

View File

@ -124,7 +124,6 @@ describe('Item regularize path', () => {
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}), page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
page.waitToClick(selectors.globalItems.ticketsButton) page.waitToClick(selectors.globalItems.ticketsButton)
]); ]);
await page.waitForTransitionEnd('vn-searchbar');
await page.waitForState('ticket.index'); await page.waitForState('ticket.index');
}); });

View File

@ -20,7 +20,7 @@ describe('Ticket index payout path', () => {
}); });
it('should check the second ticket from a client and 1 of another', async() => { it('should check the second ticket from a client and 1 of another', async() => {
await page.keyboard.press('Enter'); await page.waitToClick(selectors.globalItems.searchButton);
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox); await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox); await page.waitToClick(selectors.ticketsIndex.sixthTicketCheckbox);
await page.waitToClick(selectors.ticketsIndex.payoutButton); await page.waitToClick(selectors.ticketsIndex.payoutButton);

View File

@ -18,7 +18,7 @@ describe('Entry lastest buys path', () => {
it('should access the latest buys seccion and search not seeing the edit buys button yet', async() => { it('should access the latest buys seccion and search not seeing the edit buys button yet', async() => {
await page.waitToClick(selectors.entryLatestBuys.latestBuysSectionButton); await page.waitToClick(selectors.entryLatestBuys.latestBuysSectionButton);
await page.waitFor(250); await page.waitFor(250);
await page.keyboard.press('Enter'); await page.waitToClick(selectors.globalItems.searchButton);
await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: false}); await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: false});
}); });

View File

@ -25,6 +25,9 @@ module.exports = Self => {
Self.lastActiveTickets = async(id, ticketId) => { Self.lastActiveTickets = async(id, ticketId) => {
const ticket = await Self.app.models.Ticket.findById(ticketId); const ticket = await Self.app.models.Ticket.findById(ticketId);
let shipped = ticket.shipped;
shipped.setDate(shipped.getDate() + 15);
const query = ` const query = `
SELECT t.id, t.shipped, a.name AS agencyName, w.name AS warehouseName, ad.city AS address SELECT t.id, t.shipped, a.name AS agencyName, w.name AS warehouseName, ad.city AS address
FROM vn.ticket t FROM vn.ticket t
@ -32,11 +35,11 @@ module.exports = Self => {
JOIN vn.agencyMode a ON t.agencyModeFk = a.id JOIN vn.agencyMode a ON t.agencyModeFk = a.id
JOIN vn.warehouse w ON t.warehouseFk = w.id JOIN vn.warehouse w ON t.warehouseFk = w.id
JOIN vn.address ad ON t.addressFk = ad.id JOIN vn.address ad ON t.addressFk = ad.id
WHERE t.shipped >= CURDATE() AND t.clientFk = ? AND ts.alertLevel = 0 WHERE t.shipped BETWEEN CURDATE() AND ? AND t.clientFk = ? AND ts.alertLevel = 0
AND t.id <> ? AND t.warehouseFk = ? AND t.id <> ? AND t.warehouseFk = ?
ORDER BY t.shipped ORDER BY t.shipped
LIMIT 3`; LIMIT 10`;
return Self.rawSql(query, [id, ticketId, ticket.warehouseFk]); return Self.rawSql(query, [shipped, id, ticketId, ticket.warehouseFk]);
}; };
}; };

View File

@ -2,11 +2,11 @@ const app = require('vn-loopback/server/server');
describe('client lastActiveTickets()', () => { describe('client lastActiveTickets()', () => {
it('should return the last three active tickets', async() => { it('should return the last three active tickets', async() => {
const clientId = 109; const clientId = 104;
const ticketId = 19; const ticketId = 9;
let result = await app.models.Client.lastActiveTickets(clientId, ticketId); let result = await app.models.Client.lastActiveTickets(clientId, ticketId);
expect(result.length).toEqual(3); expect(result.length).toEqual(1);
}); });
}); });

View File

@ -323,32 +323,31 @@
icon="info"> icon="info">
</vn-icon> </vn-icon>
</vn-horizontal> </vn-horizontal>
<table class="vn-table"> <vn-table class="destinationTable">
<thead> <vn-thead>
<tr> <vn-tr>
<th number>Id</th> <vn-th number>Id</vn-th>
<th number translate>Shipped</th> <vn-th number>Shipped</vn-th>
<th number translate>Agency</th> <vn-th number>Agency</vn-th>
<th number translate>Warehouse</th> <vn-th number>Warehouse</vn-th>
<th number translate>Address</th> <vn-th number>Address</vn-th>
</tr> </vn-tr>
</thead> </vn-thead>
<tbody> <vn-tbody>
<tr ng-if="$ctrl.transfer.lastActiveTickets.length === 0" > <vn-data-viewer data="$ctrl.transfer.lastActiveTickets">
<td colspan="4" style="text-align: center" translate>No results</td> </vn-data-viewer>
</tr> <vn-tr
<tr
class="clickable" class="clickable"
ng-repeat="ticket in $ctrl.transfer.lastActiveTickets track by ticket.id" ng-repeat="ticket in $ctrl.transfer.lastActiveTickets track by ticket.id"
ng-click="$ctrl.transferSales(ticket.id)"> ng-click="$ctrl.transferSales(ticket.id)">
<td number>{{::ticket.id}}</td> <vn-td number>{{::ticket.id}}</vn-td>
<td number>{{::ticket.shipped | date: 'dd/MM/yyyy'}}</td> <vn-td number>{{::ticket.shipped | date: 'dd/MM/yyyy'}}</vn-td>
<td number>{{::ticket.agencyName}}</td> <vn-td number>{{::ticket.agencyName}}</vn-td>
<td number>{{::ticket.warehouseName}}</td> <vn-td number>{{::ticket.warehouseName}}</vn-td>
<td number>{{::ticket.address}}</td> <vn-td number>{{::ticket.address}}</vn-td>
</tr> </vn-tr>
</tbody> </vn-tbody>
</table> </vn-table>
<form name="form"> <form name="form">
<vn-horizontal class="vn-py-md"> <vn-horizontal class="vn-py-md">
<vn-input-number vn-one <vn-input-number vn-one

View File

@ -80,8 +80,8 @@ vn-ticket-sale {
max-height: 400px; max-height: 400px;
width: 480px; width: 480px;
} }
table { .destinationTable {
width: 400px width: 700px
} }
} }
.vn-popover .edit-popover { .vn-popover .edit-popover {