ref #5914 fixed tests e2e
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Jorge Penadés 2023-09-25 10:49:47 +02:00
parent 731bad5981
commit c8c06f498c
8 changed files with 14 additions and 12 deletions

View File

@ -220,7 +220,7 @@ describe('Ticket Edit sale path', () => {
it('should log in as salesAssistant and navigate to ticket sales', async() => { it('should log in as salesAssistant and navigate to ticket sales', async() => {
await page.loginAndModule('salesAssistant', 'ticket'); await page.loginAndModule('salesAssistant', 'ticket');
await page.accessToSearchResult('17'); await page.accessToSearchResult('15');
await page.accessToSection('ticket.card.sale'); await page.accessToSection('ticket.card.sale');
}); });
@ -324,7 +324,7 @@ describe('Ticket Edit sale path', () => {
}); });
it('should confirm the transfered quantity is the correct one', async() => { it('should confirm the transfered quantity is the correct one', async() => {
const result = await page.waitToGetProperty(selectors.ticketSales.secondSaleQuantityCell, 'innerText'); const result = await page.waitToGetProperty(selectors.ticketSales.firstSaleQuantityCell, 'innerText');
expect(result).toContain('20'); expect(result).toContain('20');
}); });
@ -378,7 +378,7 @@ describe('Ticket Edit sale path', () => {
await page.waitToClick(selectors.ticketSales.moveToNewTicketButton); await page.waitToClick(selectors.ticketSales.moveToNewTicketButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain(`You can't create a ticket for a inactive client`); expect(message.text).toContain(`You can't create a ticket for an inactive client`);
await page.closePopup(); await page.closePopup();
}); });

View File

@ -23,7 +23,7 @@
"Agency cannot be blank": "Agency cannot be blank", "Agency cannot be blank": "Agency cannot be blank",
"The IBAN does not have the correct format": "The IBAN does not have the correct format", "The IBAN does not have the correct format": "The IBAN does not have the correct format",
"You can't make changes on the basic data of an confirmed order or with rows": "You can't make changes on the basic data of an confirmed order or with rows", "You can't make changes on the basic data of an confirmed order or with rows": "You can't make changes on the basic data of an confirmed order or with rows",
"You can't create a ticket for a inactive client": "You can't create a ticket for a inactive client", "You can't create a ticket for an inactive client": "You can't create a ticket for an inactive client",
"Worker cannot be blank": "Worker cannot be blank", "Worker cannot be blank": "Worker cannot be blank",
"You must delete the claim id %d first": "You must delete the claim id %d first", "You must delete the claim id %d first": "You must delete the claim id %d first",
"You don't have enough privileges": "You don't have enough privileges", "You don't have enough privileges": "You don't have enough privileges",

View File

@ -58,7 +58,7 @@
"You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos", "You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos",
"INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ", "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ",
"You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado", "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado",
"You can't create a ticket for a inactive client": "No puedes crear un ticket para un cliente inactivo", "You can't create a ticket for an inactive client": "No puedes crear un ticket para un cliente inactivo",
"Tag value cannot be blank": "El valor del tag no puede quedar en blanco", "Tag value cannot be blank": "El valor del tag no puede quedar en blanco",
"ORDER_EMPTY": "Cesta vacía", "ORDER_EMPTY": "Cesta vacía",
"You don't have enough privileges to do that": "No tienes permisos para cambiar esto", "You don't have enough privileges to do that": "No tienes permisos para cambiar esto",

View File

@ -3,7 +3,7 @@ const LoopBackContext = require('loopback-context');
describe('InvoiceOut refund()', () => { describe('InvoiceOut refund()', () => {
const userId = 5; const userId = 5;
const ctx = {req: {accessToken: userId}}; const ctx = {req: {accessToken: userId}, args: {}};
const withWarehouse = true; const withWarehouse = true;
const activeCtx = { const activeCtx = {
accessToken: {userId: userId}, accessToken: {userId: userId},

View File

@ -3,7 +3,7 @@ const LoopBackContext = require('loopback-context');
describe('Sale refund()', () => { describe('Sale refund()', () => {
const userId = 5; const userId = 5;
const ctx = {req: {accessToken: userId}}; const ctx = {req: {accessToken: userId}, args: {}};
const activeCtx = { const activeCtx = {
accessToken: {userId}, accessToken: {userId},
}; };
@ -40,6 +40,7 @@ describe('Sale refund()', () => {
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
const ticketsBefore = await models.Ticket.find({}, options);
const ticket = await models.Sale.refund(ctx, salesIds, servicesIds, withWarehouse, options); const ticket = await models.Sale.refund(ctx, salesIds, servicesIds, withWarehouse, options);
@ -61,12 +62,13 @@ describe('Sale refund()', () => {
} }
] ]
}, options); }, options);
const ticketsAfter = await models.Ticket.find({}, options);
const salesLength = refundedTicket.ticketSales().length; const salesLength = refundedTicket.ticketSales().length;
const componentsLength = refundedTicket.ticketSales()[0].components().length; const componentsLength = refundedTicket.ticketSales()[0].components().length;
expect(refundedTicket).toBeDefined(); expect(refundedTicket).toBeDefined();
expect(salesLength).toEqual(2); expect(salesLength).toEqual(1);
expect(ticketsBefore.length).toEqual(ticketsAfter.length - 2);
expect(componentsLength).toEqual(4); expect(componentsLength).toEqual(4);
await tx.rollback(); await tx.rollback();

View File

@ -96,7 +96,7 @@ module.exports = Self => {
if (address.client().type().code === 'normal' && (!agencyMode || agencyMode.code != 'refund')) { if (address.client().type().code === 'normal' && (!agencyMode || agencyMode.code != 'refund')) {
const canCreateTicket = await models.Client.canCreateTicket(args.clientId, myOptions); const canCreateTicket = await models.Client.canCreateTicket(args.clientId, myOptions);
if (!canCreateTicket) if (!canCreateTicket)
throw new UserError(`You can't create a ticket for a inactive client`); throw new UserError(`You can't create a ticket for an inactive client`);
} }
if (!args.shipped && args.landed) { if (!args.shipped && args.landed) {

View File

@ -30,7 +30,7 @@ describe('ticket new()', () => {
await tx.rollback(); await tx.rollback();
} }
expect(error).toEqual(new UserError(`You can't create a ticket for a inactive client`)); expect(error).toEqual(new UserError(`You can't create a ticket for an inactive client`));
}); });
it('should throw an error if the address doesnt exist', async() => { it('should throw an error if the address doesnt exist', async() => {

View File

@ -66,7 +66,7 @@ module.exports = Self => {
const ticket = await models.Ticket.findById(id); const ticket = await models.Ticket.findById(id);
const canCreateTicket = await models.Client.canCreateTicket(ticket.clientFk); const canCreateTicket = await models.Client.canCreateTicket(ticket.clientFk);
if (!canCreateTicket) if (!canCreateTicket)
throw new UserError(`You can't create a ticket for a inactive client`); throw new UserError(`You can't create a ticket for an inactive client`);
ticketId = await cloneTicket(originalTicket, myOptions); ticketId = await cloneTicket(originalTicket, myOptions);
} }