add element upload UI

This commit is contained in:
Yisroel Baum 2026-06-02 10:30:48 +03:00
parent 4292494345
commit a2c3ffad8b
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 384 additions and 67 deletions

View file

@ -12,26 +12,17 @@ function loginAsAdmin(): void {
function fillElementForm(
title: string,
description: string,
iconImageUrl: string,
richText: string,
pdfPath: string,
youtubeUrl: string,
): void {
cy.get('[data-cy="admin-element-title"]').clear().type(title)
cy.get('[data-cy="admin-element-description"]').clear().type(description)
cy.get('[data-cy="admin-element-icon-image-url"]')
.clear()
.type(iconImageUrl)
cy.get('[data-cy="admin-element-rich-text"]').clear()
if (richText !== '') {
cy.get('[data-cy="admin-element-rich-text"]').type(richText, {
parseSpecialCharSequences: false,
})
}
cy.get('[data-cy="admin-element-pdf-path"]').clear()
if (pdfPath !== '') {
cy.get('[data-cy="admin-element-pdf-path"]').type(pdfPath)
}
cy.get('[data-cy="admin-element-youtube-url"]').clear()
if (youtubeUrl !== '') {
cy.get('[data-cy="admin-element-youtube-url"]').type(youtubeUrl)
@ -79,7 +70,6 @@ describe('admin element editing', () => {
it('saves element edits and restores the seed content through the UI', () => {
const originalTitle = 'Baderech HaAvodah'
const originalDescription = 'a structured path for inner and outer growth'
const originalIconImageUrl = '/assets/baderech-haavodah-icon.png'
const updatedTitle = 'Baderech HaAvodah Updated'
const updatedDescription = 'Updated admin description'
const updatedRichText = '<p>Updated admin rich text</p>'
@ -90,10 +80,8 @@ describe('admin element editing', () => {
fillElementForm(
updatedTitle,
updatedDescription,
originalIconImageUrl,
updatedRichText,
'',
'',
)
cy.get('[data-cy="admin-element-save"]').click()
@ -110,8 +98,6 @@ describe('admin element editing', () => {
fillElementForm(
originalTitle,
originalDescription,
originalIconImageUrl,
'',
'',
'',
)