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');