How to check in cypress if element is visible on screen?

Viewed 11712

I have a web page which is very long and there is a footer on the bottom. To see the footer I have to scroll down. I want to write a cypress test to make sure that the footer is not visible when a user is on the top of the page. To do that I write such code:

        cy
        .get('#footer')
        .should('not.be.visible')

And it fails although it is in fact not on the screen, but below the visible part of the page.

1 Answers
Related