From 42924943457417cd6a9feece1e4b31f0a46f25a4 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Tue, 2 Jun 2026 10:24:48 +0300 Subject: [PATCH] test element uploads --- .../cypress/e2e/admin-element.cy.ts | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) 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() + }) })