fix: refs #8581 update supplier link in InvoiceInDescriptor and enhance validation in tests
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
efd364e3b2
commit
3fdd698109
|
@ -104,7 +104,7 @@ async function setInvoiceCorrection(id) {
|
|||
<VnLv :label="t('invoiceIn.list.amount')" :value="toCurrency(totalAmount)" />
|
||||
<VnLv :label="t('invoiceIn.list.supplier')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
<span class="link" data-cy="invoiceInDescriptor_supplier">
|
||||
{{ entity?.supplier?.nickname }}
|
||||
<SupplierDescriptorProxy :id="entity?.supplierFk" />
|
||||
</span>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
describe('InvoiceInDescriptor', () => {
|
||||
describe('more options', () => {
|
||||
beforeEach(() => cy.login('administrative'));
|
||||
beforeEach(() => cy.login('administrative'));
|
||||
|
||||
describe('more options', () => {
|
||||
it('should booking and unbooking the invoice properly', () => {
|
||||
const checkbox = '[data-cy="vnLvIs booked"] > .q-checkbox';
|
||||
cy.visit('/#/invoice-in/1/summary');
|
||||
|
@ -61,10 +61,7 @@ describe('InvoiceInDescriptor', () => {
|
|||
});
|
||||
|
||||
describe('buttons', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('administrative');
|
||||
cy.visit('/#/invoice-in/1/summary');
|
||||
});
|
||||
beforeEach(() => cy.visit('/#/invoice-in/1/summary'));
|
||||
|
||||
it('should navigate to the supplier summary', () => {
|
||||
cy.clicDescriptorAction(1);
|
||||
|
@ -87,26 +84,15 @@ describe('InvoiceInDescriptor', () => {
|
|||
describe('corrective', () => {
|
||||
const originalId = 1;
|
||||
|
||||
beforeEach(() => {
|
||||
cy.login('administrative');
|
||||
cy.visit(`/#/invoice-in/${originalId}/summary`);
|
||||
});
|
||||
beforeEach(() => cy.visit(`/#/invoice-in/${originalId}/summary`));
|
||||
|
||||
it('should create a correcting invoice and redirect to original invoice', () => {
|
||||
createCorrective(originalId, {
|
||||
class: 'R5',
|
||||
type: 'sustitución',
|
||||
reason: 'VAT',
|
||||
});
|
||||
createCorrective({ class: 'R5', type: 'sustitución', reason: 'VAT' });
|
||||
redirect(originalId);
|
||||
});
|
||||
|
||||
it('should create a correcting invoice and navigate to list filtered by corrective', () => {
|
||||
createCorrective(originalId, {
|
||||
class: 'R3',
|
||||
type: 'diferencias',
|
||||
reason: 'customer',
|
||||
});
|
||||
createCorrective({ class: 'R3', type: 'diferencias', reason: 'customer' });
|
||||
redirect(originalId);
|
||||
|
||||
cy.clicDescriptorAction(4);
|
||||
|
@ -122,12 +108,27 @@ describe('InvoiceInDescriptor', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('link', () => {
|
||||
it('should open the supplier descriptor popup', () => {
|
||||
cy.visit('/#/invoice-in/1/summary');
|
||||
cy.intercept('GET', /InvoiceIns\/1.*/).as('getInvoice');
|
||||
cy.intercept('GET', /Suppliers\/\d+/).as('getSupplier');
|
||||
cy.wait('@getInvoice');
|
||||
|
||||
cy.dataCy('invoiceInDescriptor_supplier').then(($el) => {
|
||||
const alias = $el.text().trim();
|
||||
$el.click();
|
||||
cy.wait('@getSupplier').then(() =>
|
||||
cy.validateDescriptor({ listbox: { 1: alias }, popup: true }),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function createCorrective(originalId, opts = {}) {
|
||||
const regex = new RegExp(`InvoiceIns/${originalId}\\?filter=.*`);
|
||||
function createCorrective(opts = {}) {
|
||||
cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
|
||||
cy.intercept('GET', regex).as('getOriginal');
|
||||
const { type, reason, class: classVal } = opts;
|
||||
|
||||
cy.selectDescriptorOption(4);
|
||||
|
@ -147,6 +148,8 @@ function createCorrective(originalId, opts = {}) {
|
|||
}
|
||||
|
||||
function redirect(subtitle) {
|
||||
const regex = new RegExp(`InvoiceIns/${subtitle}\\?filter=.*`);
|
||||
cy.intercept('GET', regex).as('getOriginal');
|
||||
cy.clicDescriptorAction(4);
|
||||
cy.wait('@getOriginal');
|
||||
cy.validateDescriptor({ subtitle });
|
||||
|
|
|
@ -447,13 +447,20 @@ Cypress.Commands.add('waitRequest', (alias, cb) => {
|
|||
});
|
||||
|
||||
Cypress.Commands.add('validateDescriptor', (toCheck = {}) => {
|
||||
const { title, subtitle, listbox = {} } = toCheck;
|
||||
const { title, description, subtitle, listbox = {}, popup = false } = toCheck;
|
||||
|
||||
if (title) cy.dataCy('cardDescriptor_title').contains(title);
|
||||
if (subtitle) cy.dataCy('cardDescriptor_subtitle').contains(subtitle);
|
||||
const popupSelector = popup ? '[role="menu"] ' : '';
|
||||
|
||||
if (title) cy.get(`${popupSelector}[data-cy="cardDescriptor_title"]`).contains(title);
|
||||
if (description)
|
||||
cy.get(`${popupSelector}[data-cy="cardDescriptor_description"]`).contains(
|
||||
description,
|
||||
);
|
||||
if (subtitle)
|
||||
cy.get(`${popupSelector}[data-cy="cardDescriptor_subtitle"]`).contains(subtitle);
|
||||
|
||||
for (const index in listbox)
|
||||
cy.get('[data-cy="cardDescriptor_listbox"] > *')
|
||||
cy.get(`${popupSelector}[data-cy="cardDescriptor_listbox"] > *`)
|
||||
.eq(index)
|
||||
.should('contain.text', listbox[index]);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue