diff --git a/frontend/rabbi_gerzi/cypress/e2e/admin-element.cy.ts b/frontend/rabbi_gerzi/cypress/e2e/admin-element.cy.ts index 8678ec2..760ee87 100644 --- a/frontend/rabbi_gerzi/cypress/e2e/admin-element.cy.ts +++ b/frontend/rabbi_gerzi/cypress/e2e/admin-element.cy.ts @@ -120,4 +120,46 @@ describe('admin element editing', () => { .should('be.visible') .and('contain.text', 'Saved') }) + + it('uploads icon and pdf files immediately through the UI', () => { + cy.resetDb() + loginAsAdmin() + cy.visit('/admin/element/1') + + cy.get('[data-cy="admin-element-icon-image-input"]').selectFile( + 'public/assets/baderech-haavodah-icon.png', + { force: true }, + ) + cy.get('[data-cy="admin-element-icon-image-status"]') + .should('be.visible') + .and('contain.text', 'Icon image updated') + cy.get('[data-cy="admin-element-current-icon"]') + .should('be.visible') + .and('have.attr', 'src') + .and('include', '/storage/element-icons/') + + cy.get('[data-cy="admin-element-pdf-input"]').selectFile( + 'public/assets/pdfs/baderech.pdf', + { force: true }, + ) + cy.get('[data-cy="admin-element-pdf-status"]') + .should('be.visible') + .and('contain.text', 'PDF updated') + cy.get('[data-cy="admin-element-current-pdf"]') + .should('be.visible') + .and('have.attr', 'href') + .and('include', '/storage/element-pdfs/') + + cy.contains('header.site-header a', 'View Element').click() + cy.get('[data-cy="element-icon"]') + .should('be.visible') + .and('have.attr', 'src') + .and('include', '/storage/element-icons/') + cy.get('[data-cy="element-pdf-link"]') + .should('be.visible') + .and('have.attr', 'href') + .and('include', '/storage/element-pdfs/') + + cy.resetDb() + }) })