test pdf viewer

This commit is contained in:
Yisroel Baum 2026-06-25 22:15:06 +03:00
parent c445234092
commit f1c4e896b6
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 34 additions and 16 deletions

View file

@ -281,14 +281,12 @@ describe('admin element editing', () => {
.should('be.visible')
.and('have.attr', 'src')
.and('include', '/storage/element-icons/')
cy.get('[data-cy="element-short-pdf-link"]')
cy.get('[data-cy="element-short-pdf-viewer-button"]')
.should('be.visible')
.and('have.attr', 'href')
.and('include', '/storage/element-pdfs/short/')
cy.get('[data-cy="element-long-pdf-link"]')
.and('contain.text', 'View Short PDF')
cy.get('[data-cy="element-long-pdf-viewer-button"]')
.should('be.visible')
.and('have.attr', 'href')
.and('include', '/storage/element-pdfs/long/')
.and('contain.text', 'View Long PDF')
cy.resetDb()
})
@ -341,8 +339,8 @@ describe('admin element editing', () => {
cy.contains('header.site-header a', 'View Element').click()
cy.get('[data-cy="element-icon"]').should('not.exist')
cy.get('[data-cy="element-short-pdf-link"]').should('not.exist')
cy.get('[data-cy="element-long-pdf-link"]').should('not.exist')
cy.get('[data-cy="element-short-pdf-viewer-button"]').should('not.exist')
cy.get('[data-cy="element-long-pdf-viewer-button"]').should('not.exist')
cy.resetDb()
})

View file

@ -51,8 +51,8 @@ describe('media page sets', () => {
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-short-pdf-link"]').should('not.exist')
cy.get('[data-cy="element-long-pdf-link"]').should('not.exist')
cy.get('[data-cy="element-short-pdf-viewer-button"]').should('not.exist')
cy.get('[data-cy="element-long-pdf-viewer-button"]').should('not.exist')
cy.get('[data-cy="child-element-list"]').should('be.visible')
cy.get('[data-cy="child-element-list"]')
.should(
@ -117,14 +117,34 @@ describe('media page sets', () => {
)
.should('have.css', 'text-align', 'center')
cy.get('[data-cy="element-youtube-embed"]').should('not.exist')
cy.contains('[data-cy="element-short-pdf-link"]', 'View Short PDF')
.as('shortPdfLink')
cy.contains(
'[data-cy="element-short-pdf-viewer-button"]',
'View Short PDF',
)
.as('shortPdfButton')
.should('be.visible')
cy.get('[data-cy="element-long-pdf-viewer-button"]').should('not.exist')
cy.get('@shortPdfButton').click()
cy.get('[data-cy="pdf-viewer-modal"]').should('be.visible')
cy.contains('[data-cy="pdf-viewer-title"]', 'Short PDF').should(
'be.visible',
)
cy.get('[data-cy="pdf-viewer-document"]').should('be.visible')
cy.get('[data-cy="pdf-viewer-page-status"]').should('be.visible')
cy.get('[data-cy="pdf-viewer-previous-page"]').should('be.visible')
cy.get('[data-cy="pdf-viewer-next-page"]').should('be.visible')
cy.get('[data-cy="pdf-viewer-zoom-out"]').should('be.visible')
cy.get('[data-cy="pdf-viewer-zoom-in"]').should('be.visible')
cy.get('[data-cy="pdf-viewer-search-input"]').should('be.visible')
cy.get('[data-cy="pdf-viewer-download"]').should('be.visible')
cy.get('[data-cy="pdf-viewer-print"]').should('be.visible')
cy.get('[data-cy="pdf-viewer-open-link"]')
.should('be.visible')
.and('have.attr', 'target', '_blank')
cy.get('@shortPdfLink')
.and('have.attr', 'href')
.and('include', '/storage/element-pdfs/short/baderech.pdf')
cy.get('[data-cy="element-long-pdf-link"]').should('not.exist')
cy.get('[data-cy="pdf-viewer-close"]').click()
cy.get('[data-cy="pdf-viewer-modal"]').should('not.exist')
cy.contains('[data-cy="child-element-link"]', introductionAudioTitle)
.as('introductionAudioLink')
.should('have.attr', 'href', '/element/8')
@ -134,8 +154,8 @@ describe('media page sets', () => {
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-short-pdf-link"]').should('not.exist')
cy.get('[data-cy="element-long-pdf-link"]').should('not.exist')
cy.get('[data-cy="element-short-pdf-viewer-button"]').should('not.exist')
cy.get('[data-cy="element-long-pdf-viewer-button"]').should('not.exist')
cy.get('[data-cy="child-element-list"]').should('not.exist')
cy.get('[data-cy="element-youtube-embed"]')
.should('be.visible')