refactor: refs #8581 update invoiceInCorrective component and add Cypress tests for invoice modification
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
f2a36310b2
commit
389728f41e
|
@ -1,22 +1,16 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, capitalize } from 'vue';
|
import { ref, computed, capitalize } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const arrayData = useArrayData();
|
const arrayData = useArrayData();
|
||||||
const invoiceIn = computed(() => arrayData.store.data);
|
const invoiceIn = computed(() => arrayData.store.data);
|
||||||
const invoiceInCorrectionRef = ref();
|
const invoiceInCorrectionRef = ref();
|
||||||
const filter = {
|
|
||||||
include: { relation: 'invoiceIn' },
|
|
||||||
where: { correctingFk: route.params.id },
|
|
||||||
};
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
name: 'origin',
|
name: 'origin',
|
||||||
|
@ -92,7 +86,8 @@ const requiredFieldRule = (val) => val || t('globals.requiredField');
|
||||||
v-if="invoiceIn"
|
v-if="invoiceIn"
|
||||||
data-key="InvoiceInCorrection"
|
data-key="InvoiceInCorrection"
|
||||||
url="InvoiceInCorrections"
|
url="InvoiceInCorrections"
|
||||||
:filter="filter"
|
:user-filter="{ include: { relation: 'invoiceIn' } }"
|
||||||
|
:filter="{ where: { correctingFk: $route.params.id } }"
|
||||||
auto-load
|
auto-load
|
||||||
primary-key="correctingFk"
|
primary-key="correctingFk"
|
||||||
:default-remove="false"
|
:default-remove="false"
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
describe('invoiceInCorrective', () => {
|
||||||
|
beforeEach(() => cy.login('administrative'));
|
||||||
|
|
||||||
|
it('should modify the invoice', () => {
|
||||||
|
cy.visit('/#/invoice-in/1/summary');
|
||||||
|
cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
|
||||||
|
cy.intercept('POST', '/api/InvoiceInCorrections/crud').as('crud');
|
||||||
|
cy.intercept('GET', /InvoiceInCorrections\?filter=.+/).as('getCorrective');
|
||||||
|
|
||||||
|
cy.selectDescriptorOption(4);
|
||||||
|
cy.selectOption('[data-cy="invoiceInDescriptorMenu_class"]', 'R5');
|
||||||
|
cy.selectOption('[data-cy="invoiceInDescriptorMenu_type"]', 'diferencias');
|
||||||
|
cy.selectOption('[data-cy="invoiceInDescriptorMenu_reason"]', 'customer');
|
||||||
|
cy.dataCy('saveCorrectiveInvoice').click();
|
||||||
|
|
||||||
|
cy.wait('@corrective').then(({ response }) => {
|
||||||
|
const correctingFk = response.body;
|
||||||
|
cy.url().should('include', `/invoice-in/${correctingFk}/summary`);
|
||||||
|
cy.visit(`/#/invoice-in/${correctingFk}/corrective`);
|
||||||
|
cy.selectOption('[data-cy="invoiceInCorrective_class"]', 'r4');
|
||||||
|
cy.selectOption('[data-cy="invoiceInCorrective_type"]', 'sustitución');
|
||||||
|
cy.selectOption('[data-cy="invoiceInCorrective_reason"]', 'vat');
|
||||||
|
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
|
|
||||||
|
cy.wait('@crud');
|
||||||
|
cy.reload();
|
||||||
|
cy.wait('@getCorrective');
|
||||||
|
cy.validateRow('tbody > :nth-of-type(1)', [
|
||||||
|
,
|
||||||
|
'S – Por sustitución',
|
||||||
|
'R4',
|
||||||
|
'Error in VAT calculation',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not be able to modify the invoice if the original invoice is booked', () => {
|
||||||
|
cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
|
||||||
|
cy.visit('/#/invoice-in/4/summary');
|
||||||
|
cy.selectDescriptorOption();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.selectDescriptorOption(4);
|
||||||
|
cy.dataCy('saveCorrectiveInvoice').click();
|
||||||
|
|
||||||
|
cy.wait('@corrective').then(({ response }) => {
|
||||||
|
const correctingFk = response.body;
|
||||||
|
cy.url().should('include', `/invoice-in/${correctingFk}/summary`);
|
||||||
|
cy.visit(`/#/invoice-in/${correctingFk}/corrective`);
|
||||||
|
|
||||||
|
cy.dataCy('invoiceInCorrective_class').should('be.disabled');
|
||||||
|
cy.dataCy('invoiceInCorrective_type').should('be.disabled');
|
||||||
|
cy.dataCy('invoiceInCorrective_reason').should('be.disabled');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -40,7 +40,7 @@ describe('InvoiceInDescriptor', () => {
|
||||||
cy.visit('/#/invoice-in/6/summary');
|
cy.visit('/#/invoice-in/6/summary');
|
||||||
cy.selectDescriptorOption(5);
|
cy.selectDescriptorOption(5);
|
||||||
|
|
||||||
cy.get('input[data-cy="sendEmailDialog_address"]').type(
|
cy.get('input[data-cy="sendEmailDialog_address_input"]').type(
|
||||||
'{selectall}jorgito@gmail.mx',
|
'{selectall}jorgito@gmail.mx',
|
||||||
);
|
);
|
||||||
cy.clickConfirm();
|
cy.clickConfirm();
|
||||||
|
|
Loading…
Reference in New Issue