#8219 Added InvoiceOut e2e tests #1001

Merged
jon merged 24 commits from 8219-InvoiceOutE2E into dev 2025-01-08 06:41:33 +00:00
9 changed files with 198 additions and 17 deletions
Showing only changes of commit 7fb1a9e6b5 - Show all commits

View File

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

View File

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

View File

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

View File

@ -139,25 +139,22 @@ function openPdf(id) {
}
function downloadPdf() {
if (selectedRows.value.size === 0) return;
const selectedCardsArray = Array.from(selectedRows.value.values());
if (selectedRows.value.size === 0) return;
const selectedCardsArray = Array.from(selectedRows.value.values());
if (selectedRows.value.size === 1) {
const [invoiceOut] = selectedCardsArray;
openPdf(invoiceOut.id);
} else {
const invoiceOutIdsArray = selectedCardsArray.map(
(invoiceOut) => invoiceOut.id
);
const invoiceOutIds = invoiceOutIdsArray.join(',');
if (selectedRows.value.size === 1) {
const [invoiceOut] = selectedCardsArray;
openPdf(invoiceOut.id);
} else {
const invoiceOutIdsArray = selectedCardsArray.map((invoiceOut) => invoiceOut.id);
const invoiceOutIds = invoiceOutIdsArray.join(',');
const params = {
ids: invoiceOutIds,
};
openReport(`${MODEL}/downloadZip`, params);
}
const params = {
ids: invoiceOutIds,
};
openReport(`${MODEL}/downloadZip`, params);
}
}
watchEffect(selectedRows);
@ -181,6 +178,7 @@ watchEffect(selectedRows);
icon-right="cloud_download"
@click="downloadPdf()"
:disable="!hasSelectedCards"
data-cy="InvoiceOutDownloadPdfBtn"
>
<QTooltip>{{ t('downloadPdf') }}</QTooltip>
</QBtn>
@ -201,7 +199,6 @@ watchEffect(selectedRows);
order="id DESC"
:columns="columns"
redirect="invoice-out"
auto-load
:table="{
'row-key': 'id',
selection: 'multiple',
@ -230,6 +227,7 @@ watchEffect(selectedRows);
v-model="data.ticketFk"
:label="t('globals.ticket')"
style="flex: 1"
data-cy="InvoiceOutCreateTicketinput"
/>
<div
@ -344,6 +342,7 @@ watchEffect(selectedRows);
option-value="code"
option-filter
:expr-builder="exprBuilder"
data-cy="InvoiceOutCreateSerialSelect"
>
<template #option="scope">
<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}');
jsegarra marked this conversation as resolved Outdated

🚩

🚩
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();
jsegarra marked this conversation as resolved Outdated

porque aqui está de diferente forma que en la 29?

porque aqui está de diferente forma que en la 29?
Review

fillInForm¿?

fillInForm¿?
Review

Esta bien

Esta bien
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);
jsegarra marked this conversation as resolved Outdated

porque aqui está de diferente forma que en la 29?

porque aqui está de diferente forma que en la 29?
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}');
jon marked this conversation as resolved
Review

tienes estilo diferente al anterior test

tienes estilo diferente al anterior test
});
it('should create an invoice from a ticket and go to that invoice', () => {
cy.get(
jon marked this conversation as resolved Outdated

Si es VnInput mirate el selector

Si es VnInput mirate el selector

Revisa el archivo commands

Revisa el archivo commands

También se puede usar cy.get('[data-cy="Customer ID_input"]')

También se puede usar cy.get('[data-cy="Customer ID_input"]')
'[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');
jon marked this conversation as resolved
Review

commands.js

commands.js
});
});

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}');
jon marked this conversation as resolved
Review

Revisalo

Revisalo
});
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();
jon marked this conversation as resolved Outdated

revisate el archivo comands

revisate el archivo comands
cy.get('.q-menu > .q-list > :nth-child(6)').click();
cy.get('[data-cy="VnConfirm_confirm"]').click();
jon marked this conversation as resolved Outdated

Esto me hace pensar que nos has tirado los tests 🚩

Esto me hace pensar que nos has tirado los tests 🚩
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(
jon marked this conversation as resolved Outdated

revisate el archivo commands

revisate el archivo commands
'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();
jon marked this conversation as resolved
Review

revisate commands

revisate commands
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}');
});
});