diff --git a/src/components/common/SendEmailDialog.vue b/src/components/common/SendEmailDialog.vue
index d73133921..07d63d3a6 100644
--- a/src/components/common/SendEmailDialog.vue
+++ b/src/components/common/SendEmailDialog.vue
@@ -56,7 +56,12 @@ async function confirm() {
{{ t('The notification will be sent to the following address') }}
-
+
diff --git a/src/pages/InvoiceIn/Card/InvoiceInDescriptorMenu.vue b/src/pages/InvoiceIn/Card/InvoiceInDescriptorMenu.vue
index 20f896083..4063ee4d5 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInDescriptorMenu.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInDescriptorMenu.vue
@@ -319,6 +319,7 @@ onBeforeMount(async () => {
v-close-popup
@click="createInvoiceInCorrection"
:disable="isNotFilled"
+ data-cy="saveCorrectiveInvoice"
/>
diff --git a/test/cypress/integration/invoiceIn/invoiceInCorrective.spec.js b/test/cypress/integration/invoiceIn/invoiceInCorrective.spec.js
deleted file mode 100644
index 731174040..000000000
--- a/test/cypress/integration/invoiceIn/invoiceInCorrective.spec.js
+++ /dev/null
@@ -1,22 +0,0 @@
-///
-describe('InvoiceInCorrective', () => {
- const saveDialog = '.q-card > .q-card__actions > .q-btn--standard ';
-
- it('should create a correcting invoice', () => {
- cy.viewport(1280, 720);
- cy.login('developer');
- cy.visit(`/#/invoice-in/1/summary`);
- cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
-
- cy.openActionsDescriptor();
-
- cy.dataCy('createCorrectiveItem').click();
- cy.get(saveDialog).click();
- cy.wait('@corrective').then((interception) => {
- const correctingId = interception.response.body;
- cy.url().should('include', `/invoice-in/${correctingId}/summary`);
- cy.visit(`/#/invoice-in/${correctingId}/corrective`);
- });
- cy.get('tbody > tr:visible').should('have.length', 1);
- });
-});
diff --git a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
index db78cfdb8..7930ab1a2 100644
--- a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
@@ -53,23 +53,47 @@ describe('InvoiceInDescriptor', () => {
});
});
- // it('should send the agricultural PDF properly', () => {
- // cy.visit('/#/invoice-in/6/summary');
- // cy.selectDescriptorOption(5);
- // cy.checkNotification('Email sent');
- // });
+ it('should send the agricultural PDF properly', () => {
+ cy.intercept('POST', 'api/InvoiceIns/6/invoice-in-email').as('sendEmail');
+ cy.visit('/#/invoice-in/6/summary');
+ cy.selectDescriptorOption(5);
- // it('should create a corrective invoice properly', () => {
- // cy.visit('/#/invoice-in/2/summary');
- // cy.selectDescriptorOption(6);
- // cy.dataCy('createCorrectiveItem').click();
- // cy.checkNotification('Corrective invoice created');
- // });
+ cy.get('input[data-cy="sendEmailDialog_address"]').type(
+ '{selectall}jorgito@gmail.mx',
+ );
+ cy.clickConfirm();
+ cy.checkNotification('Notification sent');
+ cy.wait('@sendEmail').then(({ request, response }) => {
+ expect(request.body).to.deep.equal({
+ recipientId: 2,
+ recipient: 'jorgito@gmail.mx',
+ });
+ expect(response.statusCode).to.equal(200);
+ });
+ });
- // it('should download the file properly', () => {
- // cy.visit('/#/invoice-in/2/summary');
- // cy.selectDescriptorOption(7);
- // cy.checkNotification('File downloaded');
- // });
+ it('should create a correcting invoice', () => {
+ cy.visit(`/#/invoice-in/1/summary`);
+ cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
+ cy.selectDescriptorOption(4);
+ cy.dataCy('saveCorrectiveInvoice').click();
+ cy.wait('@corrective').then(({ response }) => {
+ const correctingId = response.body;
+ cy.url().should('include', `/invoice-in/${correctingId}/summary`);
+ cy.visit(`/#/invoice-in/${correctingId}/corrective`);
+ });
+ cy.get('tbody > tr:visible').should('have.length', 1);
+ });
+
+ it('should download the file properly', () => {
+ cy.visit('/#/invoice-in/1/summary');
+ cy.selectDescriptorOption(5);
+ const regex = /api\/dms\/1\/downloadFile\?access_token=.*/;
+ cy.intercept('GET', regex).as('download');
+ cy.wait('@download').then(({ response }) => {
+ expect(response.statusCode).to.equal(200);
+ expect(response.headers['content-type']).to.include('text/plain');
+ });
+ });
});
});