Project

General

Profile

Actions

Patch #33315

closed

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

Added by Massimo Rossello over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

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


Files

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

Also available in: Atom PDF