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

[#65074] specs for project attribute in section creation

Tobias Dillmann344df0bf3583
diff --git a/app/components/settings/project_custom_field_sections/show_component.html.erb b/app/components/settings/project_custom_field_sections/show_component.html.erb
index 1128d8b2698..ed7754e9647 100644
--- a/app/components/settings/project_custom_field_sections/show_component.html.erb
+++ b/app/components/settings/project_custom_field_sections/show_component.html.erb
@@ -46,7 +46,7 @@
render(Primer::Beta::Text.new(color: :subtle)) { t("settings.project_attributes.label_no_project_custom_fields") }
end
empty_list_container.with_column do
- render(Primer::Alpha::ActionMenu.new(data: { test_selector: "new-project-custom-field-button" })) do |menu|
+ render(Primer::Alpha::ActionMenu.new(data: { test_selector: "new-project-custom-field-in-section-button" })) do |menu|
menu.with_show_button(
scheme: :secondary,
"aria-label": t("settings.project_attributes.label_new_attribute")
diff --git a/app/components/settings/project_custom_field_sections/show_component.rb b/app/components/settings/project_custom_field_sections/show_component.rb
index f41488640c4..6090ae91c5f 100644
--- a/app/components/settings/project_custom_field_sections/show_component.rb
+++ b/app/components/settings/project_custom_field_sections/show_component.rb
@@ -147,7 +147,7 @@ module Settings
custom_field_section_id: @project_custom_field_section.id
),
content_arguments: { data: { turbo: "false",
- test_selector: "new-project-custom-field-button" } }
+ test_selector: "new-project-custom-field-in-section-button-#{format.name}" } }
)
end
end
diff --git a/spec/features/admin/custom_fields/projects/index_spec.rb b/spec/features/admin/custom_fields/projects/index_spec.rb
index e472296ce48..51d0bc31cb1 100644
--- a/spec/features/admin/custom_fields/projects/index_spec.rb
+++ b/spec/features/admin/custom_fields/projects/index_spec.rb
@@ -243,7 +243,7 @@ RSpec.describe "List project custom fields", :js do
it "redirects to the custom field new page via button in empty sections" do
within_project_custom_field_section_container(section_for_multi_select_fields) do
- expect(page).not_to have_test_selector("new-project-custom-field-button")
+ expect(page).not_to have_test_selector("new-project-custom-field-in-section-button")
end
multi_list_project_custom_field.destroy
@@ -253,11 +253,12 @@ RSpec.describe "List project custom fields", :js do
cf_index_page.visit!
within_project_custom_field_section_container(section_for_multi_select_fields) do
- page.find_test_selector("new-project-custom-field-button").click
+ page.find_test_selector("new-project-custom-field-in-section-button").click
+ page.find_test_selector("new-project-custom-field-in-section-button-int").click
end
expect(page).to have_current_path(new_admin_settings_project_custom_field_path(
- type: "ProjectCustomField",
+ field_format: "int",
custom_field_section_id: section_for_multi_select_fields.id
))
end