feat: add reserved icon to TicketProblems and update Cypress tests for ticket sale functionality
gitea/salix-front/pipeline/pr-test This commit looks good Details

This commit is contained in:
Javier Segarra 2025-03-03 22:47:47 +01:00
parent 6fb160ec8d
commit 399437d334
4 changed files with 31 additions and 59 deletions

View File

@ -17,6 +17,17 @@ defineProps({ row: { type: Object, required: true } });
</QTooltip>
</QIcon>
</router-link>
<QIcon
v-if="row?.reserved"
color="primary"
name="vn:reserva"
size="xs"
data-cy="ticketSaleReservedIcon"
>
<QTooltip>
{{ t('ticketSale.reserved') }}
</QTooltip>
</QIcon>
<QIcon
v-if="row?.risk"
name="vn:risk"

View File

@ -681,7 +681,6 @@ watch(
:disabled-attr="isTicketEditable"
>
<template #column-statusIcons="{ row }">
<QIcon name="vn:reserved" v-if="row.reserved"></QIcon>
<TicketProblems :row="row" />
</template>
<template #body-cell-picture="{ row }">

View File

@ -9,43 +9,8 @@ describe('TicketFilter', () => {
it('use search button', function () {
cy.waitForElement('.q-page');
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
cy.get('[data-cy="Customer ID_input"]').type('1105');
cy.searchBtnFilterPanel();
cy.waitRequest('@ticketFilter', ({ request }) => {
const { query } = request;
expect(query).to.have.property('from');
expect(query).to.have.property('to');
});
cy.on('uncaught:exception', () => {
return false;
});
cy.get('.q-field__control-container > [data-cy="From_date"]')
.type(`${today()} `)
.type('{enter}');
cy.get('.q-notification').should(
'contain',
`The date range must have both 'from' and 'to'`,
);
cy.get('.q-field__control-container > [data-cy="To_date"]').type(
`${today()}{enter}`,
);
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
cy.searchBtnFilterPanel();
cy.wait('@ticketFilter').then(({ request }) => {
const { query } = request;
expect(query).to.have.property('from');
expect(query).to.have.property('to');
});
cy.location('href').should('contain', '#/ticket/999999');
cy.location('href').should('contain', '#/ticket/15/summary');
});
});
function today(date) {
// return new Date().toISOString().split('T')[0];
return new Intl.DateTimeFormat('es-ES', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}).format(date ?? new Date());
}

View File

@ -138,7 +138,7 @@ describe('TicketSale', () => {
it('update price', () => {
const price = Number((Math.random() * 99 + 1).toFixed(2));
cy.waitForElement(firstRow);
cy.get(':nth-child(10) > .q-btn').click();
cy.get('[data-col-field="price"]').find('.q-btn').click();
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
cy.dataCy('ticketEditManaProxy').should('exist');
cy.waitForElement('[data-cy="Price_input"]');
@ -147,15 +147,14 @@ describe('TicketSale', () => {
cy.dataCy('saveManaBtn').click();
handleVnConfirm();
cy.get(':nth-child(10) > .q-btn > .q-btn__content').should(
'have.text',
`${price}`,
);
cy.get('[data-col-field="price"]')
.find('.q-btn > .q-btn__content')
.should('have.text', `${price}`);
});
it('update dicount', () => {
it('update discount', () => {
const discount = Math.floor(Math.random() * 100) + 1;
selectFirstRow();
cy.get(':nth-child(11) > .q-btn').click();
cy.get('[data-col-field="discount"]').find('.q-btn').click();
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
cy.dataCy('ticketEditManaProxy').should('exist');
cy.waitForElement('[data-cy="Disc_input"]');
@ -164,26 +163,24 @@ describe('TicketSale', () => {
cy.dataCy('saveManaBtn').click();
handleVnConfirm();
cy.get(':nth-child(11) > .q-btn > .q-btn__content').should(
'have.text',
`${discount}.00%`,
);
cy.get('[data-col-field="discount"]')
.find('.q-btn > .q-btn__content')
.should('have.text', `${discount}.00%`);
});
it('change concept', () => {
const quantity = Math.floor(Math.random() * 100) + 1;
it.only('change concept', () => {
const concept = Math.floor(Math.random() * 100) + 1;
cy.waitForElement(firstRow);
cy.get(':nth-child(8) > .row').click();
cy.get(
'.q-menu > [data-v-ca3f07a4=""] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="undefined_input"]',
)
.type(quantity)
cy.get('[data-col-field="item"]').click();
cy.get('.q-menu')
.find('[data-cy="undefined_input"]')
.type(concept)
.type('{enter}');
handleVnConfirm();
cy.get(':nth-child(8) >.row').should('contain.text', `${quantity}`);
cy.get('[data-col-field="item"]').should('contain.text', `${concept}`);
});
it('changequantity ', () => {
it('change quantity ', () => {
const quantity = Math.floor(Math.random() * 100) + 1;
cy.waitForElement(firstRow);
cy.dataCy('ticketSaleQuantityInput').clear();
@ -200,7 +197,7 @@ describe('TicketSale', () => {
});
function handleVnConfirm() {
cy.get('[data-cy="VnConfirm_confirm"] > .q-btn__content > .block').click();
cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.waitForElement('.q-notification__message');
cy.get('.q-notification__message').should('be.visible');