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

fixed flaky specs and styling fixes

Jonas Jabari8329d1ba5166
diff --git a/app/components/work_packages/activities_tab/journals/item_component.html.erb b/app/components/work_packages/activities_tab/journals/item_component.html.erb
index 28122035f35..75ea47a133c 100644
--- a/app/components/work_packages/activities_tab/journals/item_component.html.erb
+++ b/app/components/work_packages/activities_tab/journals/item_component.html.erb
@@ -31,7 +31,7 @@
header_container.with_column(flex_layout: true, align_items: :center) do |header_end_container|
if has_unread_notifications?
header_end_container.with_column(mr: 2, pt: 1) do
- render(Primer::Beta::Octicon.new(:"dot-fill", color: :accent, size: :medium))
+ render(Primer::Beta::Octicon.new(:"dot-fill", color: :accent, size: :medium, data: { test_selector: "op-journal-unread-notification" }))
end
end
header_end_container.with_column do
diff --git a/app/components/work_packages/activities_tab/journals/item_component/details.rb b/app/components/work_packages/activities_tab/journals/item_component/details.rb
index dc81e4f0e77..9b4f84a61fd 100644
--- a/app/components/work_packages/activities_tab/journals/item_component/details.rb
+++ b/app/components/work_packages/activities_tab/journals/item_component/details.rb
@@ -133,7 +133,10 @@ module WorkPackages
def render_notification_bubble(container)
container.with_column(mr: 2) do
- render(Primer::Beta::Octicon.new(:"dot-fill", color: :accent, size: :medium))
+ render(Primer::Beta::Octicon.new(
+ :"dot-fill", color: :accent, size: :medium,
+ data: { test_selector: "op-journal-unread-notification" }
+ ))
end
end
@@ -161,7 +164,7 @@ module WorkPackages
details_container.with_row(flex_layout: true, pt: 1, pb: 3) do |details_container_inner|
if journal.initial?
- render_empty_line(details_container_inner) if filter == :only_changes
+ details_container.with_row(mb: 3, font_size: :small, classes: "empty-line")
else
render_journal_details(details_container_inner)
end
diff --git a/spec/features/activities/work_package/activities_spec.rb b/spec/features/activities/work_package/activities_spec.rb
index 54531de1b7f..1e822b5be9d 100644
--- a/spec/features/activities/work_package/activities_spec.rb
+++ b/spec/features/activities/work_package/activities_spec.rb
@@ -150,7 +150,7 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
wp_page.wait_for_activity_tab
end
- it "does show comments and enable adding and quoting comments and editing own comments" do
+ it "does show comments but does NOT enable editing other users comments" do
activity_tab.expect_journal_notes(text: "First comment by admin")
activity_tab.within_journal_entry(first_comment) do
@@ -161,7 +161,9 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
# allowed to quote other user's comments
expect(page).to have_test_selector("op-wp-journal-#{first_comment.id}-quote")
end
+ end
+ it "enable adding and quoting comments and editing OWN comments" do
activity_tab.expect_input_field
activity_tab.add_comment(text: "First comment by viewer with commenting permission")
@@ -169,9 +171,7 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
second_comment = work_package.journals.reload.last
activity_tab.within_journal_entry(second_comment) do
- # for some reason only opens on the second click in the test
- # probably due to the previous click on the first comment
- 2.times { page.find_test_selector("op-wp-journal-#{second_comment.id}-action-menu").click }
+ page.find_test_selector("op-wp-journal-#{second_comment.id}-action-menu").click
expect(page).to have_test_selector("op-wp-journal-#{second_comment.id}-edit")
expect(page).to have_test_selector("op-wp-journal-#{second_comment.id}-quote")
@@ -189,7 +189,7 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
wp_page.wait_for_activity_tab
end
- it "does show comments and enable adding and quoting comments and editing own comments" do
+ it "does show comments and enable adding and quoting comments and editing of other users comments" do
activity_tab.expect_journal_notes(text: "First comment by admin")
activity_tab.within_journal_entry(first_comment) do
@@ -200,21 +200,6 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri
# allowed to quote other user's comments
expect(page).to have_test_selector("op-wp-journal-#{first_comment.id}-quote")
end
-
- activity_tab.expect_input_field
-
- activity_tab.add_comment(text: "First comment by viewer with editing permission")
-
- second_comment = work_package.journals.reload.last
-
- activity_tab.within_journal_entry(second_comment) do
- # for some reason only opens on the second click in the test
- # probably due to the previous click on the first comment
- 2.times { page.find_test_selector("op-wp-journal-#{second_comment.id}-action-menu").click }
-
- expect(page).to have_test_selector("op-wp-journal-#{second_comment.id}-edit")
- expect(page).to have_test_selector("op-wp-journal-#{second_comment.id}-quote")
- end
end
end
end
diff --git a/spec/support/components/work_packages/activities.rb b/spec/support/components/work_packages/activities.rb
index e093c3290f3..1dd2f9ea317 100644
--- a/spec/support/components/work_packages/activities.rb
+++ b/spec/support/components/work_packages/activities.rb
@@ -100,11 +100,11 @@ module Components
end
def expect_notification_bubble
- expect(page).to have_test_selector("user-activity-bubble")
+ expect(page).to have_test_selector("op-journal-unread-notification")
end
def expect_no_notification_bubble
- expect(page).not_to have_test_selector("user-activity-bubble")
+ expect(page).not_to have_test_selector("op-journal-unread-notification")
end
def expect_journal_container_at_bottom