Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tell Capybara to disable animations to try to increase test reliability #2814

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

jrochkind
Copy link
Contributor

@jrochkind jrochkind commented Dec 11, 2024

Some of the OHMS table of contents stuff especially, combined with search, involves a lot of opening/closing/moving things. Advancing to next search result may involve automatic switching of tabs and opening of a collaped ToC section. One particular text also involves opening up the "share link" section collapse.

The share link/copy to clipboard test in particular has been really flakey -- mostly on Github hard to reproduce locally.

Some googling suggested that perhaps any animations including scrolling animations can be especially unexpectedly slow on an ARM cpu (which perhaps Github Actions uses), or that in general setting Capybara.disable_animations could help with flakey specs where animations are involved.

Which could apply to our current flakey modal test as well.

I think Capybara.disable_animations may set browser-settings "reduce motion" settings.

A test seems to reveal it is helping with our flakey specs, re-running tests here hard to reproduce failures that were easy to reproduce before. Worth a shot.

Here is the current most fail-y test, and it's somewhat mysterious why -- screenshots reveal that the "copy to clipboard" button was underneath the fixed header, instead of properly scrolled to be visible. But unclear why and hard to reproduce locally, and putting in explicit commands to scroll window to have button at bottom didn't help. Maybe the scroll was animated and much too slow?

  1) Oral history with audio display With OHMS synchronized transcript and ToC can display, and search, without errors
     Failure/Error: page.find(copy_to_clipboard).click

     Selenium::WebDriver::Error::ElementClickInterceptedError:
       element click intercepted: Element <button class="btn btn-outline-secondary" data-trigger="linkClipboardCopy">...</button> is not clickable at point (648, 213). Other element would receive the click: <div class="ohms-search-results">...</div>
         (Session info: chrome=131.0.6778.85)

@jrochkind jrochkind marked this pull request as draft December 11, 2024 21:58
@jrochkind jrochkind force-pushed the capybara_disable_animation branch from 8caaa5d to 5ee478e Compare December 11, 2024 22:29
@jrochkind
Copy link
Contributor Author

ah, the Capybara setting actually injects some CSS to turn off lots of kinds of animation.

https://github.com/teamcapybara/capybara/blob/0480f90168a40780d1398c75031a255c1819dce8/lib/capybara/server/animation_disabler.rb#L64-L69

@jrochkind
Copy link
Contributor Author

@eddierubeiz OK, this is the one! Seems to work! Can you approve/merge this one in? Then some of my other work in other PR's I will rebase on top, and hopefully get more reliable green.

@jrochkind jrochkind marked this pull request as ready for review December 11, 2024 22:51
@eddierubeiz eddierubeiz merged commit 4206bd3 into master Dec 12, 2024
1 check passed
@eddierubeiz eddierubeiz deleted the capybara_disable_animation branch December 12, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants