Patch #33315

IssuesSystemTest#test_bulk_watch_issues_via_context_menu randomly fails due to Capybara clicks out out of context menu

Added by Massimo Rossello 6 months ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Code cleanup/refactoring
Target version:4.2.0

Description

Sometimes, the IssuesSystemTest#test_bulk_watch_issues_via_context_menu test fails for click_link loosing the focus on the context menu entry.
According to my googling, this seems to be a known sporadic Capybara issue. Solution seems to use find().hover.click instead of click_link. The hover seems to help ensure that click is not applied out of element boundaries whatever the javascript asynchronous execution.
Refer to this comment: http://aokolish.me/blog/2012/01/22/testing-hover-events-with-capybara/#comment-2118167329

Adding sleeps either before or after click_link has no effect instead.

How to reproduce:
the following fails sporadically

RAILS_ENV=test bundle exec rails test:system TESTOPTS="-n '/^(?:IssuesSystemTest#(?:test_bulk_watch_issues_via_context_menu))$/'"

Attached my proposed path. Thanks

capybara_click.diff Magnifier (990 Bytes) Massimo Rossello, 2020-04-19 16:17

Associated revisions

Revision 20017
Added by Go MAEDA about 1 month ago

IssuesSystemTest#test_bulk_watch_issues_via_context_menu randomly fails due to Capybara clicks out of an element (#33315).

Patch by Massimo Rossello.

History

#1 Updated by Go MAEDA 6 months ago

  • Target version set to Candidate for next major release

#2 Updated by Go MAEDA 6 months ago

  • Category set to Code cleanup/refactoring
  • Target version changed from Candidate for next major release to 4.2.0

Setting the target version to 4.2.0.

#3 Updated by Go MAEDA about 1 month ago

  • Subject changed from System tests: Capybara sometimes clicks out of context menu to IssuesSystemTest#test_bulk_watch_issues_via_context_menu randomly fails due to Capybara clicks out out of context menu
  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the fix. Thank you.

Also available in: Atom PDF