From 99fa93587aab865c7fc9adff9c9c22ac4d4a23f4 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Wed, 27 May 2026 22:07:08 +0300 Subject: [PATCH] test introduction audio child --- backend/tests/Feature/DemoSeedDataTest.php | 19 +++++++++++++++++++ frontend/rabbi_gerzi/cypress/e2e/media.cy.ts | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/backend/tests/Feature/DemoSeedDataTest.php b/backend/tests/Feature/DemoSeedDataTest.php index 84159eb..fcc4fe7 100644 --- a/backend/tests/Feature/DemoSeedDataTest.php +++ b/backend/tests/Feature/DemoSeedDataTest.php @@ -79,6 +79,25 @@ class DemoSeedDataTest extends TestCase '/assets/pdfs/baderech.pdf', $childElements[0]->getPdfPath(), ); + + $introductionChildElements = $elementRepository->findByParentElement( + $childElements[0], + ); + $this->assertCount(1, $introductionChildElements); + $introductionAudioElement = $introductionChildElements[0]; + $this->assertSame( + 'Fundamentals # 1: Living Our Way to a Wholesome Fulfilled Life ' + . '(Audio)', + $introductionAudioElement->getTitle(), + ); + $this->assertSame('', $introductionAudioElement->getDescription()); + $this->assertNull($introductionAudioElement->getIconImageUrl()); + $this->assertSame('', $introductionAudioElement->getRichText()); + $this->assertNull($introductionAudioElement->getPdfPath()); + $this->assertSame( + 'https://www.youtube.com/watch?v=yHx-r4p6hHU&t=1s', + $introductionAudioElement->getYoutubeUrl(), + ); } private function serializeChildElements(array $childElements): array diff --git a/frontend/rabbi_gerzi/cypress/e2e/media.cy.ts b/frontend/rabbi_gerzi/cypress/e2e/media.cy.ts index e303253..b3e1424 100644 --- a/frontend/rabbi_gerzi/cypress/e2e/media.cy.ts +++ b/frontend/rabbi_gerzi/cypress/e2e/media.cy.ts @@ -1,5 +1,8 @@ describe('media page sets', () => { it('fetches and renders seeded set cards', () => { + const introductionAudioTitle = + 'Fundamentals # 1: Living Our Way to a Wholesome Fulfilled Life (Audio)' + cy.visit('/media') cy.get('header.site-header').within(() => { @@ -117,5 +120,21 @@ describe('media page sets', () => { .should('be.visible') .and('have.attr', 'href', '/assets/pdfs/baderech.pdf') .and('have.attr', 'target', '_blank') + cy.contains('[data-cy="child-element-link"]', introductionAudioTitle) + .as('introductionAudioLink') + .should('have.attr', 'href', '/element/8') + + cy.get('@introductionAudioLink').click() + cy.location('pathname').should('eq', '/element/8') + cy.contains('h1', introductionAudioTitle).should('be.visible') + cy.get('[data-cy="element-icon"]').should('not.exist') + cy.get('[data-cy="element-rich-text"]').should('not.exist') + cy.get('[data-cy="element-pdf-link"]').should('not.exist') + cy.get('[data-cy="child-element-list"]').should('not.exist') + cy.get('[data-cy="element-youtube-embed"]') + .should('be.visible') + .and('have.attr', 'src') + .and('include', 'https://www.youtube.com/embed/yHx-r4p6hHU') + .and('include', 'start=1') }) })