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 through longer waiting expectation approach

Jonas Jabari9662d7174987
diff --git a/spec/features/activities/work_package/activities_spec.rb b/spec/features/activities/work_package/activities_spec.rb
index 5428863f8fd..8c3527b0e68 100644
--- a/spec/features/activities/work_package/activities_spec.rb
+++ b/spec/features/activities/work_package/activities_spec.rb
@@ -372,7 +372,7 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
version: 2)
# the comment is shown without browser reload
- wait_for { page }.to have_test_selector("op-journal-notes-body", text: "First comment by member")
+ activity_tab.expect_journal_notes(text: "First comment by member")
# simulate comments made within the polling interval
create(:work_package_journal, user: member, notes: "Second comment by member", journable: work_package, version: 3)
@@ -390,7 +390,7 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
first_journal.update!(notes: "First comment by member updated")
# properly updates the comment when the comment is updated
- wait(delay: 0.5).for { page }.to have_test_selector("op-journal-notes-body", text: "First comment by member updated")
+ activity_tab.expect_journal_notes(text: "First comment by member updated")
end
end
diff --git a/spec/support/components/work_packages/activities.rb b/spec/support/components/work_packages/activities.rb
index 822808fea40..8927d4a69e9 100644
--- a/spec/support/components/work_packages/activities.rb
+++ b/spec/support/components/work_packages/activities.rb
@@ -98,7 +98,7 @@ module Components
end
def expect_journal_notes(text: nil)
- expect(page).to have_test_selector("op-journal-notes-body", text:)
+ expect(page).to have_test_selector("op-journal-notes-body", text:, wait: 10)
end
def expect_notification_bubble