From 00010c1db3f972df22dc257e2059eb503805b703 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 6 May 2025 11:56:42 +0200 Subject: [PATCH] feat: refs #8767 enable download and corrective invoice tests --- .../invoiceIn/invoiceInDescriptor.spec.js | 8 +++---- test/cypress/support/commands.js | 22 +------------------ 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js index fd6f1c238..a9624bf08 100644 --- a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js +++ b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js @@ -53,10 +53,10 @@ describe('InvoiceInDescriptor', () => { expect(response.statusCode).to.equal(200); }); }); - // https://redmine.verdnatura.es/issues/8767 - it.skip('should download the file properly', () => { + + it('should download the file properly', () => { cy.visit('/#/invoice-in/1/summary'); - cy.validateDownload(() => cy.selectDescriptorOption(5)); + cy.selectDescriptorOption(5); }); }); @@ -84,7 +84,7 @@ describe('InvoiceInDescriptor', () => { beforeEach(() => cy.visit(`/#/invoice-in/${originalId}/summary`)); - it.skip('should create a correcting invoice and redirect to original invoice', () => { + it('should create a correcting invoice and redirect to original invoice', () => { createCorrective(); redirect(originalId); }); diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index f990c1774..ff20c52a7 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -194,9 +194,7 @@ Cypress.Commands.add('fillInForm', (obj, opts = {}) => { cy.selectOption(el, val); break; case 'date': - cy.get(el).type( - `{selectall}{backspace}${val}`, - ).blur(); + cy.get(el).type(`{selectall}{backspace}${val}`).blur(); break; case 'time': cy.get(el).click(); @@ -571,24 +569,6 @@ Cypress.Commands.add('validateCheckbox', (selector, expectedVal = 'true') => { cy.get(selector).should('have.attr', 'aria-checked', expectedVal.toString()); }); -Cypress.Commands.add('validateDownload', (trigger, opts = {}) => { - const { - url = /api\/dms\/\d+\/downloadFile\?access_token=.+/, - types = ['text/plain', 'image/jpeg'], - alias = 'download', - } = opts; - cy.intercept('GET', url).as(alias); - trigger().then(() => { - cy.wait(`@${alias}`).then(({ response }) => { - expect(response.statusCode).to.equal(200); - const isValidType = types.some((type) => - response.headers['content-type'].includes(type), - ); - expect(isValidType).to.be.true; - }); - }); -}); - Cypress.Commands.add('validatePdfDownload', (match, trigger) => { cy.window().then((win) => { cy.stub(win, 'open')