test testimonial entry direction
This commit is contained in:
parent
5dd9808ef2
commit
f1751b6f82
1 changed files with 50 additions and 0 deletions
|
|
@ -285,6 +285,56 @@ describe('homepage testimonials carousel', () => {
|
|||
})
|
||||
})
|
||||
|
||||
it('brings entering side previews in from the clicked direction', () => {
|
||||
const transitionSampleDelay = 100
|
||||
const transitionSettleDelay = 1100
|
||||
|
||||
cy.viewport(1200, 800)
|
||||
cy.get('[data-cy="testimonials"]').within(() => {
|
||||
cy.get('[data-cy="testimonial-prev"]').click()
|
||||
cy.get('[data-cy="testimonial-previous-preview"]').as(
|
||||
'enteringPreviousPreview',
|
||||
)
|
||||
})
|
||||
|
||||
cy.wait(transitionSampleDelay)
|
||||
cy.get('@enteringPreviousPreview').then((previousPreviewElements) => {
|
||||
const earlyPreviousLeft =
|
||||
previousPreviewElements[0].getBoundingClientRect().left
|
||||
|
||||
cy.wait(transitionSettleDelay)
|
||||
cy.get('@enteringPreviousPreview').then((finalPreviewElements) => {
|
||||
const finalPreviousLeft =
|
||||
finalPreviewElements[0].getBoundingClientRect().left
|
||||
|
||||
expect(earlyPreviousLeft).to.be.lessThan(finalPreviousLeft)
|
||||
})
|
||||
})
|
||||
|
||||
cy.visit('/')
|
||||
cy.viewport(1200, 800)
|
||||
cy.get('[data-cy="testimonials"]').within(() => {
|
||||
cy.get('[data-cy="testimonial-next"]').click()
|
||||
cy.get('[data-cy="testimonial-next-preview"]').as(
|
||||
'enteringNextPreview',
|
||||
)
|
||||
})
|
||||
|
||||
cy.wait(transitionSampleDelay)
|
||||
cy.get('@enteringNextPreview').then((nextPreviewElements) => {
|
||||
const earlyNextLeft =
|
||||
nextPreviewElements[0].getBoundingClientRect().left
|
||||
|
||||
cy.wait(transitionSettleDelay)
|
||||
cy.get('@enteringNextPreview').then((finalPreviewElements) => {
|
||||
const finalNextLeft =
|
||||
finalPreviewElements[0].getBoundingClientRect().left
|
||||
|
||||
expect(earlyNextLeft).to.be.greaterThan(finalNextLeft)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('hides side previews on narrow screens', () => {
|
||||
cy.viewport(390, 800)
|
||||
cy.get('[data-cy="testimonials"]').within(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue