Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix flaky spec

Christophe Bliardfa6c61a0daf0
diff --git a/spec/support/components/work_packages/activities.rb b/spec/support/components/work_packages/activities.rb
index 935802a05b4..03f3e4759ff 100644
--- a/spec/support/components/work_packages/activities.rb
+++ b/spec/support/components/work_packages/activities.rb
@@ -364,21 +364,23 @@ module Components
end
def filter_journals(filter, default_sorting: User.current.preference&.comments_sorting || "desc")
- page.find_test_selector("op-wp-journals-filter-menu").click
-
- case filter
- when :all
- page.find_test_selector("op-wp-journals-filter-show-all").click
- when :only_comments
- page.find_test_selector("op-wp-journals-filter-show-only-comments").click
- when :only_changes
- page.find_test_selector("op-wp-journals-filter-show-only-changes").click
+ retry_block do
+ page.find_test_selector("op-wp-journals-filter-menu").click
+
+ case filter
+ when :all
+ page.find_test_selector("op-wp-journals-filter-show-all").click
+ when :only_comments
+ page.find_test_selector("op-wp-journals-filter-show-only-comments").click
+ when :only_changes
+ page.find_test_selector("op-wp-journals-filter-show-only-changes").click
+ end
end
# Ensure the journals are reloaded
wait_for { page }.to have_test_selector("op-wp-journals-#{filter}-#{default_sorting}")
- # the wait_for will not work on it's own as the selector will be switched to the target filter before the page is updated
- # so we still need to wait statically unfortuntately to avoid flakyness
+ # the wait_for will not work on its own as the selector will be switched to the target filter before the page is updated
+ # so we still need to wait statically unfortunately to avoid flakyness
sleep 1
end