test(ticket_basic-data): test and fixtures
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
7a7bcf217a
commit
18b6efe8f1
|
@ -622,6 +622,7 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF
|
||||||
(25 ,NULL, 8, 1, NULL, CURDATE(), CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, CURDATE()),
|
(25 ,NULL, 8, 1, NULL, CURDATE(), CURDATE(), 1101, 'Bruce Wayne', 1, NULL, 0, 1, 5, 1, CURDATE()),
|
||||||
(26 ,NULL, 8, 1, NULL, CURDATE(), CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, CURDATE()),
|
(26 ,NULL, 8, 1, NULL, CURDATE(), CURDATE(), 1101, 'An incredibly long alias for testing purposes', 1, NULL, 0, 1, 5, 1, CURDATE()),
|
||||||
(27 ,NULL, 8, 1, NULL, CURDATE(), CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, CURDATE());
|
(27 ,NULL, 8, 1, NULL, CURDATE(), CURDATE(), 1101, 'Wolverine', 1, NULL, 0, 1, 5, 1, CURDATE());
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
|
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 11, 1, 'ready'),
|
(1, 11, 1, 'ready'),
|
||||||
|
@ -665,7 +666,9 @@ INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`)
|
||||||
(21, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
|
(21, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
|
||||||
(22, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
|
(22, 1, 19, DATE_ADD(NOW(), INTERVAL +1 MONTH)),
|
||||||
(23, 16, 21, NOW()),
|
(23, 16, 21, NOW()),
|
||||||
(24, 16, 21, NOW());
|
(24, 16, 21, NOW()),
|
||||||
|
(27, 3, 21, NOW());
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`stowaway`(`id`, `shipFk`, `created`)
|
INSERT INTO `vn`.`stowaway`(`id`, `shipFk`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -896,7 +899,9 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
|
||||||
(29, 4, 17, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()),
|
(29, 4, 17, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()),
|
||||||
(30, 4, 18, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()),
|
(30, 4, 18, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()),
|
||||||
(31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, CURDATE()),
|
(31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, CURDATE()),
|
||||||
(32, 1, 24, 'Ranged weapon longbow 2m', -1, 8.07, 0, 0, 0, CURDATE());
|
(32, 1, 24, 'Ranged weapon longbow 2m', -1, 8.07, 0, 0, 0, CURDATE()),
|
||||||
|
(33, 4, 27, 'Melee weapon combat fist 15cm', 1, 8.07, 0, 0, 0, CURDATE()),
|
||||||
|
(34, 5, 27, 'Ranged weapon pistol 9mm', 50, 1.79, 0, 0, 0, CURDATE());
|
||||||
|
|
||||||
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
|
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -525,6 +525,7 @@ export default {
|
||||||
acceptDialog: '.vn-dialog.shown button[response="accept"]',
|
acceptDialog: '.vn-dialog.shown button[response="accept"]',
|
||||||
acceptChangeHourButton: '.vn-dialog.shown button[response="accept"]',
|
acceptChangeHourButton: '.vn-dialog.shown button[response="accept"]',
|
||||||
descriptorDeliveryDate: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(4) > section > span',
|
descriptorDeliveryDate: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(4) > section > span',
|
||||||
|
descriptorDeliveryAgency: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(5) > section > span',
|
||||||
acceptInvoiceOutButton: '.vn-confirm.shown button[response="accept"]',
|
acceptInvoiceOutButton: '.vn-confirm.shown button[response="accept"]',
|
||||||
acceptDeleteStowawayButton: '.vn-dialog.shown button[response="accept"]'
|
acceptDeleteStowawayButton: '.vn-dialog.shown button[response="accept"]'
|
||||||
},
|
},
|
||||||
|
@ -562,6 +563,7 @@ export default {
|
||||||
transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text',
|
transferQuantityInput: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable > span > text',
|
||||||
transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable',
|
transferQuantityCell: '.vn-popover.shown vn-table > div > vn-tbody > vn-tr > vn-td-editable',
|
||||||
firstSaleId: 'vn-ticket-sale vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(6) > span',
|
firstSaleId: 'vn-ticket-sale vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(6) > span',
|
||||||
|
firstSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(1)',
|
||||||
firstSaleClaimIcon: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) vn-icon[icon="icon-claims"]',
|
firstSaleClaimIcon: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) vn-icon[icon="icon-claims"]',
|
||||||
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
|
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
|
||||||
firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img',
|
firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img',
|
||||||
|
@ -601,10 +603,12 @@ export default {
|
||||||
ticketBasicData: {
|
ticketBasicData: {
|
||||||
agency: 'vn-autocomplete[ng-model="$ctrl.agencyModeId"]',
|
agency: 'vn-autocomplete[ng-model="$ctrl.agencyModeId"]',
|
||||||
zone: 'vn-autocomplete[ng-model="$ctrl.zoneId"]',
|
zone: 'vn-autocomplete[ng-model="$ctrl.zoneId"]',
|
||||||
|
shipped: 'vn-date-picker[ng-model="$ctrl.shipped"]',
|
||||||
nextStepButton: 'vn-step-control .buttons > section:last-child vn-button',
|
nextStepButton: 'vn-step-control .buttons > section:last-child vn-button',
|
||||||
finalizeButton: 'vn-step-control .buttons > section:last-child button[type=submit]',
|
finalizeButton: 'vn-step-control .buttons > section:last-child button[type=submit]',
|
||||||
stepTwoTotalPriceDif: 'vn-ticket-basic-data-step-two > vn-side-menu div:nth-child(4)',
|
stepTwoTotalPriceDif: 'vn-ticket-basic-data-step-two > vn-side-menu div:nth-child(4)',
|
||||||
chargesReason: 'vn-ticket-basic-data-step-two div:nth-child(3) > vn-radio',
|
chargesReason: 'vn-ticket-basic-data-step-two div:nth-child(3) > vn-radio',
|
||||||
|
withoutNegatives: 'vn-check[ng-model="$ctrl.ticket.withoutNegatives"]',
|
||||||
},
|
},
|
||||||
ticketComponents: {
|
ticketComponents: {
|
||||||
base: 'vn-ticket-components > vn-side-menu div:nth-child(1) > div:nth-child(2)'
|
base: 'vn-ticket-components > vn-side-menu div:nth-child(1) > div:nth-child(2)'
|
||||||
|
|
|
@ -83,4 +83,65 @@ describe('Ticket Edit basic data path', () => {
|
||||||
await page.waitToClick(selectors.ticketBasicData.finalizeButton);
|
await page.waitToClick(selectors.ticketBasicData.finalizeButton);
|
||||||
await page.waitForState('ticket.card.summary');
|
await page.waitForState('ticket.card.summary');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it(`should not find ticket`, async() => {
|
||||||
|
await page.doSearch('28');
|
||||||
|
const count = await page.countElement(selectors.ticketsIndex.searchResult);
|
||||||
|
|
||||||
|
expect(count).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should split ticket without negatives`, async() => {
|
||||||
|
const tomorrow = new Date();
|
||||||
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||||
|
|
||||||
|
await page.accessToSearchResult('14');
|
||||||
|
await page.accessToSection('ticket.card.basicData.stepOne');
|
||||||
|
|
||||||
|
const originalDate = await page
|
||||||
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText');
|
||||||
|
const originalAgency = await page
|
||||||
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryAgency, 'innerText');
|
||||||
|
|
||||||
|
await page.autocompleteSearch(selectors.ticketBasicData.agency, 'Silla247');
|
||||||
|
await page.pickDate(selectors.ticketBasicData.shipped, tomorrow);
|
||||||
|
await page.waitToClick(selectors.ticketBasicData.nextStepButton);
|
||||||
|
|
||||||
|
await page.waitToClick(selectors.ticketBasicData.withoutNegatives);
|
||||||
|
await page.waitToClick(selectors.ticketBasicData.finalizeButton);
|
||||||
|
|
||||||
|
const resultDate = await page
|
||||||
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText');
|
||||||
|
const resultAgency = await page
|
||||||
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryAgency, 'innerText');
|
||||||
|
|
||||||
|
expect(resultDate).toEqual(originalDate);
|
||||||
|
expect(resultAgency).toEqual(originalAgency);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should new ticket have one line from splited ticket`, async() => {
|
||||||
|
const tomorrow = new Date();
|
||||||
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||||
|
const expectedDay = tomorrow.getDate();
|
||||||
|
const expectedMonth = tomorrow.getMonth() + 1;
|
||||||
|
const expectedYear = tomorrow.getFullYear();
|
||||||
|
|
||||||
|
await page.accessToSearchResult('28');
|
||||||
|
await page.accessToSection('ticket.card.sale');
|
||||||
|
|
||||||
|
const item = await page.waitToGetProperty(selectors.ticketSales.firstSaleId, 'innerText');
|
||||||
|
const agency = await page
|
||||||
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryAgency, 'innerText');
|
||||||
|
let date = await page
|
||||||
|
.waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText');
|
||||||
|
|
||||||
|
date = date.split(' ');
|
||||||
|
date = date[0].split('/');
|
||||||
|
|
||||||
|
expect(item).toEqual('4');
|
||||||
|
expect(agency).toEqual('Silla247');
|
||||||
|
expect(date[0]).toContain(expectedDay);
|
||||||
|
expect(date[1]).toContain(expectedMonth);
|
||||||
|
expect(date[2]).toContain(expectedYear);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -119,5 +119,6 @@
|
||||||
"The PDF document does not exists": "The PDF document does not exists. Try regenerating it from 'Regenerate invoice PDF' option",
|
"The PDF document does not exists": "The PDF document does not exists. Try regenerating it from 'Regenerate invoice PDF' option",
|
||||||
"This item is not available": "This item is not available",
|
"This item is not available": "This item is not available",
|
||||||
"Deny buy request": "Purchase request for ticket id [{{ticketId}}]({{{url}}}) has been rejected. Reason: {{observation}}",
|
"Deny buy request": "Purchase request for ticket id [{{ticketId}}]({{{url}}}) has been rejected. Reason: {{observation}}",
|
||||||
"The type of business must be filled in basic data": "The type of business must be filled in basic data"
|
"The type of business must be filled in basic data": "The type of business must be filled in basic data",
|
||||||
|
"isWithoutNegatives": "isWithoutNegatives"
|
||||||
}
|
}
|
|
@ -118,15 +118,14 @@ module.exports = Self => {
|
||||||
|
|
||||||
const isProductionBoss = await models.Account.hasRole(userId, 'productionBoss', myOptions);
|
const isProductionBoss = await models.Account.hasRole(userId, 'productionBoss', myOptions);
|
||||||
if (!isProductionBoss) {
|
if (!isProductionBoss) {
|
||||||
const params = [args.landed, args.addressFk, args.agencyModeFk, args.warehouseFk];
|
const zoneShipped = await models.Agency.getShipped(args.landed, args.addressFk, args.agencyModeFk, args.warehouseFk, myOptions);
|
||||||
const zoneShipped = await models.Agency.getShipped(params, myOptions);
|
|
||||||
|
|
||||||
if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk)
|
if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk)
|
||||||
throw new UserError(`You don't have privileges to change the zone`);
|
throw new UserError(`You don't have privileges to change the zone`);
|
||||||
}
|
}
|
||||||
if (args.isWithoutNegatives) {
|
if (args.isWithoutNegatives) {
|
||||||
let query = `CALL ticket_getVisibleAvailable(?,?)`;
|
const query = `CALL ticket_getVisibleAvailable(?,?)`;
|
||||||
let params = [args.id, args.shipped];
|
const params = [args.id, args.shipped];
|
||||||
const [salesAvailable] = await Self.rawSql(query, params, myOptions);
|
const [salesAvailable] = await Self.rawSql(query, params, myOptions);
|
||||||
|
|
||||||
let salesNewTicket = [];
|
let salesNewTicket = [];
|
||||||
|
|
|
@ -45,7 +45,8 @@ describe('ticket componentUpdate()', () => {
|
||||||
shipped: today,
|
shipped: today,
|
||||||
landed: tomorrow,
|
landed: tomorrow,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
option: 1
|
option: 1,
|
||||||
|
isWithoutNegatives: false
|
||||||
};
|
};
|
||||||
|
|
||||||
let ctx = {
|
let ctx = {
|
||||||
|
@ -94,7 +95,8 @@ describe('ticket componentUpdate()', () => {
|
||||||
shipped: today,
|
shipped: today,
|
||||||
landed: tomorrow,
|
landed: tomorrow,
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
option: 1
|
option: 1,
|
||||||
|
isWithoutNegatives: false
|
||||||
};
|
};
|
||||||
|
|
||||||
const ctx = {
|
const ctx = {
|
||||||
|
|
|
@ -60,7 +60,7 @@ describe('sale priceDifference()', () => {
|
||||||
expect(error).toEqual(new UserError(`The sales of this ticket can't be modified`));
|
expect(error).toEqual(new UserError(`The sales of this ticket can't be modified`));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return ticket visible', async() => {
|
it('should return ticket available', async() => {
|
||||||
const tx = await models.Ticket.beginTransaction({});
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -83,8 +83,8 @@ describe('sale priceDifference()', () => {
|
||||||
const firstItem = result.items[0];
|
const firstItem = result.items[0];
|
||||||
const secondtItem = result.items[1];
|
const secondtItem = result.items[1];
|
||||||
|
|
||||||
expect(firstItem.visible).toEqual(445);
|
expect(firstItem.available).toEqual(410);
|
||||||
expect(secondtItem.visible).toEqual(1980);
|
expect(secondtItem.available).toEqual(1870);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -77,7 +77,8 @@
|
||||||
<div class="totalBox align-left" ng-show="::$ctrl.haveNegatives">
|
<div class="totalBox align-left" ng-show="::$ctrl.haveNegatives">
|
||||||
<vn-check
|
<vn-check
|
||||||
ng-model="$ctrl.ticket.withoutNegatives"
|
ng-model="$ctrl.ticket.withoutNegatives"
|
||||||
label="Without create negatives">
|
label="Without create negatives"
|
||||||
|
info="Clone this ticket with the changes and only sales availables">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -75,6 +75,7 @@ class Controller extends Component {
|
||||||
haveNotNegatives = true;
|
haveNotNegatives = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.ticket.withoutNegatives = false;
|
||||||
this.haveNegatives = (haveNegatives && haveNotNegatives);
|
this.haveNegatives = (haveNegatives && haveNotNegatives);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,14 +65,22 @@ describe('Ticket', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
fdescribe('ticketHaveNegatives()', () => {
|
describe('ticketHaveNegatives()', () => {
|
||||||
it('should show if ticket have any negative', () => {
|
it('should show if ticket have any negative and any not negative', () => {
|
||||||
controller.ticket = {
|
controller.ticket = {
|
||||||
sale: {
|
sale: {
|
||||||
items: [{
|
items: [
|
||||||
quantity: 2,
|
{
|
||||||
visible: 1
|
item: 1,
|
||||||
}]
|
quantity: 2,
|
||||||
|
available: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
item: 2,
|
||||||
|
quantity: 1,
|
||||||
|
available: 5
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,4 +6,5 @@ The ticket has been unrouted: El ticket ha sido desenrutado
|
||||||
Price: Precio
|
Price: Precio
|
||||||
New price: Nuevo precio
|
New price: Nuevo precio
|
||||||
Price difference: Diferencia de precio
|
Price difference: Diferencia de precio
|
||||||
Without create negatives: Sin crear negativos
|
Without create negatives: Sin crear negativos
|
||||||
|
Clone this ticket with the changes and only sales availables: Clona este ticket con los cambios y solo las ventas disponibles.
|
Loading…
Reference in New Issue