Merge pull request 'fix_ticket_e2e' (!1540) from fix_ticket_e2e into test
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1540
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Alex Moreno 2025-03-04 06:23:45 +00:00
commit c05e1ae602
5 changed files with 49 additions and 86 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

@ -200,8 +200,9 @@ const toModule = computed(() =>
</div>
</QItemLabel>
<QItem>
<QItemLabel class="subtitle" caption>
<QItemLabel class="subtitle">
#{{ getValueFromPath(subtitle) ?? entity.id }}
</QItemLabel>
<QBtn
round
flat
@ -215,7 +216,6 @@ const toModule = computed(() =>
{{ t('globals.copyId') }}
</QTooltip>
</QBtn>
</QItemLabel>
</QItem>
</QList>
<div class="list-box q-mt-xs">

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

@ -12,12 +12,12 @@ describe('TicketList', () => {
const searchResults = (search) => {
if (search) cy.typeSearchbar().type(search);
cy.dataCy('vn-searchbar').find('input').type('{enter}');
cy.dataCy('ticketListTable').should('exist');
// cy.dataCy('ticketListTable').should('exist');
cy.get(firstRow).should('exist');
};
it('should search results', () => {
cy.dataCy('ticketListTable').should('not.exist');
// cy.dataCy('ticketListTable').should('not.exist');
cy.get('.q-field__control').should('exist');
searchResults();
});
@ -41,21 +41,11 @@ describe('TicketList', () => {
it('filter client and create ticket', () => {
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar');
searchResults();
cy.wait('@ticketSearchbar').then(({ request }) => {
const { query } = request;
expect(query).to.have.property('from');
expect(query).to.have.property('to');
expect(query).to.not.have.property('clientFk');
});
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
cy.dataCy('Customer ID_input').clear('1');
cy.dataCy('Customer ID_input').type('1101{enter}');
cy.wait('@ticketFilter').then(({ request }) => {
const { query } = request;
expect(query).to.not.have.property('from');
expect(query).to.not.have.property('to');
expect(query).to.have.property('clientFk');
});
cy.get('[data-cy="vnTableCreateBtn"] > .q-btn__content > .q-icon').click();
cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
cy.dataCy('Address_select').click();

View File

@ -6,6 +6,7 @@ describe('TicketSale', () => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/sale');
cy.domContentLoad();
});
const firstRow = 'tbody > :nth-child(1)';
@ -112,7 +113,6 @@ describe('TicketSale', () => {
cy.dataCy('ticketSaleTransferBtn').click();
cy.dataCy('ticketTransferPopup').should('exist');
cy.dataCy('ticketTransferNewTicketBtn').click();
//check the new ticket has been created succesfully
cy.get('.q-item > .q-item__label').should('not.have.text', ' #32');
});
@ -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,24 +163,22 @@ 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;
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('change quantity ', () => {
const quantity = Math.floor(Math.random() * 100) + 1;
@ -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');