test contact removal

This commit is contained in:
Yisroel Baum 2026-07-03 15:25:43 +03:00
parent 3e7b7ab84b
commit 2c8c4690ff
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
4 changed files with 11 additions and 119 deletions

View file

@ -7,8 +7,8 @@ describe('about page', () => {
cy.get('header.site-header').within(() => { cy.get('header.site-header').within(() => {
cy.contains('Torah Media').should('be.visible') cy.contains('Torah Media').should('be.visible')
cy.contains('About').should('be.visible') cy.contains('About').should('be.visible')
cy.contains('Contact').should('be.visible')
cy.contains('Donate').should('be.visible') cy.contains('Donate').should('be.visible')
cy.contains('a', 'Contact').should('not.exist')
}) })
cy.get('[data-cy="about-hero"]').within(() => { cy.get('[data-cy="about-hero"]').within(() => {
@ -119,7 +119,7 @@ describe('about page', () => {
cy.contains('Torah Media').should('be.visible') cy.contains('Torah Media').should('be.visible')
cy.contains('About').should('be.visible') cy.contains('About').should('be.visible')
cy.contains('Donate').should('be.visible') cy.contains('Donate').should('be.visible')
cy.contains('Contact').should('be.visible') cy.contains('a', 'Contact').should('not.exist')
cy.contains(/Rabbi Gerzi 2025/).should('be.visible') cy.contains(/Rabbi Gerzi 2025/).should('be.visible')
}) })
}) })

View file

@ -1,119 +1,11 @@
describe('contact page', () => { describe('removed contact page', () => {
beforeEach(() => { it('redirects direct contact visits to the homepage', () => {
cy.visit('/contact') cy.visit('/contact')
})
it('renders the header and contact intro', () => { cy.location('pathname').should('eq', '/')
cy.get('[data-cy="contact-hero"]').should('not.exist')
cy.get('header.site-header').within(() => { cy.get('header.site-header').within(() => {
cy.contains('Torah Media').should('be.visible') cy.contains('a', 'Contact').should('not.exist')
cy.contains('About').should('be.visible')
cy.contains('Contact').should('be.visible')
cy.contains('Donate').should('be.visible')
})
cy.get('[data-cy="contact-hero"]').within(() => {
cy.contains('h1', 'Contact').should('be.visible')
cy.contains('Rabbi Gerzi receives numerous messages each week')
.should('be.visible')
cy.contains('get back to you').should('be.visible')
})
})
it('renders the copied message form fields', () => {
cy.get('[data-cy="contact-form"]').within(() => {
cy.contains('h2', 'Send Rabbi Gerzi a Message').should('be.visible')
cy.get('input[name="firstName"]').should('be.visible')
cy.get('input[name="lastName"]').should('be.visible')
cy.get('input[name="city"]').should('be.visible')
cy.get('input[name="country"]').should('be.visible')
cy.get('input[name="email"]')
.should('be.visible')
.and('have.attr', 'type', 'email')
cy.get('textarea[name="message"]').should('be.visible')
cy.contains('button', 'Submit').should('be.visible')
})
})
it('clears the static contact form when submitted', () => {
cy.get('[data-cy="contact-form"]').within(() => {
cy.get('input[name="firstName"]').type('Yehuda')
cy.get('input[name="lastName"]').type('Cohen')
cy.get('input[name="city"]').type('Ramat Beit Shemesh')
cy.get('input[name="country"]').type('Israel')
cy.get('input[name="email"]').type('yehuda@example.com')
cy.get('textarea[name="message"]').type('Please send details.')
cy.contains('button', 'Submit').click()
cy.get('input[name="firstName"]').should('have.value', '')
cy.get('input[name="lastName"]').should('have.value', '')
cy.get('input[name="city"]').should('have.value', '')
cy.get('input[name="country"]').should('have.value', '')
cy.get('input[name="email"]').should('have.value', '')
cy.get('textarea[name="message"]').should('have.value', '')
})
})
it('renders social media links', () => {
cy.get('[data-cy="contact-social"]').within(() => {
cy.contains('h2', 'Follow Rabbi Gerzi on Social Media')
.should('be.visible')
cy.contains('a', 'YouTube')
.should('be.visible')
.and('have.attr', 'href', 'https://www.youtube.com/@rabbigerzi')
.and('have.attr', 'target', '_blank')
cy.contains('a', 'Spotify')
.should('be.visible')
.and(
'have.attr',
'href',
'https://open.spotify.com/show/49H1X9A7KZWAnnIbcoQXQR?si=6253691f23be44ad',
)
.and('have.attr', 'target', '_blank')
})
})
it('keeps the page readable on mobile', () => {
cy.viewport(390, 900)
cy.get('[data-cy="contact-hero"]').should('be.visible')
cy.get('[data-cy="contact-form"]').should('be.visible')
cy.get('[data-cy="contact-social"]').should('be.visible')
})
it('centers the subscribe card vertically in its section', () => {
cy.get('[data-cy="get-involved"]').then((sectionElements) => {
const sectionElement = sectionElements[0]
const cardElement = sectionElement.querySelector('.get-involved__card')
if (cardElement === null) {
throw new Error('Get involved card is missing')
}
const sectionBounds = sectionElement.getBoundingClientRect()
const cardBounds = cardElement.getBoundingClientRect()
const topBuffer = cardBounds.top - sectionBounds.top
const bottomBuffer = sectionBounds.bottom - cardBounds.bottom
expect(topBuffer).to.be.closeTo(bottomBuffer, 1)
})
})
it('renders the get involved form and footer', () => {
cy.get('[data-cy="get-involved"]').within(() => {
cy.contains('h2', 'Get Involved').should('be.visible')
cy.contains('Subscribe for updates as we release new content')
.should('be.visible')
cy.get('input[name="fullName"]').should('be.visible')
cy.get('input[name="newsletterEmail"]').should('be.visible')
cy.contains('button', 'Submit').should('be.visible')
})
cy.get('[data-cy="footer"]').within(() => {
cy.contains('Torah Media').should('be.visible')
cy.contains('About').should('be.visible')
cy.contains('Donate').should('be.visible')
cy.contains('Contact').should('be.visible')
cy.contains(/Rabbi Gerzi 2025/).should('be.visible')
}) })
}) })
}) })

View file

@ -7,8 +7,8 @@ describe('homepage hero', () => {
cy.get('header.site-header').within(() => { cy.get('header.site-header').within(() => {
cy.contains('Torah Media').should('be.visible') cy.contains('Torah Media').should('be.visible')
cy.contains('About').should('be.visible') cy.contains('About').should('be.visible')
cy.contains('Contact').should('be.visible')
cy.contains('Donate').should('be.visible') cy.contains('Donate').should('be.visible')
cy.contains('a', 'Contact').should('not.exist')
}) })
}) })
@ -29,8 +29,8 @@ describe('homepage hero', () => {
cy.get('header.site-header').within(() => { cy.get('header.site-header').within(() => {
cy.contains('Torah Media').should('be.visible') cy.contains('Torah Media').should('be.visible')
cy.contains('About').should('be.visible') cy.contains('About').should('be.visible')
cy.contains('Contact').should('be.visible')
cy.contains('Donate').should('be.visible') cy.contains('Donate').should('be.visible')
cy.contains('a', 'Contact').should('not.exist')
}) })
cy.contains('h1', 'Torah Media').should('be.visible') cy.contains('h1', 'Torah Media').should('be.visible')
}) })
@ -572,7 +572,7 @@ describe('homepage get involved and footer', () => {
cy.contains('Torah Media').should('be.visible') cy.contains('Torah Media').should('be.visible')
cy.contains('About').should('be.visible') cy.contains('About').should('be.visible')
cy.contains('Donate').should('be.visible') cy.contains('Donate').should('be.visible')
cy.contains('Contact').should('be.visible') cy.contains('a', 'Contact').should('not.exist')
cy.contains(/Rabbi Gerzi 2025/).should('be.visible') cy.contains(/Rabbi Gerzi 2025/).should('be.visible')
}) })
}) })

View file

@ -19,8 +19,8 @@ describe('media page sets', () => {
cy.get('header.site-header').within(() => { cy.get('header.site-header').within(() => {
cy.contains('Torah Media').should('be.visible') cy.contains('Torah Media').should('be.visible')
cy.contains('About').should('be.visible') cy.contains('About').should('be.visible')
cy.contains('Contact').should('be.visible')
cy.contains('Donate').should('be.visible') cy.contains('Donate').should('be.visible')
cy.contains('a', 'Contact').should('not.exist')
}) })
cy.contains('h1', 'Torah Media').should('be.visible') cy.contains('h1', 'Torah Media').should('be.visible')
cy.get('[data-cy="media-set-grid"]').should('be.visible') cy.get('[data-cy="media-set-grid"]').should('be.visible')