Add "scroll-behavior: auto" CSS to Capybara::Server::AnimationDisabler #2399
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have some test cases where I need to call
page.execute_script('window.scrollTo(0, 0)')before taking a screenshot. I'm using Tabler, which setsscroll-behavior: smooth;, so any scroll actions are smoothly animated. This is nice in production, but annoying during tests.This proposed change will cause the scroll to always complete instantly without any animations. (This will only work when using the default
selector_forvalue of'*', so that the rule matches thehtmlelement.)scroll-behavior: autois the default value, so I don't think this change should cause any problems.I've added some tests, including an "inverse" test for
Capybara.disable_animation = false. I think this important to show thatscroll-behavior: smooth;does affect the scrolling speed, so that the test will have no false negatives.EDIT: I just remembered another change that I made in my own version:
This is also very helpful during some of my screenshot diff tests where I'm checking that form inputs are rendered and filled in correctly.
Would it be ok to add
caret-color: transparent;? I would love to start using the built-inAnimationDisablerfrom Capybara, but I really need thiscaret-color: transparent;as well. Or would it be possible to add the option to inject my own custom CSS?EDIT 2: What do you think about this
disable_animation_extra_propertieschange, so that I can setCapybara.disable_animation_extra_properties = 'caret-color: transparent;'?