feat: refs #8581 add tests for creating and filtering invoices in InvoiceInList
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2025-02-21 17:38:08 +01:00
parent fcea5b7bbe
commit ed097d7091
1 changed files with 44 additions and 3 deletions

View File

@ -1,9 +1,17 @@
/// <reference types="cypress" />
describe('InvoiceInList', () => {
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
const firstId = `${firstRow} > td:nth-child(2) span`;
const firstDetailBtn = `${firstRow} .q-btn:nth-child(1)`;
const summaryHeaders = '.summaryBody .header-link';
const mockInvoiceRef = `createMockInvoice${Math.floor(Math.random() * 100)}`;
const mock = {
vnSupplierSelect: { val: 'farmer king', type: 'select' },
'Invoice nº_input': mockInvoiceRef,
Company_select: { val: 'orn', type: 'select' },
'Expedition date_inputDate': '16-11-2001',
};
beforeEach(() => {
cy.viewport(1920, 1080);
@ -12,7 +20,7 @@ describe('InvoiceInList', () => {
cy.get('#searchbar input').should('be.visible').type('{enter}');
});
it('should redirect on clicking a invoice', () => {
it.skip('should redirect on clicking a invoice', () => {
cy.get(firstId)
.invoke('text')
.then((content) => {
@ -21,10 +29,43 @@ describe('InvoiceInList', () => {
cy.url().should('include', `/invoice-in/${id}/summary`);
});
});
// https://redmine.verdnatura.es/issues/8420
it('should open the details', () => {
it.skip('should open the details', () => {
cy.get(firstDetailBtn).click();
cy.get(summaryHeaders).eq(1).contains('Basic data');
cy.get(summaryHeaders).eq(4).contains('Vat');
});
it.skip('should create a new Invoice', () => {
cy.dataCy('vnTableCreateBtn').click();
cy.fillInForm(mock, { attr: 'data-cy' });
cy.dataCy('FormModelPopup_save').click();
cy.intercept('GET', /\/api\/InvoiceIns\/\d+\/getTotals$/).as('invoice');
cy.wait('@invoice').then(() =>
cy.validateDescriptor({
title: mockInvoiceRef,
listBox: {
0: '11/16/2001',
3: 'The farmer',
},
}),
);
cy.get('[data-cy="vnLvCompany"]').should('contain.text', 'ORN');
});
describe('right-panel', () => {
it('should filter by From param', () => {
cy.dataCy('From_inputDate').type('31/12/2000{enter}');
cy.validateVnTableRows({
cols: [
{
name: 'issued',
type: 'date',
val: '31/12/2000',
operation: 'after',
},
],
});
});
});
});