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

Adapt tests to new HTML structure of PageHeaders

Henriette Dargef5f18736d3b7
diff --git a/modules/meeting/app/components/meetings/index_page_header_component.html.erb b/modules/meeting/app/components/meetings/index_page_header_component.html.erb
index 72e7e701661..7c1db02b469 100644
--- a/modules/meeting/app/components/meetings/index_page_header_component.html.erb
+++ b/modules/meeting/app/components/meetings/index_page_header_component.html.erb
@@ -9,7 +9,8 @@
mobile_label: label_text,
aria: { label: accessibility_label_text },
title: accessibility_label_text,
- id: id) do |button|
+ id: id,
+ test_selector: "add-meeting-button") do |button|
button.with_leading_visual_icon(icon: :plus)
label_text
end
diff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
index 3f7e816bd85..a4985cf3f22 100644
--- a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
+++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
@@ -272,7 +272,7 @@ RSpec.describe "Structured meetings CRUD",
show_page.expect_agenda_item title: "My agenda item"
new_meeting = StructuredMeeting.reorder(id: :asc).last
- expect(page).to have_current_path "/meetings/#{new_meeting.id}"
+ expect(page).to have_current_path "/projects/#{project.identifier}/meetings/#{new_meeting.id}"
end
context "with a work package reference to another" do
diff --git a/modules/meeting/spec/support/pages/meetings/index.rb b/modules/meeting/spec/support/pages/meetings/index.rb
index df51b70a4ed..abf2f2c317e 100644
--- a/modules/meeting/spec/support/pages/meetings/index.rb
+++ b/modules/meeting/spec/support/pages/meetings/index.rb
@@ -39,9 +39,7 @@ module Pages::Meetings
end
def click_create_new
- within ".toolbar-items" do
- click_on "Meeting"
- end
+ click_on("add-meeting-button")
New.new(project)
end
@@ -51,15 +49,11 @@ module Pages::Meetings
end
def expect_no_create_new_button
- within ".toolbar-items" do
- expect(page).to have_no_css "#add-meeting-button"
- end
+ expect(page).not_to have_test_selector("add-meeting-button")
end
def expect_no_create_new_buttons
- within ".toolbar-items" do
- expect(page).to have_no_css "#add-meeting-button"
- end
+ expect(page).not_to have_test_selector("add-meeting-button")
within "#main-menu" do
expect(page).to have_no_button "Meeting"
@@ -67,15 +61,11 @@ module Pages::Meetings
end
def expect_create_new_button
- within ".toolbar-items" do
- expect(page).to have_css "#add-meeting-button"
- end
+ expect(page).to have_test_selector("add-meeting-button")
end
def expect_create_new_buttons
- within ".toolbar-items" do
- expect(page).to have_css "#add-meeting-button"
- end
+ expect(page).to have_test_selector("add-meeting-button")
within "#main-menu" do
expect(page).to have_button "Meeting"