From d91429dba9efee9f8d9f0c41377a21954ef3d39f Mon Sep 17 00:00:00 2001 From: A happy cat Date: Fri, 31 Jan 2025 14:57:38 +0100 Subject: [PATCH] fixed e2e --- cypress/e2e/media-metadata.cy.ts | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/media-metadata.cy.ts b/cypress/e2e/media-metadata.cy.ts index bcc632271f..fd103b815b 100644 --- a/cypress/e2e/media-metadata.cy.ts +++ b/cypress/e2e/media-metadata.cy.ts @@ -70,7 +70,26 @@ describe('Media metadata', { defaultCommandTimeout: 5000 }, () => { }); }; - const addInvalidFile = (field: string) => { + const addInvalidVideoFile = (field: string) => { + cy.contains(field).parentsUntil('.form-group').contains('button', 'Add file').scrollIntoView(); + cy.contains(field).parentsUntil('.form-group').contains('button', 'Add file').click(); + cy.contains('button', 'Select from computer'); + cy.get('.upload-button input[type=file]') + .first() + .selectFile('./cypress/test_files/sample.pdf', { + force: true, + }); + cy.contains(field) + .parentsUntil('.form-group') + .contains('This file type is not supported on media fields') + .scrollIntoView(); + cy.contains(field) + .parentsUntil('.form-group') + .contains('This file type is not supported on media fields') + .should('be.visible'); + }; + + const addInvalidImageFile = (field: string) => { cy.contains(field).parentsUntil('.form-group').contains('button', 'Add file').scrollIntoView(); cy.contains(field).parentsUntil('.form-group').contains('button', 'Add file').click(); cy.contains('button', 'Select from computer'); @@ -163,8 +182,8 @@ describe('Media metadata', { defaultCommandTimeout: 5000 }, () => { // eslint-disable-next-line max-statements it('should show an error for an invalid property and allow to replace it for a valid one', () => { addEntity('Reporte con propiedades audiovisuales corregidas'); - addInvalidFile('Fotografía'); - addInvalidFile('Video'); + addInvalidImageFile('Fotografía'); + addInvalidVideoFile('Video'); clickMediaAction('Fotografía', 'Unlink'); addImage(); clickMediaAction('Video', 'Unlink');