test introduction audio child

This commit is contained in:
Yisroel Baum 2026-05-27 22:07:08 +03:00
parent b0ffcdf27b
commit 99fa93587a
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 38 additions and 0 deletions

View file

@ -79,6 +79,25 @@ class DemoSeedDataTest extends TestCase
'/assets/pdfs/baderech.pdf', '/assets/pdfs/baderech.pdf',
$childElements[0]->getPdfPath(), $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 private function serializeChildElements(array $childElements): array

View file

@ -1,5 +1,8 @@
describe('media page sets', () => { describe('media page sets', () => {
it('fetches and renders seeded set cards', () => { it('fetches and renders seeded set cards', () => {
const introductionAudioTitle =
'Fundamentals # 1: Living Our Way to a Wholesome Fulfilled Life (Audio)'
cy.visit('/media') cy.visit('/media')
cy.get('header.site-header').within(() => { cy.get('header.site-header').within(() => {
@ -117,5 +120,21 @@ describe('media page sets', () => {
.should('be.visible') .should('be.visible')
.and('have.attr', 'href', '/assets/pdfs/baderech.pdf') .and('have.attr', 'href', '/assets/pdfs/baderech.pdf')
.and('have.attr', 'target', '_blank') .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')
}) })
}) })