feat: refs #8219 added invoice out e2e tests
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-11-26 12:24:02 +01:00
parent 6276843613
commit 7fb1a9e6b5
9 changed files with 198 additions and 17 deletions

View File

@ -485,6 +485,7 @@ invoiceOut:
card: card:
issued: Issued issued: Issued
customerCard: Customer card customerCard: Customer card
ticketList: Ticket List
summary: summary:
issued: Issued issued: Issued
dued: Due dued: Due

View File

@ -47,6 +47,7 @@ const states = ref();
:label="t('Amount')" :label="t('Amount')"
v-model="params.amount" v-model="params.amount"
is-outlined is-outlined
data-cy="InvoiceOutFilterAmountBtn"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>

View File

@ -101,6 +101,7 @@ onMounted(async () => {
dense dense
outlined outlined
rounded rounded
data-cy="InvoiceOutGlobalClientSelect"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -122,6 +123,7 @@ onMounted(async () => {
dense dense
outlined outlined
rounded rounded
data-cy="InvoiceOutGlobalSerialSelect"
/> />
<VnInputDate <VnInputDate
v-model="formData.invoiceDate" v-model="formData.invoiceDate"
@ -132,6 +134,7 @@ onMounted(async () => {
v-model="formData.maxShipped" v-model="formData.maxShipped"
:label="t('maxShipped')" :label="t('maxShipped')"
is-outlined is-outlined
data-cy="InvoiceOutGlobalMaxShippedDate"
/> />
<VnSelect <VnSelect
:label="t('company')" :label="t('company')"
@ -141,6 +144,7 @@ onMounted(async () => {
dense dense
outlined outlined
rounded rounded
data-cy="InvoiceOutGlobalCompanySelect"
/> />
<VnSelect <VnSelect
:label="t('printer')" :label="t('printer')"
@ -149,6 +153,7 @@ onMounted(async () => {
dense dense
outlined outlined
rounded rounded
data-cy="InvoiceOutGlobalPrinterSelect"
/> />
</div> </div>
<QBtn <QBtn

View File

@ -146,9 +146,7 @@ function downloadPdf() {
const [invoiceOut] = selectedCardsArray; const [invoiceOut] = selectedCardsArray;
openPdf(invoiceOut.id); openPdf(invoiceOut.id);
} else { } else {
const invoiceOutIdsArray = selectedCardsArray.map( const invoiceOutIdsArray = selectedCardsArray.map((invoiceOut) => invoiceOut.id);
(invoiceOut) => invoiceOut.id
);
const invoiceOutIds = invoiceOutIdsArray.join(','); const invoiceOutIds = invoiceOutIdsArray.join(',');
const params = { const params = {
@ -157,7 +155,6 @@ function downloadPdf() {
openReport(`${MODEL}/downloadZip`, params); openReport(`${MODEL}/downloadZip`, params);
} }
} }
watchEffect(selectedRows); watchEffect(selectedRows);
@ -181,6 +178,7 @@ watchEffect(selectedRows);
icon-right="cloud_download" icon-right="cloud_download"
@click="downloadPdf()" @click="downloadPdf()"
:disable="!hasSelectedCards" :disable="!hasSelectedCards"
data-cy="InvoiceOutDownloadPdfBtn"
> >
<QTooltip>{{ t('downloadPdf') }}</QTooltip> <QTooltip>{{ t('downloadPdf') }}</QTooltip>
</QBtn> </QBtn>
@ -201,7 +199,6 @@ watchEffect(selectedRows);
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
redirect="invoice-out" redirect="invoice-out"
auto-load
:table="{ :table="{
'row-key': 'id', 'row-key': 'id',
selection: 'multiple', selection: 'multiple',
@ -230,6 +227,7 @@ watchEffect(selectedRows);
v-model="data.ticketFk" v-model="data.ticketFk"
:label="t('globals.ticket')" :label="t('globals.ticket')"
style="flex: 1" style="flex: 1"
data-cy="InvoiceOutCreateTicketinput"
/> />
<div <div
@ -344,6 +342,7 @@ watchEffect(selectedRows);
option-value="code" option-value="code"
option-filter option-filter
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
data-cy="InvoiceOutCreateSerialSelect"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">

View File

@ -0,0 +1,51 @@
/// <reference types="cypress" />
describe('InvoiceOut manual invoice path', () => {
const notification = '.q-notification__message';
const invoice = {
Ticket: { val: '8' },
Serial: { val: 'Española rápida', type: 'select' },
};
const invoiceError = {
Ticket: { val: '1' },
Serial: { val: 'T - Española rapida', type: 'select' },
};
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/list`);
cy.dataCy('vnSearchBar').find('input').type('{enter}');
});
it('should search and filter an invoice and enter to the summary', () => {
cy.dataCy('vnSearchBar').find('input').type('1{enter}');
cy.get('.q-virtual-scroll__content > :nth-child(2) > :nth-child(7)').click();
cy.get('.header > a.q-btn > .q-btn__content').click();
cy.dataCy('vnSearchBar').find('input').type('{enter}');
cy.dataCy('InvoiceOutFilterAmountBtn').find('input').type('8.88{enter}');
});
it('should download a pdf with one and all invoices', () => {
cy.get(
':nth-child(6) > :nth-child(1) > .q-checkbox > .q-checkbox__inner'
).click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
cy.get(
':nth-child(6) > :nth-child(1) > .q-checkbox > .q-checkbox__inner'
).click();
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
});
it('should give an error when manual invoicing a ticket that is already invoiced', () => {
cy.get('[data-cy="vnTableCreateBtn"]').click();
cy.fillInForm(invoiceError);
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.get(notification).should('contains.text', 'This ticket is already invoiced');
});
it('should create a manual invoice and enter to its summary', () => {
cy.get('[data-cy="vnTableCreateBtn"]').click();
cy.fillInForm(invoice);
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.get(notification).should('contains.text', 'Data created');
});
});

View File

@ -0,0 +1,27 @@
/// <reference types="cypress" />
describe('InvoiceOut manual invoice path', () => {
const notification = '.q-notification__message';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/ticket/list`);
cy.get('#searchbar input').type('{enter}');
});
it('should create an invoice from a ticket and go to that invoice', () => {
cy.get(
'[label="Customer ID"] > .q-field > .q-field__inner > .q-field__control'
).type('1101{enter}');
cy.get(
'[data-q-vs-anchor=""] > :nth-child(1) > .q-checkbox > .q-checkbox__inner'
).click();
cy.get(
'[style="transform: translate(-256px, 0px); margin: 80px 20px; z-index: 2;"] > div > .q-btn'
).click();
cy.get(notification).should('contains.text', 'Data saved');
cy.get('.q-virtual-scroll__content > :nth-child(1) > :nth-child(3)').click();
cy.get(':nth-child(8) > .value > .link').click();
cy.get('[href="#/invoice-out/6/summary"] > .q-btn > .q-btn__content').click();
});
});

View File

@ -0,0 +1,18 @@
/// <reference types="cypress" />
describe('InvoiceOut manual invoice path', () => {
const notification = '.q-notification__message';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/negative-bases`);
});
it('should filter and download as CSV', () => {
cy.get(
':nth-child(7) > .full-width > :nth-child(1) > .column > div.q-px-xs > .q-field > .q-field__inner > .q-field__control'
).type('23{enter}');
cy.get('#subToolbar > .q-btn').click();
cy.get(notification).should('contains.text', 'CSV downloaded successfully');
});
});

View File

@ -0,0 +1,56 @@
/// <reference types="cypress" />
describe('InvoiceOut manual invoice path', () => {
const notification = '.q-notification__message';
const transferInvoice = {
Client: { val: 'employee', type: 'select' },
Type: { val: 'Error in customer data', type: 'select' },
};
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/list`);
cy.get('#searchbar input').type('{enter}');
});
it('should generate the invoice PDF', () => {
cy.get('#searchbar input').type('T1111111{enter}');
cy.get('[data-cy="descriptor-more-opts"] > .q-btn__content > .q-icon').click();
cy.get('.q-menu > .q-list > :nth-child(6)').click();
cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.get(notification).should(
'contains.text',
'The invoice PDF document has been regenerated'
);
});
it('should refund the invoice ', () => {
cy.get('#searchbar input').type('T1111111{enter}');
cy.get('[data-cy="descriptor-more-opts"] > .q-btn__content > .q-icon').click();
cy.get('.q-menu > .q-list > :nth-child(7)').click();
cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(2)').click();
cy.get(notification).should(
'contains.text',
'The following refund ticket have been created 1000000'
);
});
it('should delete an invoice ', () => {
cy.get('#searchbar input').type('T2222222{enter}');
cy.get('.q-menu > .q-list > :nth-child(4)').click();
cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.get(notification).should('contains.text', 'InvoiceOut deleted');
});
it('should transfer the invoice ', () => {
cy.get('#searchbar input').type('T1111111{enter}');
cy.get('[data-cy="descriptor-more-opts"] > .q-btn__content > .q-icon').click();
cy.get('.q-menu > .q-list > :nth-child(1)').click();
cy.fillInForm(transferInvoice);
cy.get('.q-mt-lg > .q-btn').click();
cy.get(notification).should(
'contains.text',
'The following refund ticket have been created 1000000'
);
});
});

View File

@ -0,0 +1,23 @@
/// <reference types="cypress" />
describe('InvoiceOut manual invoice path', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/global-invoicing`);
});
it('should filter and download as CSV', () => {
cy.get('.q-mb-sm > .q-radio__inner').click();
cy.get('[data-cy="InvoiceOutGlobalClientSelect"]').type('1102');
cy.get('.q-menu .q-item').contains('1102').click();
cy.get('[data-cy="InvoiceOutGlobalSerialSelect"]').click();
cy.get('.q-menu .q-item').contains('global').click();
cy.get('[data-cy="InvoiceOutGlobalCompanySelect"]').type('VNL');
cy.get('.q-menu .q-item').contains('VNL').click();
cy.get('[data-cy="InvoiceOutGlobalPrinterSelect"]').type('printer1');
cy.get('.q-menu .q-item').contains('printer1').click();
cy.get(
'[label="Max date ticket"] > .q-field > .q-field__inner > .q-field__control'
).type('01-01-2000{enter}');
});
});