From a528ecbfac9f58359f6b8779eb44c94ba7ea7ab0 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Wed, 25 Sep 2024 18:37:28 +0200 Subject: [PATCH] fix failing tests in news, activity and cost report --- app/views/activities/index.html.erb | 2 +- app/views/news/index.html.erb | 1 + modules/reporting/spec/features/me_value_spec.rb | 2 +- spec/features/news/creation_and_commenting_spec.rb | 4 +--- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index 4c5374aa0b11..bf1aaa605263 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details. <%= render Primer::OpenProject::PageHeader.new do |header| - header.with_title { (@author.nil? ? t(:label_activity) : t(:label_user_activity, value: link_to_user(@author))) } + header.with_title { (@author.nil? ? t(:label_activity) : t(:label_user_activity, value: link_to_user(@author))).html_safe } header.with_breadcrumbs([{ href: home_path, text: organization_name}, *([href: project_overview_path(@project.id), text: @project.name] if @project), t(:label_activity)]) diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index 61998694372d..59cd801d4d7b 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -46,6 +46,7 @@ See COPYRIGHT and LICENSE files for more details. title: I18n.t(:label_work_package_status_new), tag: :a, id: 'new_news_link', + data: { "test-selector": "add-news-button"}, href: new_project_news_path(@project)) do |button| button.with_leading_visual_icon(icon: :plus) t(:label_news_singular) diff --git a/modules/reporting/spec/features/me_value_spec.rb b/modules/reporting/spec/features/me_value_spec.rb index 0fa670edfd1c..91a6f774cef7 100644 --- a/modules/reporting/spec/features/me_value_spec.rb +++ b/modules/reporting/spec/features/me_value_spec.rb @@ -39,7 +39,7 @@ check "query_is_public" find_by_id("query-icon-save-button").click # wait until the save is complete - expect(page).to have_css("h2", text: "Query ME value") + expect(page).to have_css(".PageHeader-title", text: "Query ME value") expect(page).to have_css(".report", text: "10.00") diff --git a/spec/features/news/creation_and_commenting_spec.rb b/spec/features/news/creation_and_commenting_spec.rb index f8bce735d957..d97564a37e80 100644 --- a/spec/features/news/creation_and_commenting_spec.rb +++ b/spec/features/news/creation_and_commenting_spec.rb @@ -46,9 +46,7 @@ it "allows creating new and commenting it all of which will result in notifications and mails" do visit project_news_index_path(project) - within ".toolbar-items" do - click_link "News" - end + find('[data-test-selector="add-news-button"]', text: "News").click # Create the news fill_in "Title", with: "My new news"