[Regression] Element actionability fails because it is scrolled behind another element.
See original GitHub issueCurrent behavior
After upgrading to Cypress 6.8.0, we are experiencing test failures as a result of elements not being able to be clicked due to being covered by another element. It seems likely that this is a regression related to changes made for #3200 .
Desired behavior
Tests pass exactly as they did in our prior Cypress version, 6.6.0.
Test code to reproduce
context('Cypress Issue', function () {
beforeEach(function () {
// These are not real credentials.
// Please sign up (for free) at www.vidyard.com, verify your email address, then update these accordingly.
const email = 'fake@email.com'
const password = 'yourPassword'
cy.visit('https://secure.vidyard.com/user/sign_in')
cy.get('#username').type(email)
cy.get('#password').type(password)
cy.get('#sign-in').click()
cy.wait(5000) // Just to make sure the page is fully loaded.
})
it('Click Issue caused by Visibility', function () {
cy.get('[data-testid=folder-navigation]')
.click();
});
});
Fails in Cypress version 6.8.0.
Passes in Cypress version 6.6.0.
Additional Notes
It looks like adding the workaround proposed to avoid issue #3200 actually works around this problem too, but (at least in the case of my application) this is a worse experience because we have to use the workaround everywhere and not just in certain places as had previously been the case. 😞
cy.document().then((document) => {
const node = document.createElement('style');
node.innerHTML = 'html { scroll-behavior: auto !important; }';
document.body.appendChild(node);
});
Versions
Cypress version 6.8.0 on macOS in Chrome 89 and Firefox 86.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:15 (2 by maintainers)
Top Results From Across the Web
element is being covered by another element cypress - You.com
Every time when the command starts executing, page scroll down so the required element is not visible and it's hidden under the menu...
Read more >allow scroll of div set behind another div - Stack Overflow
First at all I would position the image of the ipad at the background with position:fixed and negative z-index . Now we have...
Read more >Changelog - Cypress Documentation
Interacting with an element that requires scrolling within an element with scroll-behavior: smooth no longer fails Cypress's actionability check.
Read more >overscroll-behavior - CSS: Cascading Style Sheets | MDN
Default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll ......
Read more >What is A/B Testing? A Practical Guide With Examples | VWO
With A/B testing, this problem can be solved once and for all. ... Another element of your website that you can optimize by...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@todd-m-kemp Thank you for adding that work around! That seems to have fixed things for me temporarily, and it was such a weird thing to see.
@jennifer-shehane suggested in an earlier comment that I look into the
scrollBehavior
option onclick
but initially I wasn’t terribly interested since I didn’t want to have to explicitly provide this option on all calls toclick
because this was a very broad problem causing failures in nearly every test of ours. However, yesterday I stumbled across thescrollBehavior
option incypress.json
where you can set it globally. I did so, and this problem doesn’t seem to occur in our test runs when usingcenter
as thescrollBehavior
setting. Those of you experiencing this problem may also want to give that a try.