refactor: refs #8599 requested changes
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2025-02-21 08:20:35 +01:00
parent e3bd8e59ca
commit d2b1cd4067
3 changed files with 35 additions and 26 deletions

View File

@ -163,10 +163,14 @@ const showExportationLetter = () => {
<QMenu anchor="top end" self="top start">
<QList>
<QItem v-ripple clickable @click="showSendInvoiceDialog('pdf')">
<QItemSection>{{ t('Send PDF') }}</QItemSection>
<QItemSection data-cy="InvoiceOutDescriptorMenuSendPdfOption">
{{ t('Send PDF') }}
</QItemSection>
</QItem>
<QItem v-ripple clickable @click="showSendInvoiceDialog('csv')">
<QItemSection>{{ t('Send CSV') }}</QItemSection>
<QItemSection data-cy="InvoiceOutDescriptorMenuSendCsvOption">
{{ t('Send CSV') }}
</QItemSection>
</QItem>
</QList>
</QMenu>

View File

@ -1,11 +1,7 @@
/// <reference types="cypress" />
describe('InvoiceOut negative bases', () => {
const clientDescriptor =
':nth-child(1) > [data-col-field="clientId"] > .no-padding > .link';
const ticketDescriptor =
':nth-child(1) > [data-col-field="ticketFk"] > .no-padding > .link';
const workerDescriptor =
':nth-child(1) > [data-col-field="workerName"] > .no-padding > .link';
const getDescriptors = (opt) =>
`:nth-child(1) > [data-col-field="${opt}"] > .no-padding > .link`;
beforeEach(() => {
cy.viewport(1920, 1080);
@ -14,13 +10,13 @@ describe('InvoiceOut negative bases', () => {
});
it('should open the posible descriptors', () => {
cy.get(clientDescriptor).click();
cy.get(getDescriptors('clientId')).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');
cy.get(ticketDescriptor).click();
cy.get(getDescriptors('ticketFk')).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '23');
cy.get(workerDescriptor).click();
cy.get(getDescriptors('workerName')).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '18');
});

View File

@ -5,11 +5,12 @@ describe('InvoiceOut summary', () => {
Type: { val: 'Error in customer data', type: 'select' },
};
const firstTicketRowDescriptor = 'tbody > :nth-child(1) > :nth-child(1) > .q-btn';
const firstClientRowDescriptor =
'tbody > :nth-child(1) > :nth-child(2) > .q-btn > .q-btn__content';
const firstRowDescriptors = (opt) =>
`tbody > :nth-child(1) > :nth-child(${opt}) > .q-btn`;
const toCustomerSummary = '[href="#/customer/1101"]';
const toTicketList = '[href="#/ticket/list?table={%22refFk%22:%22T1111111%22}"]';
const selectMenuOption = (opt) => `.q-menu > .q-list > :nth-child(${opt})`;
const confirmSend = '.q-btn--unelevated';
beforeEach(() => {
cy.viewport(1920, 1080);
@ -18,10 +19,10 @@ describe('InvoiceOut summary', () => {
});
it('open the descriptors', () => {
cy.get(firstTicketRowDescriptor).click();
cy.get(firstRowDescriptors(1)).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1');
cy.get(firstClientRowDescriptor).click();
cy.get(firstRowDescriptors(2)).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
@ -35,51 +36,59 @@ describe('InvoiceOut summary', () => {
it('should open the ticket list', () => {
cy.get(toTicketList).click();
cy.get('.descriptor').should('be.visible');
cy.get('[data-cy="vnFilterPanelChip"]').should('include.text', 'T1111111');
cy.dataCy('vnFilterPanelChip').should('include.text', 'T1111111');
});
it('should transfer the invoice ', () => {
cy.typeSearchbar('T1111111{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(1)').click();
cy.get(selectMenuOption(1)).click();
cy.fillInForm(transferInvoice);
cy.get('.q-mt-lg > .q-btn').click();
cy.checkNotification('Transferred invoice');
});
it('should send the invoice', () => {
it('should send the invoice as PDF', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(3)').click();
cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(1)').click();
cy.get('.q-btn--unelevated').click();
cy.get(selectMenuOption(3)).click();
cy.dataCy('InvoiceOutDescriptorMenuSendPdfOption').click();
cy.get(confirmSend).click();
cy.checkNotification('Notification sent');
});
it('should send the invoice as CSV', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(3)).click();
cy.dataCy('InvoiceOutDescriptorMenuSendCsvOption').click();
cy.get(confirmSend).click();
cy.checkNotification('Notification sent');
});
it('should delete an invoice ', () => {
cy.typeSearchbar('T2222222{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(4)').click();
cy.get(selectMenuOption(4)).click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut deleted');
});
it('shpuld book the invoice', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(5)').click();
cy.get(selectMenuOption(5)).click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut booked');
});
it('should generate the invoice PDF', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(6)').click();
cy.get(selectMenuOption(6)).click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('The invoice PDF document has been regenerated');
});
it('should refund the invoice ', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(7)').click();
cy.get(selectMenuOption(7)).click();
cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(2)').click();
cy.checkNotification('The following refund ticket have been created');
});