diff --git a/backend/database/seeders/ElementSeeder.php b/backend/database/seeders/ElementSeeder.php index ba89ab1..776d842 100644 --- a/backend/database/seeders/ElementSeeder.php +++ b/backend/database/seeders/ElementSeeder.php @@ -6,7 +6,6 @@ use App\Element\CreateElementDto; use App\Element\ElementRepository; use App\Set\SetRepository; use Illuminate\Database\Seeder; -use RuntimeException; class ElementSeeder extends Seeder { @@ -20,156 +19,36 @@ class ElementSeeder extends Seeder title: $baderechSet->getName(), description: $baderechSet->getDescription(), iconImageUrl: '/assets/baderech-haavodah-icon.png', - richText: '', - pdfPath: null, - youtubeUrl: null, - parentElement: null, - )); - - $baderechChildElements = [ - [ - 'title' => '1. Introduction', - 'description' => 'Your beliefs influence your thinking, ' - . 'and your thinking drives your choices. When you ' - . 'nurture healthy beliefs - about yourself, about ' - . 'the Creator, and about the meaning of life - you ' - . 'unlock the ability to live with strength, confidence, ' - . 'and hope.', - 'richText' => $this->introductionRichText(), - 'pdfPath' => '/assets/pdfs/baderech.pdf', - ], - [ - 'title' => '2. Foundations', - 'description' => 'Focal points for thriving in a chaotic ' - . 'world. In this fast, complex era, you flourish when ' - . 'you develop clarity, well-being, resilience, and the ' - . 'ability to uplift the physical world with spiritual ' - . 'intention.', - 'richText' => '', - 'pdfPath' => null, - ], - [ - 'title' => '3. Divine Plan', - 'description' => 'Understanding the unique greatness of our ' - . 'generation and the call to remain hopeful, ' - . 'optimistic, and resilient.', - 'richText' => '', - 'pdfPath' => null, - ], - [ - 'title' => '4. Architecture of the Soul', - 'description' => "Becoming a Baal Da'at - A Master of " - . 'Inner Awareness', - 'richText' => '', - 'pdfPath' => null, - ], - [ - 'title' => '5. Arba Yesodot', - 'description' => 'A structured approach to balanced living: ' - . 'Physical & Financial Health, Relationships, Wisdom ' - . 'and Guidance.', - 'richText' => '', - 'pdfPath' => null, - ], - [ - 'title' => '6. Fluid Integration', - 'description' => 'A series of practical exercises to ' - . 'engender a shift in mindset, embed healthy routines, ' - . 'positive life practices.', - 'richText' => '', - 'pdfPath' => null, - ], - ]; - - $introductionElement = null; - foreach ($baderechChildElements as $baderechChildElement) { - $createdElement = $elementRepository->create(new CreateElementDto( - set: $baderechSet, - title: $baderechChildElement['title'], - description: $baderechChildElement['description'], - iconImageUrl: null, - richText: $baderechChildElement['richText'], - pdfPath: $baderechChildElement['pdfPath'], - youtubeUrl: null, - parentElement: $rootElement, - )); - if ($baderechChildElement['title'] === '1. Introduction') { - $introductionElement = $createdElement; - } - } - - if ($introductionElement === null) { - throw new RuntimeException('Introduction element was not seeded'); - } - - $elementRepository->create(new CreateElementDto( - set: $baderechSet, - title: 'Fundamentals # 1: Living Our Way to a Wholesome ' - . 'Fulfilled Life (Audio)', - description: '', - iconImageUrl: null, - richText: '', - pdfPath: null, + richText: '

Begin with a clear map for avodah growth.

' + . '

Move steadily from awareness ' + . 'to practice.

', + pdfPath: '/assets/pdfs/baderech.pdf', youtubeUrl: 'https://www.youtube.com/watch?v=' . 'yHx-r4p6hHU&t=1s', - parentElement: $introductionElement, + parentElement: null, + )); + $elementRepository->create(new CreateElementDto( + set: $baderechSet, + title: 'Avodah Foundations', + description: 'Core foundations for building a steady ' + . 'avodah practice.', + iconImageUrl: null, + richText: '

Avodah foundations begin with honest awareness ' + . 'and small repeatable steps.

', + pdfPath: null, + youtubeUrl: null, + parentElement: $rootElement, + )); + $elementRepository->create(new CreateElementDto( + set: $baderechSet, + title: 'Daily Practice', + description: 'Practical steps for consistent daily growth.', + iconImageUrl: null, + richText: '

Daily practice turns inspiration into a ' + . 'dependable rhythm.

', + pdfPath: null, + youtubeUrl: null, + parentElement: $rootElement, )); } - - private function introductionRichText(): string - { - return '

' - . 'What is Baderech HaAvoda?

' - . '

Why We Need a Path of Spiritual Practice

' - . "

A 'Baderech HaAvoda' is a way of living - a structured " - . 'path for inner and outer growth, spiritual refinement, and ' - . 'personal development. It is the art and discipline of knowing ' - . 'where to place your attention, how to engage your inner and ' - . 'outer world, and how to live the kind of life Hashem designed ' - . 'for human beings: a life of wholeness, integration, clarity, ' - . 'and joy.

' - . '

Throughout Jewish history, our sages taught that no person ' - . 'can reach their potential without a derech - a framework that ' - . 'provides:

' - . '' - . '

Baderech HaAvoda answers core human questions:

' - . '' - . '

Without a derech, people react to life instead of ' - . 'responding with wisdom.

' - . '

Without a derech, inspiration fades as quickly as it ' - . 'comes.

' - . '

Without a derech, a person cannot integrate what they ' - . 'learn into who they become.

' - . '

A Baderech HaAvoda is therefore not a luxury - it is a ' - . 'necessity for anyone who wants to live consciously, ' - . 'purposefully, and in alignment with their Creator.

' - . '

The Challenge of Our Generation

' - . '

We live in a time overflowing with information and ' - . 'stimulation, yet starving for depth.

' - . '

Our generation faces challenges that previous generations ' - . 'rarely confronted:

' - . '' - . '

People today are not taught:

' - . '' - . '

We have incredible access to knowledge, yet many feel lost ' - . '- not for lack of information, but for lack of direction.

' - . '

A Baderech HaAvoda gives structure to the soul, it creates ' - . 'inner order, and it transforms scattered potential into ' - . 'living wisdom. It is a map for living a wholesome, healthy, ' - . 'and spiritually aligned life - the life we were created for.' - . '

'; - } } diff --git a/backend/tests/Feature/DemoSeedDataTest.php b/backend/tests/Feature/DemoSeedDataTest.php deleted file mode 100644 index fcc4fe7..0000000 --- a/backend/tests/Feature/DemoSeedDataTest.php +++ /dev/null @@ -1,172 +0,0 @@ -seed(DatabaseSeeder::class); - - $setRepository = app(SetRepository::class); - $elementRepository = app(ElementRepository::class); - $baderechSet = $setRepository->find(1); - $rootElement = $elementRepository->findRootBySet($baderechSet); - $childElements = $elementRepository->findByParentElement($rootElement); - - $this->assertSame('', $rootElement->getRichText()); - $this->assertNull($rootElement->getPdfPath()); - $this->assertNull($rootElement->getYoutubeUrl()); - $this->assertCount(6, $childElements); - $this->assertSame( - [ - [ - 'title' => '1. Introduction', - 'description' => 'Your beliefs influence your thinking, ' - . 'and your thinking drives your choices. When you ' - . 'nurture healthy beliefs - about yourself, about ' - . 'the Creator, and about the meaning of life - you ' - . 'unlock the ability to live with strength, ' - . 'confidence, and hope.', - ], - [ - 'title' => '2. Foundations', - 'description' => 'Focal points for thriving in a chaotic ' - . 'world. In this fast, complex era, you flourish ' - . 'when you develop clarity, well-being, resilience, ' - . 'and the ability to uplift the physical world with ' - . 'spiritual intention.', - ], - [ - 'title' => '3. Divine Plan', - 'description' => 'Understanding the unique greatness of ' - . 'our generation and the call to remain hopeful, ' - . 'optimistic, and resilient.', - ], - [ - 'title' => '4. Architecture of the Soul', - 'description' => "Becoming a Baal Da'at - A Master of " - . 'Inner Awareness', - ], - [ - 'title' => '5. Arba Yesodot', - 'description' => 'A structured approach to balanced ' - . 'living: Physical & Financial Health, ' - . 'Relationships, Wisdom and Guidance.', - ], - [ - 'title' => '6. Fluid Integration', - 'description' => 'A series of practical exercises to ' - . 'engender a shift in mindset, embed healthy ' - . 'routines, positive life practices.', - ], - ], - $this->serializeChildElements($childElements), - ); - $this->assertSame( - $this->expectedIntroductionRichText(), - $childElements[0]->getRichText(), - ); - $this->assertSame( - '/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 - { - $serializedChildElements = []; - foreach ($childElements as $childElement) { - $serializedChildElements[] = [ - 'title' => $childElement->getTitle(), - 'description' => $childElement->getDescription(), - ]; - } - - return $serializedChildElements; - } - - private function expectedIntroductionRichText(): string - { - return '

' - . 'What is Baderech HaAvoda?

' - . '

Why We Need a Path of Spiritual Practice

' - . "

A 'Baderech HaAvoda' is a way of living - a structured " - . 'path for inner and outer growth, spiritual refinement, and ' - . 'personal development. It is the art and discipline of knowing ' - . 'where to place your attention, how to engage your inner and ' - . 'outer world, and how to live the kind of life Hashem designed ' - . 'for human beings: a life of wholeness, integration, clarity, ' - . 'and joy.

' - . '

Throughout Jewish history, our sages taught that no person ' - . 'can reach their potential without a derech - a framework that ' - . 'provides:

' - . '' - . '

Baderech HaAvoda answers core human questions:

' - . '' - . '

Without a derech, people react to life instead of ' - . 'responding with wisdom.

' - . '

Without a derech, inspiration fades as quickly as it ' - . 'comes.

' - . '

Without a derech, a person cannot integrate what they ' - . 'learn into who they become.

' - . '

A Baderech HaAvoda is therefore not a luxury - it is a ' - . 'necessity for anyone who wants to live consciously, ' - . 'purposefully, and in alignment with their Creator.

' - . '

The Challenge of Our Generation

' - . '

We live in a time overflowing with information and ' - . 'stimulation, yet starving for depth.

' - . '

Our generation faces challenges that previous generations ' - . 'rarely confronted:

' - . '' - . '

People today are not taught:

' - . '' - . '

We have incredible access to knowledge, yet many feel lost ' - . '- not for lack of information, but for lack of direction.

' - . '

A Baderech HaAvoda gives structure to the soul, it creates ' - . 'inner order, and it transforms scattered potential into ' - . 'living wisdom. It is a map for living a wholesome, healthy, ' - . 'and spiritually aligned life - the life we were created for.' - . '

'; - } -} diff --git a/frontend/rabbi_gerzi/cypress/e2e/media.cy.ts b/frontend/rabbi_gerzi/cypress/e2e/media.cy.ts index b3e1424..c2894a4 100644 --- a/frontend/rabbi_gerzi/cypress/e2e/media.cy.ts +++ b/frontend/rabbi_gerzi/cypress/e2e/media.cy.ts @@ -1,8 +1,5 @@ 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(() => { @@ -48,93 +45,54 @@ describe('media page sets', () => { .should('be.visible') .and('have.attr', 'src') .and('include', '/assets/baderech-haavodah-icon.png') - cy.get('[data-cy="element-rich-text"]').should('not.exist') - cy.get('[data-cy="element-youtube-embed"]') - .should('not.exist') - cy.get('[data-cy="element-pdf-link"]').should('not.exist') - cy.get('[data-cy="child-element-list"]').should('be.visible') - cy.get('[data-cy="child-element-list"]') - .should( - 'not.contain.text', - 'Begin with a clear map for avodah growth.', - ) - cy.contains('[data-cy="child-element-link"]', '1. Introduction') - .as('introductionLink') - .should('have.attr', 'href', '/element/2') - cy.get('@introductionLink') - .should( - 'contain.text', - 'Your beliefs influence your thinking, and your thinking drives', - ) - cy.contains('[data-cy="child-element-link"]', '2. Foundations') - .should( - 'contain.text', - 'Focal points for thriving in a chaotic world.', - ) - cy.contains('[data-cy="child-element-link"]', '3. Divine Plan') - .should( - 'contain.text', - 'Understanding the unique greatness of our generation', - ) - cy.contains( - '[data-cy="child-element-link"]', - '4. Architecture of the Soul', - ) - .should( - 'contain.text', - "Becoming a Baal Da'at - A Master of Inner Awareness", - ) - cy.contains('[data-cy="child-element-link"]', '5. Arba Yesodot') - .should('contain.text', 'Physical & Financial Health') - cy.contains('[data-cy="child-element-link"]', '6. Fluid Integration') - .should('contain.text', 'engender a shift in mindset') - .and('have.attr', 'href', '/element/7') - - cy.contains('[data-cy="child-element-link"]', '1. Introduction') - .click() - cy.location('pathname').should('eq', '/element/2') - cy.contains('h1', '1. Introduction').should('be.visible') - cy.get('[data-cy="element-icon"]').should('not.exist') - cy.get('[data-cy="element-rich-text"]') - .should('contain.text', 'What is Baderech HaAvoda?') - .and( - 'contain.text', - 'Why We Need a Path of Spiritual Practice', - ) - .and( - 'contain.text', - "A 'Baderech HaAvoda' is a way of living", - ) - .and('contain.text', 'Direction') - .and('contain.text', 'How do I grow?') - .and('contain.text', 'The Challenge of Our Generation') - .and('contain.text', 'So many are Hashkafikly homeless') - .and('contain.text', 'the life we were created for.') - cy.contains( - '[data-cy="element-rich-text"] h2', - 'What is Baderech HaAvoda?', - ) - .should('have.css', 'text-align', 'center') - cy.get('[data-cy="element-youtube-embed"]').should('not.exist') - cy.contains('[data-cy="element-pdf-link"]', 'View PDF') - .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-rich-text"]').within(() => { + cy.contains('Begin with a clear map for avodah growth.') + .should('be.visible') + cy.contains('strong', 'Move steadily').should('be.visible') + }) 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') + cy.contains('[data-cy="element-pdf-link"]', 'View PDF') + .should('be.visible') + .and('have.attr', 'href', '/assets/pdfs/baderech.pdf') + .and('have.attr', 'target', '_blank') + cy.get('[data-cy="child-element-list"]').should('be.visible') + cy.get('[data-cy="child-element-list"]') + .should( + 'not.contain.text', + 'Avodah foundations begin with honest awareness', + ) + cy.contains('[data-cy="child-element-link"]', 'Avodah Foundations') + .as('avodahFoundationsLink') + .should('have.attr', 'href', '/element/2') + cy.get('@avodahFoundationsLink') + .should( + 'contain.text', + 'Core foundations for building a steady avodah practice.', + ) + cy.contains('[data-cy="child-element-link"]', 'Daily Practice') + .as('dailyPracticeLink') + .should('have.attr', 'href', '/element/3') + cy.get('@dailyPracticeLink') + .should( + 'contain.text', + 'Practical steps for consistent daily growth.', + ) + + cy.contains('[data-cy="child-element-link"]', 'Avodah Foundations') + .click() + cy.location('pathname').should('eq', '/element/2') + cy.contains('h1', 'Avodah Foundations').should('be.visible') + cy.get('[data-cy="element-icon"]').should('not.exist') + cy.get('[data-cy="element-rich-text"]') + .should( + 'contain.text', + 'Avodah foundations begin with honest awareness', + ) + cy.get('[data-cy="element-youtube-embed"]').should('not.exist') + cy.get('[data-cy="element-pdf-link"]').should('not.exist') }) })