test element uploads

This commit is contained in:
Yisroel Baum 2026-06-02 10:24:48 +03:00
parent cd2e63d17d
commit 4292494345
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -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()
})
})