Skip to content

Commit

Permalink
fixed e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
konzz committed Jan 31, 2025
1 parent 8776305 commit d91429d
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions cypress/e2e/media-metadata.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit d91429d

Please sign in to comment.