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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
move and adapt custom field feature specs
ulfertsf8fad16c77db
diff --git a/app/views/custom_fields/_tab.html.erb b/app/views/custom_fields/_tab.html.erbindex 7642ad84710..c1fe98606be 100644--- a/app/views/custom_fields/_tab.html.erb+++ b/app/views/custom_fields/_tab.html.erb@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><% if @tab == "WorkPackageCustomField" %>- <%= render(EnterpriseEdition::BannerComponent.new(:custom_field_hierarchies, mt: 2)) %>+ <%= render(EnterpriseEdition::BannerComponent.new(:custom_field_hierarchies)) %><% end %><% if @custom_fields_by_type[tab[:name]].blank? %>diff --git a/spec/features/admin/custom_fields/groups/boolean_spec.rb b/spec/features/admin/custom_fields/groups/boolean_spec.rbnew file mode 100644index 00000000000..e4aac4dc5ca--- /dev/null+++ b/spec/features/admin/custom_fields/groups/boolean_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "groups boolean custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Groups", "Boolean"+enddiff --git a/spec/features/admin/custom_fields/groups/date_spec.rb b/spec/features/admin/custom_fields/groups/date_spec.rbnew file mode 100644index 00000000000..7e9b440dfe7--- /dev/null+++ b/spec/features/admin/custom_fields/groups/date_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "group date custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Groups", "Date"+enddiff --git a/spec/features/admin/custom_fields/groups/float_spec.rb b/spec/features/admin/custom_fields/groups/float_spec.rbnew file mode 100644index 00000000000..81d48873a30--- /dev/null+++ b/spec/features/admin/custom_fields/groups/float_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "group float custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Groups", "Float"+enddiff --git a/spec/features/admin/custom_fields/groups/int_spec.rb b/spec/features/admin/custom_fields/groups/int_spec.rbnew file mode 100644index 00000000000..a5a2f14a496--- /dev/null+++ b/spec/features/admin/custom_fields/groups/int_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "group int custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Groups", "Integer"+enddiff --git a/spec/features/custom_fields/custom_fields_page.rb b/spec/features/admin/custom_fields/groups/list_spec.rbsimilarity index 75%rename from spec/features/custom_fields/custom_fields_page.rbrename to spec/features/admin/custom_fields/groups/list_spec.rbindex 407d024ec37..8c555be2113 100644--- a/spec/features/custom_fields/custom_fields_page.rb+++ b/spec/features/admin/custom_fields/groups/list_spec.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-#-- copyright+# -- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH#@@ -26,22 +26,13 @@# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.## See COPYRIGHT and LICENSE files for more details.-#+++# ++-class CustomFieldsPage- include Rails.application.routes.url_helpers- include Capybara::DSL- include Capybara::RSpecMatchers+require "spec_helper"+require_relative "../shared_custom_field_expectations"- def visit_new(type = "WorkPackageCustomField")- visit new_custom_field_path type:- end+RSpec.describe "groups list custom fields", :js do+ it_behaves_like "list custom fields", "Groups"- def name_attribute- find_by_id "custom_field_name"- end-- def default_value_attributes- find "#custom_field_default_value_attributes span[lang]"- end+ it_behaves_like "expected fields for the custom field's format", "Groups", "List"enddiff --git a/spec/features/admin/custom_fields/groups/long_text_spec.rb b/spec/features/admin/custom_fields/groups/long_text_spec.rbnew file mode 100644index 00000000000..9fcf51c02ba--- /dev/null+++ b/spec/features/admin/custom_fields/groups/long_text_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "groups long text custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Groups", "Long text"+enddiff --git a/spec/features/admin/custom_fields/groups/text_spec.rb b/spec/features/admin/custom_fields/groups/text_spec.rbnew file mode 100644index 00000000000..cef684ed835--- /dev/null+++ b/spec/features/admin/custom_fields/groups/text_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "groups text custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Groups", "Text"+enddiff --git a/spec/features/admin/project_custom_fields/create_spec.rb b/spec/features/admin/custom_fields/projects/create_in_section_spec.rbsimilarity index 88%rename from spec/features/admin/project_custom_fields/create_spec.rbrename to spec/features/admin/custom_fields/projects/create_in_section_spec.rbindex 1b661740cf1..1d145c30bb7 100644--- a/spec/features/admin/project_custom_fields/create_spec.rb+++ b/spec/features/admin/custom_fields/projects/create_in_section_spec.rb@@ -31,13 +31,15 @@require "spec_helper"require_relative "shared_context"-RSpec.describe "Create project custom fields", :js do+RSpec.describe "Create project custom fields in sections", :js doinclude_context "with seeded project custom fields"+ let(:cf_index_page) { Pages::Admin::CustomFields::CustomFieldsProjects::Index.new }+context "with insufficient permissions" doit "is not accessible" dologin_as(non_admin)- visit new_admin_settings_project_custom_field_path+ cf_index_page.visit!expect(page).to have_text("You are not authorized to access this page.")end@@ -46,7 +48,9 @@ RSpec.describe "Create project custom fields", :js docontext "with sufficient permissions" dobefore dologin_as(admin)- visit new_admin_settings_project_custom_field_path+ cf_index_page.visit!++ cf_index_page.click_to_create_new_custom_field("Integer")endit "shows a correct breadcrumb menu" do@@ -82,7 +86,8 @@ RSpec.describe "Create project custom fields", :js doendit "allows to create a new project custom field with a prefilled section via url param" do- visit new_admin_settings_project_custom_field_path(custom_field_section_id: section_for_multi_select_fields.id)+ visit new_admin_settings_project_custom_field_path(field_format: "int",+ custom_field_section_id: section_for_multi_select_fields.id)fill_in("custom_field_name", with: "New custom field")@@ -101,17 +106,19 @@ RSpec.describe "Create project custom fields", :js doit "prevents creating a new project custom field with an empty name" doclick_on("Save")- expect(page).to have_field "custom_field_name", validation_message: "Please fill out this field."+ expect(page).to have_field "custom_field_name", validation_message: /Please fill (in|out) this field./# expect no redirectexpect(page).to have_no_current_path(admin_settings_project_custom_fields_path(tab: "ProjectCustomField"))- expect(page).to have_current_path(new_admin_settings_project_custom_field_path)+ expect(page).to have_current_path(new_admin_settings_project_custom_field_path(field_format: "int"))endcontext "without any existing sections" dobefore doProjectCustomFieldSection.destroy_all- visit new_admin_settings_project_custom_field_path+ cf_index_page.visit!++ cf_index_page.click_to_create_new_custom_field("Integer")endit "prevents creating a new project custom field with an empty name" dodiff --git a/spec/features/admin/project_custom_fields/edit_spec.rb b/spec/features/admin/custom_fields/projects/edit_spec.rbsimilarity index 100%rename from spec/features/admin/project_custom_fields/edit_spec.rbrename to spec/features/admin/custom_fields/projects/edit_spec.rbdiff --git a/spec/features/admin/project_custom_fields/list_spec.rb b/spec/features/admin/custom_fields/projects/index_spec.rbsimilarity index 93%rename from spec/features/admin/project_custom_fields/list_spec.rbrename to spec/features/admin/custom_fields/projects/index_spec.rbindex 53a4f6cd139..556cba513f3 100644--- a/spec/features/admin/project_custom_fields/list_spec.rb+++ b/spec/features/admin/custom_fields/projects/index_spec.rb@@ -34,10 +34,12 @@ require_relative "shared_context"RSpec.describe "List project custom fields", :js doinclude_context "with seeded project custom fields"+ let(:cf_index_page) { Pages::Admin::CustomFields::CustomFieldsProjects::Index.new }+context "with unsufficient permissions" doit "is not accessible" dologin_as(non_admin)- visit admin_settings_project_custom_fields_path+ cf_index_page.visit!expect(page).to have_text("You are not authorized to access this page.")end@@ -46,7 +48,7 @@ RSpec.describe "List project custom fields", :js docontext "with sufficient permissions" dobefore dologin_as(admin)- visit admin_settings_project_custom_fields_path+ cf_index_page.visit!endit "shows all sections in the correct order and allows reordering via menu or drag and drop" do@@ -58,7 +60,7 @@ RSpec.describe "List project custom fields", :js doperform_action_for_project_custom_field_section(section_for_multi_select_fields, "Move up")- visit admin_settings_project_custom_fields_path+ cf_index_page.visit!containers = page.all(".op-project-custom-field-section-container")@@ -78,7 +80,7 @@ RSpec.describe "List project custom fields", :js domulti_user_project_custom_field.destroymulti_version_project_custom_field.destroy- visit admin_settings_project_custom_fields_path+ cf_index_page.visit!within_project_custom_field_section_menu(section_for_multi_select_fields) doexpect(page).to have_no_css("button[aria-disabled='true']", text: "Delete")@@ -178,7 +180,7 @@ RSpec.describe "List project custom fields", :js doproject = create(:project)project.project_custom_fields << boolean_project_custom_field- visit admin_settings_project_custom_fields_path+ cf_index_page.visit!within_project_custom_field_container(boolean_project_custom_field) doexpect(page).to have_text("1 project")@@ -211,13 +213,6 @@ RSpec.describe "List project custom fields", :js doexpect(page).to have_current_path(edit_admin_settings_project_custom_field_path(boolean_project_custom_field))end- it "redirects to the custom field new page via header menu button" do- page.find_test_selector("project-attributes-add-menu-button").click- page.find_test_selector("new-project-custom-field-button").click-- expect(page).to have_current_path(new_admin_settings_project_custom_field_path(type: "ProjectCustomField"))- end-it "redirects to the custom field new page via button in empty sections" dowithin_project_custom_field_section_container(section_for_multi_select_fields) doexpect(page).not_to have_test_selector("new-project-custom-field-button")@@ -227,7 +222,7 @@ RSpec.describe "List project custom fields", :js domulti_user_project_custom_field.destroymulti_version_project_custom_field.destroy- visit admin_settings_project_custom_fields_path+ cf_index_page.visit!within_project_custom_field_section_container(section_for_multi_select_fields) dopage.find_test_selector("new-project-custom-field-button").clickdiff --git a/spec/features/admin/project_custom_fields/project_mappings_spec.rb b/spec/features/admin/custom_fields/projects/project_mappings_spec.rbsimilarity index 97%rename from spec/features/admin/project_custom_fields/project_mappings_spec.rbrename to spec/features/admin/custom_fields/projects/project_mappings_spec.rbindex d4926e56ec3..427b4704853 100644--- a/spec/features/admin/project_custom_fields/project_mappings_spec.rb+++ b/spec/features/admin/custom_fields/projects/project_mappings_spec.rb@@ -42,7 +42,7 @@ RSpec.describe "Project Custom Field Mappings", :js docreate(:project_custom_field_project_mapping, project_custom_field:, project: archived_project)end- let(:project_custom_field_mappings_page) { Pages::Admin::Settings::ProjectCustomFields::ProjectCustomFieldMappingsIndex.new }+ let(:project_custom_field_mappings_page) { Pages::Admin::CustomFields::CustomFieldsProjects::ProjectMappings.new }context "with insufficient permissions" doit "is not accessible" dodiff --git a/spec/features/admin/project_custom_fields/shared_context.rb b/spec/features/admin/custom_fields/projects/shared_context.rbsimilarity index 100%rename from spec/features/admin/project_custom_fields/shared_context.rbrename to spec/features/admin/custom_fields/projects/shared_context.rbdiff --git a/spec/features/admin/custom_fields/shared_custom_field_expectations.rb b/spec/features/admin/custom_fields/shared_custom_field_expectations.rbnew file mode 100644index 00000000000..fb81fa3f198--- /dev/null+++ b/spec/features/admin/custom_fields/shared_custom_field_expectations.rb@@ -0,0 +1,310 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++RSpec.shared_examples_for "list custom fields" do |type|+ let(:cf_page) { Pages::CustomFields::IndexPage.new }+ let(:user) { create(:admin) }++ current_user { user }++ before do+ cf_page.visit_tab type+ end++ it "has the options in the right order" do+ retry_block do+ cf_page.click_to_create_new_custom_field "List"+ end++ cf_page.set_name "Operating System"++ expect(page).to have_text("Allow multi-select")+ check("custom_field_multi_value")++ expect(page).to have_css(".custom-option-row", count: 1)+ within all(".custom-option-row").last do+ find(".custom-option-value input").set "Windows"+ find(".custom-option-default-value input").set true+ end++ retry_block do+ page.find_test_selector("add-custom-option").click++ expect(page).to have_css(".custom-option-row", count: 2)+ end++ within all(".custom-option-row").last do+ find(".custom-option-value input").set "Linux"+ end++ retry_block do+ page.find_test_selector("add-custom-option").click++ expect(page).to have_css(".custom-option-row", count: 3)+ end++ within all(".custom-option-row").last do+ find(".custom-option-value input").set "Solaris"++ click_on "Move to top"+ end++ click_on "Save"++ expect(page).to have_text("Successful creation")++ click_on "Operating System"+ wait_for_reload++ expect(page).to have_field("custom_field_multi_value", checked: true)++ expect(page).to have_css(".custom-option-row", count: 3)+ expect(page).to have_field("custom_field_custom_options_attributes_0_value", with: "Solaris")+ expect(page).to have_field("custom_field_custom_options_attributes_1_value", with: "Windows")+ expect(page).to have_field("custom_field_custom_options_attributes_2_value", with: "Linux")++ expect(page).to have_field("custom_field_custom_options_attributes_0_default_value", checked: false)+ expect(page).to have_field("custom_field_custom_options_attributes_1_default_value", checked: true)+ expect(page).to have_field("custom_field_custom_options_attributes_2_default_value", checked: false)+ end+end++RSpec.shared_examples_for "hierarchy custom fields on index page" do |type|+ let(:cf_page) { Pages::CustomFields::IndexPage.new }+ let(:user) { create(:admin) }++ current_user { user }++ before do+ cf_page.visit_tab type+ end++ context "with an active enterprise token with custom_field_hierarchies feature", with_ee: [:custom_field_hierarchies] do+ it "does not show the enterprise upsell banner" do+ expect(page).to have_no_text(I18n.t("ee.upsell.custom_field_hierarchies.description"))+ end+ end++ context "with an active enterprise token without custom_field_hierarchies feature", with_ee: [:another_feature] do+ it "shows the enterprise upsell banner" do+ expect(page).to have_text(I18n.t("ee.upsell.custom_field_hierarchies.description"))+ end+ end++ context "with a trial enterprise token", :with_ee_trial, with_ee: [:custom_field_hierarchies] do+ it "shows the enterprise upsell banner and can save" do+ expect(page).to have_text(I18n.t("ee.upsell.custom_field_hierarchies.description"))+ end+ end+end++RSpec.shared_examples_for "expected fields for the custom field's format" do |type, format|+ let(:cf_page) { Pages::CustomFields::IndexPage.new }+ let(:user) { create(:admin) }++ current_user { user }++ before do+ cf_page.visit_tab type+ end++ def expect_page_to_have_texts(*text)+ text.each do |t|+ expect(page).to have_text(t)+ end+ end++ def expect_page_not_to_have_texts(*text)+ text.each do |t|+ expect(page).to have_no_text(t)+ end+ end++ # Form element labels, default English translation in the trailing comment:+ let(:label_min_length) { I18n.t("activerecord.attributes.custom_field.min_length") } # Minimum length+ let(:label_max_length) { I18n.t("activerecord.attributes.custom_field.max_length") } # Maximum length+ let(:label_regexp) { I18n.t("activerecord.attributes.custom_field.regexp") } # Regular expression+ let(:label_multi_value) { I18n.t("activerecord.attributes.custom_field.multi_value") } # Allow multi-select+ # Allow non-open versions+ let(:label_allow_non_open_versions) do+ I18n.t("activerecord.attributes.custom_field.allow_non_open_versions")+ end+ # Possible values, capitalized on UI+ let(:label_possible_values) do+ I18n.t("activerecord.attributes.custom_field.possible_values").upcase+ end+ let(:label_default_value) { I18n.t("activerecord.attributes.custom_field.default_value") } # Default value+ let(:label_is_required) { I18n.t("activerecord.attributes.custom_field.is_required") } # Required+ let(:label_ee_banner_hierarchy) { I18n.t("ee.upsell.custom_field_hierarchies.description") } # Hierarchy Enterprise banner+ # Spent time SFs don't show "Searchable". Not tested here.+ # Project CFs don't show "For all projects" and "Used as a filter". Not tested here.+ # Content right to left is not shown for Project CFs Long text. Strange. Not tested.++ case format+ when "Text"+ it "shows the right options for the text custom field type" do+ retry_block do+ cf_page.click_to_create_new_custom_field "Text"+ end++ expect_page_to_have_texts(+ label_min_length, label_max_length, label_regexp, label_default_value, label_is_required+ )+ expect_page_not_to_have_texts(+ label_multi_value, label_allow_non_open_versions, label_possible_values, label_ee_banner_hierarchy+ )+ end+ when "Long text"+ it "shows the right options for the long text custom field type" do+ retry_block do+ cf_page.click_to_create_new_custom_field "Long text"+ end++ expect_page_to_have_texts(+ label_min_length, label_max_length, label_regexp, label_default_value, label_is_required+ )+ expect_page_not_to_have_texts(+ label_multi_value, label_allow_non_open_versions, label_possible_values, label_ee_banner_hierarchy+ )+ end+ when "Integer"+ it "shows the right options for the list custom field type" do+ retry_block do+ cf_page.click_to_create_new_custom_field "Integer"+ end++ # Integer has min/max_len and regex as well which seems strange.+ expect_page_to_have_texts(+ label_min_length, label_max_length, label_regexp, label_default_value, label_is_required+ )+ expect_page_not_to_have_texts(+ label_multi_value, label_allow_non_open_versions, label_possible_values, label_ee_banner_hierarchy+ )+ end+ when "Float"+ it "shows the right options for the float custom field type" do+ retry_block do+ cf_page.click_to_create_new_custom_field "Float"+ end++ # Float has min/max_len and regex as well which seems strange.+ expect_page_to_have_texts(+ label_min_length, label_max_length, label_regexp, label_default_value, label_is_required+ )+ expect_page_not_to_have_texts(+ label_multi_value, label_allow_non_open_versions, label_possible_values, label_ee_banner_hierarchy+ )+ end+ when "List"+ it "shows the right options for the list custom field type" do+ retry_block do+ cf_page.click_to_create_new_custom_field "List"+ end++ expect_page_to_have_texts(+ label_multi_value, label_possible_values, label_is_required+ )+ expect_page_not_to_have_texts(+ label_min_length, label_max_length, label_regexp, label_allow_non_open_versions,+ label_default_value, label_ee_banner_hierarchy+ )+ end+ when "Date"+ it "shows the right options for the date custom field type" do+ retry_block do+ cf_page.click_to_create_new_custom_field "Date"+ end++ expect_page_to_have_texts(label_is_required)+ expect_page_not_to_have_texts(+ label_min_length, label_max_length, label_regexp, label_multi_value,+ label_allow_non_open_versions, label_possible_values, label_default_value,+ label_ee_banner_hierarchy+ )+ end+ when "Boolean"+ it "shows the right options for the boolean custom field type" do+ retry_block do+ cf_page.click_to_create_new_custom_field "Boolean"+ end++ expect_page_to_have_texts(+ label_default_value, label_is_required+ )+ expect_page_not_to_have_texts(+ label_min_length, label_max_length, label_regexp, label_multi_value,+ label_allow_non_open_versions, label_possible_values, label_ee_banner_hierarchy+ )+ end+ when "User"+ it "shows the right options for the user custom field type" do+ retry_block do+ cf_page.click_to_create_new_custom_field "User"+ end++ expect_page_to_have_texts(+ label_multi_value, label_is_required+ )+ expect_page_not_to_have_texts(+ label_min_length, label_max_length, label_regexp, label_allow_non_open_versions,+ label_possible_values, label_default_value, label_ee_banner_hierarchy+ )+ end+ when "Version"+ it "shows the right options for the version custom field type" do+ retry_block do+ cf_page.click_to_create_new_custom_field "Version"+ end++ expect_page_to_have_texts(+ label_multi_value, label_allow_non_open_versions, label_is_required+ )+ expect_page_not_to_have_texts(+ label_min_length, label_max_length, label_regexp,+ label_possible_values, label_default_value, label_ee_banner_hierarchy+ )+ end+ when "Hierarchy"+ it "shows the right options for the hierarchy custom field type" do+ retry_block do+ cf_page.click_to_create_new_custom_field "Hierarchy"+ end++ expect_page_to_have_texts(+ label_multi_value, label_is_required, label_ee_banner_hierarchy+ )+ expect_page_not_to_have_texts(+ label_min_length, label_max_length, label_regexp, label_allow_non_open_versions,+ label_possible_values, label_default_value+ )+ expect(page).to have_button("Save", disabled: true)+ end+ end+enddiff --git a/spec/features/admin/custom_fields/time_entries/boolean_spec.rb b/spec/features/admin/custom_fields/time_entries/boolean_spec.rbnew file mode 100644index 00000000000..0cdcda96d83--- /dev/null+++ b/spec/features/admin/custom_fields/time_entries/boolean_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "time entry boolean custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Spent time", "Boolean"+enddiff --git a/spec/features/admin/custom_fields/time_entries/date_spec.rb b/spec/features/admin/custom_fields/time_entries/date_spec.rbnew file mode 100644index 00000000000..bbaf60f2b14--- /dev/null+++ b/spec/features/admin/custom_fields/time_entries/date_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "time entry date custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Spent time", "Date"+enddiff --git a/spec/features/admin/custom_fields/time_entries/float_spec.rb b/spec/features/admin/custom_fields/time_entries/float_spec.rbnew file mode 100644index 00000000000..69cc9400426--- /dev/null+++ b/spec/features/admin/custom_fields/time_entries/float_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "time entry float custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Spent time", "Float"+enddiff --git a/spec/features/admin/custom_fields/time_entries/integer_spec.rb b/spec/features/admin/custom_fields/time_entries/integer_spec.rbnew file mode 100644index 00000000000..73d29ed8f68--- /dev/null+++ b/spec/features/admin/custom_fields/time_entries/integer_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "time entry integer custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Spent time", "Integer"+enddiff --git a/spec/features/admin/custom_fields/list_custom_field_spec.rb b/spec/features/admin/custom_fields/time_entries/list_spec.rbsimilarity index 77%rename from spec/features/admin/custom_fields/list_custom_field_spec.rbrename to spec/features/admin/custom_fields/time_entries/list_spec.rbindex 2332f4d674a..0ffd856c69a 100644--- a/spec/features/admin/custom_fields/list_custom_field_spec.rb+++ b/spec/features/admin/custom_fields/time_entries/list_spec.rb@@ -29,29 +29,34 @@#++require "spec_helper"+require_relative "../shared_custom_field_expectations"RSpec.describe "List custom fields edit", :js doshared_let(:admin) { create(:admin) }+ let(:index_cf_page) { Pages::CustomFields::IndexPage.new }+ let(:new_cf_page) { Pages::CustomFields::NewPage.new }++ current_user { admin }+before do- login_as(admin)- visit custom_fields_path(tab: :TimeEntryCustomField)+ index_cf_page.visit_tab("Spent time")endit "can create and edit list custom fields (#37654)" do+ index_cf_page.expect_none_listed# Create CF- click_on "Create a new custom field"-- wait_for_reload+ index_cf_page.click_to_create_new_custom_field("List")fill_in "custom_field_name", with: "My List CF"- select "List", from: "custom_field_field_format"expect(page).to have_field("custom_field_custom_options_attributes_0_value")fill_in "custom_field_custom_options_attributes_0_value", with: "A"click_on "Save"+ index_cf_page.expect_and_dismiss_flash(message: "Successful creation.")+# Expect correct valuescf = CustomField.lastexpect(cf.name).to eq("My List CF")@@ -65,9 +70,15 @@ RSpec.describe "List custom fields edit", :js doclick_on "Save"+ index_cf_page.expect_and_dismiss_flash(message: "Successful update.")+# Expect correct values againcf = CustomField.lastexpect(cf.name).to eq("My List CF")expect(cf.possible_values.map(&:value)).to eq %w(B)end++ it_behaves_like "list custom fields", "Spent time"++ it_behaves_like "expected fields for the custom field's format", "Spent time", "List"enddiff --git a/spec/features/admin/custom_fields/time_entries/long_text_spec.rb b/spec/features/admin/custom_fields/time_entries/long_text_spec.rbnew file mode 100644index 00000000000..5422c05fbd1--- /dev/null+++ b/spec/features/admin/custom_fields/time_entries/long_text_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "time entry long text custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Spent time", "Long text"+enddiff --git a/spec/features/admin/custom_fields/time_entries/text_spec.rb b/spec/features/admin/custom_fields/time_entries/text_spec.rbnew file mode 100644index 00000000000..7ab343df4c5--- /dev/null+++ b/spec/features/admin/custom_fields/time_entries/text_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "time entry text custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Spent time", "Text"+enddiff --git a/spec/features/admin/custom_fields/time_entries/user_spec.rb b/spec/features/admin/custom_fields/time_entries/user_spec.rbnew file mode 100644index 00000000000..275f7c07107--- /dev/null+++ b/spec/features/admin/custom_fields/time_entries/user_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "time entry user custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Spent time", "User"+enddiff --git a/spec/features/admin/custom_fields/time_entries/version_spec.rb b/spec/features/admin/custom_fields/time_entries/version_spec.rbnew file mode 100644index 00000000000..26dbd687049--- /dev/null+++ b/spec/features/admin/custom_fields/time_entries/version_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "time entry version custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Spent time", "Version"+enddiff --git a/spec/features/admin/custom_fields/users/boolean_spec.rb b/spec/features/admin/custom_fields/users/boolean_spec.rbnew file mode 100644index 00000000000..0ead4a9ce1c--- /dev/null+++ b/spec/features/admin/custom_fields/users/boolean_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "user boolean custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Users", "Boolean"+enddiff --git a/spec/features/admin/custom_fields/users/date_spec.rb b/spec/features/admin/custom_fields/users/date_spec.rbnew file mode 100644index 00000000000..b26fbdb90dc--- /dev/null+++ b/spec/features/admin/custom_fields/users/date_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "user date custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Users", "Date"+enddiff --git a/spec/features/admin/custom_fields/users/float_spec.rb b/spec/features/admin/custom_fields/users/float_spec.rbnew file mode 100644index 00000000000..d1e2f730a12--- /dev/null+++ b/spec/features/admin/custom_fields/users/float_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "user float custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Users", "Float"+enddiff --git a/spec/features/admin/custom_fields/users/int_spec.rb b/spec/features/admin/custom_fields/users/int_spec.rbnew file mode 100644index 00000000000..82d6b2586c6--- /dev/null+++ b/spec/features/admin/custom_fields/users/int_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "user int custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Users", "Integer"+enddiff --git a/spec/features/admin/custom_fields/users/list_spec.rb b/spec/features/admin/custom_fields/users/list_spec.rbnew file mode 100644index 00000000000..ade785e1116--- /dev/null+++ b/spec/features/admin/custom_fields/users/list_spec.rb@@ -0,0 +1,38 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "users list custom fields", :js do+ it_behaves_like "list custom fields", "Users"++ it_behaves_like "expected fields for the custom field's format", "Users", "List"+enddiff --git a/spec/features/admin/custom_fields/users/long_text_spec.rb b/spec/features/admin/custom_fields/users/long_text_spec.rbnew file mode 100644index 00000000000..e7c6fb60164--- /dev/null+++ b/spec/features/admin/custom_fields/users/long_text_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "users long text custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Users", "Long text"+enddiff --git a/spec/features/admin/custom_fields/users/text_spec.rb b/spec/features/admin/custom_fields/users/text_spec.rbnew file mode 100644index 00000000000..926b822ca2b--- /dev/null+++ b/spec/features/admin/custom_fields/users/text_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "users text custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Users", "Text"+enddiff --git a/spec/features/admin/custom_fields/versions/boolean_spec.rb b/spec/features/admin/custom_fields/versions/boolean_spec.rbnew file mode 100644index 00000000000..0a415588bb3--- /dev/null+++ b/spec/features/admin/custom_fields/versions/boolean_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "version boolean custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Version", "Boolean"+enddiff --git a/spec/features/admin/custom_fields/versions/date_spec.rb b/spec/features/admin/custom_fields/versions/date_spec.rbnew file mode 100644index 00000000000..75c9dfb94c9--- /dev/null+++ b/spec/features/admin/custom_fields/versions/date_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "version date custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Version", "Date"+enddiff --git a/spec/features/admin/custom_fields/versions/float_spec.rb b/spec/features/admin/custom_fields/versions/float_spec.rbnew file mode 100644index 00000000000..ee9b3470b9b--- /dev/null+++ b/spec/features/admin/custom_fields/versions/float_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "version float custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Version", "Float"+enddiff --git a/spec/features/admin/custom_fields/versions/int_spec.rb b/spec/features/admin/custom_fields/versions/int_spec.rbnew file mode 100644index 00000000000..9ae0834ba1c--- /dev/null+++ b/spec/features/admin/custom_fields/versions/int_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "version int custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Version", "Integer"+enddiff --git a/spec/features/admin/custom_fields/versions/list_spec.rb b/spec/features/admin/custom_fields/versions/list_spec.rbnew file mode 100644index 00000000000..08b564522fb--- /dev/null+++ b/spec/features/admin/custom_fields/versions/list_spec.rb@@ -0,0 +1,38 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "version list custom fields", :js do+ it_behaves_like "list custom fields", "Versions"++ it_behaves_like "expected fields for the custom field's format", "Version", "List"+enddiff --git a/spec/features/admin/custom_fields/versions/long_text_spec.rb b/spec/features/admin/custom_fields/versions/long_text_spec.rbnew file mode 100644index 00000000000..7fbd8ee078f--- /dev/null+++ b/spec/features/admin/custom_fields/versions/long_text_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "version long text custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Version", "Long text"+enddiff --git a/spec/features/admin/custom_fields/versions/text_spec.rb b/spec/features/admin/custom_fields/versions/text_spec.rbnew file mode 100644index 00000000000..5761802c6fa--- /dev/null+++ b/spec/features/admin/custom_fields/versions/text_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "version text custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Version", "Text"+enddiff --git a/spec/features/admin/custom_fields/versions/user_spec.rb b/spec/features/admin/custom_fields/versions/user_spec.rbnew file mode 100644index 00000000000..b690fa94c19--- /dev/null+++ b/spec/features/admin/custom_fields/versions/user_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "version user custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Version", "User"+enddiff --git a/spec/features/admin/custom_fields/versions/version_spec.rb b/spec/features/admin/custom_fields/versions/version_spec.rbnew file mode 100644index 00000000000..0d29105f07e--- /dev/null+++ b/spec/features/admin/custom_fields/versions/version_spec.rb@@ -0,0 +1,36 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require_relative "../shared_custom_field_expectations"++RSpec.describe "version version custom fields", :js do+ it_behaves_like "expected fields for the custom field's format", "Version", "Version"+enddiff --git a/spec/features/admin/custom_fields/work_packages/boolean_spec.rb b/spec/features/admin/custom_fields/work_packages/boolean_spec.rbnew file mode 100644index 00000000000..6fd514ab840--- /dev/null+++ b/spec/features/admin/custom_fields/work_packages/boolean_spec.rb@@ -0,0 +1,65 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require "support/pages/custom_fields/index_page"++RSpec.describe "custom fields", :js do+ shared_let(:user) { create(:admin) }+ let(:cf_page) { Pages::CustomFields::IndexPage.new }++ current_user { user }++ before do+ cf_page.visit!+ cf_page.click_to_create_new_custom_field("Boolean")+ end++ describe "available fields" do+ it "shows all form elements" do+ expect(cf_page).to have_form_element("Name")+ expect(cf_page).to have_form_element("Default value")+ expect(cf_page).to have_form_element("Required")+ expect(cf_page).to have_form_element("For all projects")+ expect(cf_page).to have_form_element("Used as a filter")+ end+ end++ describe "creating a new boolean custom field" do+ it "creates a new bool custom field" do+ cf_page.set_name "New Field"+ click_on "Save"++ cf_page.expect_and_dismiss_flash(message: "Successful creation.")++ expect(page).to have_text("New Field")+ end+ end+enddiff --git a/spec/features/admin/custom_fields/work_packages/date_spec.rb b/spec/features/admin/custom_fields/work_packages/date_spec.rbnew file mode 100644index 00000000000..0da7288c894--- /dev/null+++ b/spec/features/admin/custom_fields/work_packages/date_spec.rb@@ -0,0 +1,56 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require "support/pages/custom_fields/index_page"++RSpec.describe "custom fields", :js do+ let(:user) { create(:admin) }+ let(:cf_page) { Pages::CustomFields::IndexPage.new }++ current_user { user }++ before do+ cf_page.visit!+ end++ describe "creating a new date custom field" do+ it "creates a new date custom field" do+ cf_page.click_to_create_new_custom_field("Date")++ cf_page.set_name "New Field"+ click_on "Save"++ cf_page.expect_and_dismiss_flash(message: "Successful creation.")++ expect(page).to have_text("New Field")+ end+ end+enddiff --git a/spec/features/admin/custom_fields/work_packages/float_spec.rb b/spec/features/admin/custom_fields/work_packages/float_spec.rbnew file mode 100644index 00000000000..c5a371dfd8a--- /dev/null+++ b/spec/features/admin/custom_fields/work_packages/float_spec.rb@@ -0,0 +1,57 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require "support/pages/custom_fields/index_page"++RSpec.describe "custom fields", :js do+ let(:user) { create(:admin) }+ let(:cf_page) { Pages::CustomFields::IndexPage.new }++ current_user { user }++ before do+ cf_page.visit!+ end++ describe "creating a new float custom field" do+ it "creates a new float custom field" do+ cf_page.click_to_create_new_custom_field("Float")++ cf_page.set_name "New Field"+ cf_page.set_default_value "20.34"+ click_on "Save"++ cf_page.expect_and_dismiss_flash(message: "Successful creation.")++ expect(page).to have_text("New Field")+ end+ end+enddiff --git a/spec/features/custom_fields/hierarchy_custom_field_spec.rb b/spec/features/admin/custom_fields/work_packages/hierarchy_spec.rbsimilarity index 92%rename from spec/features/custom_fields/hierarchy_custom_field_spec.rbrename to spec/features/admin/custom_fields/work_packages/hierarchy_spec.rbindex 1306c8ee206..69b7b93875c 100644--- a/spec/features/custom_fields/hierarchy_custom_field_spec.rb+++ b/spec/features/admin/custom_fields/work_packages/hierarchy_spec.rb@@ -29,31 +29,28 @@#++require "spec_helper"+require_relative "../shared_custom_field_expectations"-RSpec.describe "custom fields of type hierarchy", :js do- let(:admin) { create(:admin) }+RSpec.describe "work package custom fields of type hierarchy", :js do+ shared_let(:admin) { create(:admin) }let(:custom_field_index_page) { Pages::CustomFields::IndexPage.new }let(:new_custom_field_page) { Pages::CustomFields::NewPage.new }let(:hierarchy_page) { Pages::CustomFields::HierarchyPage.new }- before do- allow(EnterpriseToken).to receive_messages(allows_to?: true, trialling?: false)- login_as admin- end+ current_user { admin }- it "lets you create, update and delete a custom field of type hierarchy" do+ it "lets you create, update and delete a custom field of type hierarchy", with_ee: [:custom_field_hierarchies] do# region CustomField creation-custom_field_index_page.visit!- page.find("[aria-label='New custom field']").click- new_custom_field_page.expect_current_path+ custom_field_index_page.click_to_create_new_custom_field("Hierarchy")hierarchy_name = "Stormtrooper Organisation"fill_in "Name", with: hierarchy_name- select "Hierarchy", from: "Format"click_on "Save"+ new_custom_field_page.expect_and_dismiss_flash(message: "Successful creation.")+custom_field_index_page.expect_current_path("tab=WorkPackageCustomField")expect(page).to have_list_item(hierarchy_name)@@ -76,6 +73,7 @@ RSpec.describe "custom fields of type hierarchy", :js dofill_in "Name", with: "", fill_options: { clear: :backspace }fill_in "Name", with: hierarchy_nameclick_on "Save"+expect(page).to have_heading(hierarchy_name)# endregion@@ -158,7 +156,7 @@ RSpec.describe "custom fields of type hierarchy", :js do# endregionend- it "lets you add sub-items through the context menu" do+ it "lets you add sub-items through the context menu", with_ee: [:custom_field_hierarchies] docustom_field = create(:hierarchy_wp_custom_field, name: "Imperial Organization")root = custom_field.hierarchy_root@@ -193,7 +191,7 @@ RSpec.describe "custom fields of type hierarchy", :js doexpect(page).to have_test_selector("op-custom-fields--hierarchy-item", text: "Stormtroopers\n(ST)\n1 sub-item")end- context "when navigating the hierarchy" do+ context "when navigating the hierarchy", with_ee: [:custom_field_hierarchies] dolet(:service) { CustomFields::Hierarchy::HierarchicalItemService.new }let(:custom_field) { create(:wp_custom_field, name: "Hogwarts", field_format: "hierarchy", hierarchy_root: nil) }let!(:root) { service.generate_root(custom_field).value! }@@ -212,7 +210,7 @@ RSpec.describe "custom fields of type hierarchy", :js dovisit custom_field_item_path(root.custom_field_id, gryffindor)end- it "can navigate and keep the tab selection (regression #63921)" do+ it "can navigate and keep the tab selection (regression #63921)", with_ee: [:custom_field_hierarchies] do# Expect items to be loaded and the tab nav to be selected correctlyexpect(page).to have_test_selector("op-custom-fields--hierarchy-item", count: 2)hierarchy_page.expect_tab "Items"@@ -222,7 +220,7 @@ RSpec.describe "custom fields of type hierarchy", :js dohierarchy_page.expect_tab "Items"end- it "can use the TreeView for navigation" do+ it "can use the TreeView for navigation", with_ee: [:custom_field_hierarchies] doexpect(page).to have_test_selector("op-custom-fields--hierarchy-item", count: 2)# Expect the current item to be selected@@ -244,4 +242,6 @@ RSpec.describe "custom fields of type hierarchy", :js dohierarchy_page.expect_tab "Items"endend++ it_behaves_like "hierarchy custom fields on index page", "Work packages"enddiff --git a/spec/features/admin/custom_fields/work_packages/int_spec.rb b/spec/features/admin/custom_fields/work_packages/int_spec.rbnew file mode 100644index 00000000000..19a48e0999f--- /dev/null+++ b/spec/features/admin/custom_fields/work_packages/int_spec.rb@@ -0,0 +1,59 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require "support/pages/custom_fields/index_page"++RSpec.describe "custom fields", :js do+ let(:user) { create(:admin) }+ let(:cf_page) { Pages::CustomFields::IndexPage.new }++ current_user { user }++ before do+ cf_page.visit!+ end++ describe "creating a new integer custom field" do+ before do+ cf_page.click_to_create_new_custom_field("Integer")+ end++ it "creates a new integer custom field" do+ cf_page.set_name "New Field"+ cf_page.set_default_value "342"+ click_on "Save"++ cf_page.expect_and_dismiss_flash(message: "Successful creation.")++ expect(page).to have_text("New Field")+ end+ end+enddiff --git a/spec/features/admin/custom_fields/link_custom_field_spec.rb b/spec/features/admin/custom_fields/work_packages/link_spec.rbsimilarity index 87%rename from spec/features/admin/custom_fields/link_custom_field_spec.rbrename to spec/features/admin/custom_fields/work_packages/link_spec.rbindex 14b54333abf..b09bd8f37d7 100644--- a/spec/features/admin/custom_fields/link_custom_field_spec.rb+++ b/spec/features/admin/custom_fields/work_packages/link_spec.rb@@ -34,24 +34,24 @@ RSpec.describe "Link custom fields edit", :js doshared_let(:admin) { create(:admin) }let(:cf_page) { Pages::CustomFields::IndexPage.new }+ current_user { admin }+before do- login_as(admin)- visit custom_fields_path+ cf_page.visit!end- it "can create and edit user custom fields" do+ it "can create and edit link custom fields" do# Create CF- click_link "Create a new custom field"-- wait_for_reload+ cf_page.click_to_create_new_custom_field("Link (URL)")fill_in "custom_field_name", with: "My Link CF"- select "Link (URL)", from: "custom_field_field_format"expect(page).to have_no_field("custom_field_custom_options_attributes_0_value")click_on "Save"+ cf_page.expect_and_dismiss_flash(message: "Successful creation.")+# Expect field to be createdcf = CustomField.lastexpect(cf.name).to eq("My Link CF")@@ -65,6 +65,8 @@ RSpec.describe "Link custom fields edit", :js doclick_on "Save"+ cf_page.expect_and_dismiss_flash(message: "Successful update.")+# Expect field to be savedcf = CustomField.lastexpect(cf.name).to eq("My Link CF (edited)")diff --git a/spec/features/admin/custom_fields/work_packages/list_spec.rb b/spec/features/admin/custom_fields/work_packages/list_spec.rbnew file mode 100644index 00000000000..d931766d75c--- /dev/null+++ b/spec/features/admin/custom_fields/work_packages/list_spec.rb@@ -0,0 +1,159 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "spec_helper"+require "support/pages/custom_fields/index_page"++RSpec.describe "work package list custom fields", :js do+ let(:user) { create(:admin) }+ let(:cf_page) { Pages::CustomFields::IndexPage.new }++ before do+ login_as user+ end++ describe "editing an existing list custom field" do+ let!(:custom_field) do+ create(+ :list_wp_custom_field,+ name: "Platform",+ possible_values: %w[Playstation Xbox Nintendo PC]+ )+ end++ before do+ cf_page.visit!+ wait_for_reload++ click_on custom_field.name+ wait_for_reload+ end++ it "adds new options" do+ retry_block do+ page.find_test_selector("add-custom-option").click++ expect(page).to have_css(".custom-option-row", count: 5)+ end++ within all(".custom-option-row").last do+ find(".custom-option-value input").set "Sega"+ end++ retry_block do+ page.find_test_selector("add-custom-option").click++ expect(page).to have_css(".custom-option-row", count: 6)+ end++ within all(".custom-option-row").last do+ find(".custom-option-value input").set "Atari"+ end++ click_on "Save"++ expect(page).to have_text("Successful update")+ expect(page).to have_text("Platform")+ expect(page).to have_css(".custom-option-row", count: 6)++ %w[Playstation Xbox Nintendo PC Sega Atari].each_with_index do |value, i|+ expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)+ end+ end++ it "updates the values and orders of the custom options" do+ expect(page).to have_text("Platform")++ expect(page).to have_css(".custom-option-row", count: 4)+ %w[Playstation Xbox Nintendo PC].each_with_index do |value, i|+ expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)+ end++ fill_in("custom_field_custom_options_attributes_1_value", with: "")+ fill_in("custom_field_custom_options_attributes_1_value", with: "Sega")+ check("custom_field_multi_value")+ check("custom_field_custom_options_attributes_0_default_value")+ check("custom_field_custom_options_attributes_2_default_value")+ within first(".custom-option-row") do+ click_on "Move to bottom"+ end+ click_on "Save"++ expect(page).to have_text("Successful update")+ expect(page).to have_text("Platform")+ expect(page).to have_field("custom_field_multi_value", checked: true)++ %w[Sega Nintendo PC Playstation].each_with_index do |value, i|+ expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)+ end++ expect(page).to have_field("custom_field_custom_options_attributes_0_default_value", checked: false)+ expect(page).to have_field("custom_field_custom_options_attributes_1_default_value", checked: true)+ expect(page).to have_field("custom_field_custom_options_attributes_2_default_value", checked: false)+ expect(page).to have_field("custom_field_custom_options_attributes_3_default_value", checked: true)+ end++ it "shows the correct breadcrumbs" do+ page.within_test_selector("custom-fields--page-header") do+ expect(page).to have_css(".breadcrumb-item", text: "Work packages")+ expect(page).to have_css(".breadcrumb-item.breadcrumb-item-selected", text: "Platform")+ end+ end++ context "with work packages using the options" do+ before do+ create_list(+ :work_package_custom_value,+ 3,+ custom_field:,+ value: custom_field.custom_options[1].id+ )+ end++ it "deletes a custom option and all values using it" do+ within all(".custom-option-row")[1] do+ accept_alert do+ find(".icon-delete").click+ end+ end++ expect(page).to have_text("Option 'Xbox' and its 3 occurrences were deleted.")++ rows = all(".custom-option-value input")++ expect(rows.size).to be(3)++ expect(rows[0].value).to eql("Playstation")+ expect(rows[1].value).to eql("Nintendo")+ expect(rows[2].value).to eql("PC")+ end+ end+ end+enddiff --git a/spec/features/custom_fields/create_long_text_spec.rb b/spec/features/admin/custom_fields/work_packages/long_text_spec.rbsimilarity index 87%rename from spec/features/custom_fields/create_long_text_spec.rbrename to spec/features/admin/custom_fields/work_packages/long_text_spec.rbindex 93d222406a2..d8c8ccd018a 100644--- a/spec/features/custom_fields/create_long_text_spec.rb+++ b/spec/features/admin/custom_fields/work_packages/long_text_spec.rb@@ -21,28 +21,24 @@ RSpec.describe "custom fields", :js doMARKDOWNend+ current_user { user }+before do- login_as(user)+ cf_page.visit!enddescribe "creating a new long text custom field" do- before do- cf_page.visit!- click_on "Create a new custom field"- end-it "creates a new bool custom field" do- cf_page.set_name "New Field"- cf_page.select_format "Long text"+ cf_page.click_to_create_new_custom_field("Long text")- sleep 1+ cf_page.set_name "New Field"editor.set_markdown default_textcf_page.set_all_projects trueclick_on "Save"- expect(page).to have_text("Successful creation")+ cf_page.expect_and_dismiss_flash(message: "Successful creation.")expect(page).to have_text("New Field")cf = CustomField.lastdiff --git a/spec/features/admin/custom_fields/multi_value_custom_fields_spec.rb b/spec/features/admin/custom_fields/work_packages/multi_value_list_spec.rbsimilarity index 92%rename from spec/features/admin/custom_fields/multi_value_custom_fields_spec.rbrename to spec/features/admin/custom_fields/work_packages/multi_value_list_spec.rbindex 79fec6dd4df..69bc59c2aeb 100644--- a/spec/features/admin/custom_fields/multi_value_custom_fields_spec.rb+++ b/spec/features/admin/custom_fields/work_packages/multi_value_list_spec.rb@@ -33,18 +33,20 @@ require "spec_helper"RSpec.describe "Multi-value custom fields creation", :js, :selenium doshared_let(:admin) { create(:admin) }+ let(:index_cf_page) { Pages::CustomFields::IndexPage.new }++ current_user { admin }+before do- login_as(admin)- visit custom_fields_path+ index_cf_page.visit!endit "can create and reorder custom field list values" do# Create CF- click_on "Create a new custom field"+ index_cf_page.click_to_create_new_custom_field("List")SeleniumHubWaiter.waitfill_in "custom_field_name", with: "My List CF"- select "List", from: "custom_field_field_format"expect(page).to have_css("input#custom_field_custom_options_attributes_0_value")fill_in "custom_field_custom_options_attributes_0_value", with: "A"@@ -63,6 +65,8 @@ RSpec.describe "Multi-value custom fields creation", :js, :selenium doclick_on "Save"+ index_cf_page.expect_and_dismiss_flash(message: "Successful creation.")+# Edit againSeleniumHubWaiter.waitpage.find("a", text: "My List CF").click@@ -97,6 +101,9 @@ RSpec.describe "Multi-value custom fields creation", :js, :selenium doJSclick_on "Save"++ index_cf_page.expect_and_dismiss_flash(message: "Successful update.")+# Edit againexpect(page).to have_field("custom_field_custom_options_attributes_0_value", with: "B")expect(page).to have_field("custom_field_custom_options_attributes_1_value", with: "C")diff --git a/spec/features/admin/custom_fields/custom_fields_project_spec.rb b/spec/features/admin/custom_fields/work_packages/project_mapping_spec.rbsimilarity index 90%rename from spec/features/admin/custom_fields/custom_fields_project_spec.rbrename to spec/features/admin/custom_fields/work_packages/project_mapping_spec.rbindex 8e829f10c78..1ce4cb74a2e 100644--- a/spec/features/admin/custom_fields/custom_fields_project_spec.rb+++ b/spec/features/admin/custom_fields/work_packages/project_mapping_spec.rb@@ -42,7 +42,7 @@ RSpec.describe "Custom Fields Multi-Project Activation", :js docreate(:custom_fields_project, custom_field:, project: archived_project)end- let(:custom_field_projects_page) { Pages::Admin::CustomFields::CustomFieldsProjects::CustomFieldProjectsIndex.new }+ let(:custom_field_projects_mappings_page) { Pages::CustomFields::ProjectMappings.new }context "with insufficient permissions" doit "is not accessible" do@@ -117,7 +117,7 @@ RSpec.describe "Custom Fields Multi-Project Activation", :js doexpect(page).to have_text(subproject.name)aggregate_failures "pagination links maintain the correct url" do- custom_field_projects_page.expect_page_sizes(model: custom_field)+ custom_field_projects_mappings_page.expect_page_sizes(model: custom_field)endend@@ -128,14 +128,14 @@ RSpec.describe "Custom Fields Multi-Project Activation", :js docurrent_page = 3visit custom_field_projects_path(custom_field, page: current_page)- project = custom_field_projects_page.project_in_first_row- custom_field_projects_page.click_menu_item_of("Remove from project", project)+ project = custom_field_projects_mappings_page.project_in_first_row+ custom_field_projects_mappings_page.click_menu_item_of("Remove from project", project)expect(page).to have_no_text(project.name)aggregate_failures "pagination links maintain the correct url after unlinking is done" do- custom_field_projects_page.expect_page_links(model: custom_field, current_page:)- custom_field_projects_page.expect_current_page_number(current_page)+ custom_field_projects_mappings_page.expect_page_links(model: custom_field, current_page:)+ custom_field_projects_mappings_page.expect_current_page_number(current_page)endenddiff --git a/spec/features/admin/custom_fields/user_custom_field_spec.rb b/spec/features/admin/custom_fields/work_packages/user_spec.rbsimilarity index 84%rename from spec/features/admin/custom_fields/user_custom_field_spec.rbrename to spec/features/admin/custom_fields/work_packages/user_spec.rbindex 00879bc6908..4ecf49f0558 100644--- a/spec/features/admin/custom_fields/user_custom_field_spec.rb+++ b/spec/features/admin/custom_fields/work_packages/user_spec.rb@@ -32,28 +32,29 @@ require "spec_helper"RSpec.describe "User custom fields edit", :js doshared_let(:admin) { create(:admin) }- let(:cf_page) { Pages::CustomFields::IndexPage.new }+ let(:index_cf_page) { Pages::CustomFields::IndexPage.new }let(:new_cf_page) { Pages::CustomFields::NewPage.new }+ current_user { admin }+before do- login_as(admin)- visit custom_fields_path+ index_cf_page.visit!endit "can create and edit user custom fields (#48725)" do# Create CF- page.find("[aria-label='New custom field']").click- new_cf_page.expect_current_path+ index_cf_page.click_to_create_new_custom_field("User")fill_in "Name", with: "My User CF"- select "User", from: "Format"expect(page).to have_no_field("custom_field_custom_options_attributes_0_value")click_on "Save"+ new_cf_page.expect_and_dismiss_flash(message: "Successful creation.")+# Expect field to be created- cf_page.expect_current_path("tab=WorkPackageCustomField")+ index_cf_page.expect_current_path("tab=WorkPackageCustomField")expect(page).to have_list_item("My User CF")# Edit again@@ -64,6 +65,8 @@ RSpec.describe "User custom fields edit", :js doclick_on "Save"+ new_cf_page.expect_and_dismiss_flash(message: "Successful update.")+# Expect field to be savedexpect(page).to have_css(".PageHeader-title", text: "My User CF (edited)")cf = CustomField.lastdiff --git a/spec/features/custom_fields/create_bool_spec.rb b/spec/features/custom_fields/create_bool_spec.rbdeleted file mode 100644index cff86a6ca10..00000000000--- a/spec/features/custom_fields/create_bool_spec.rb+++ /dev/null@@ -1,45 +0,0 @@-# frozen_string_literal: true--require "spec_helper"-require "support/pages/custom_fields/index_page"--RSpec.describe "custom fields", :js do- let(:user) { create(:admin) }- let(:cf_page) { Pages::CustomFields::IndexPage.new }-- before do- login_as user- end-- describe "available fields" do- before do- cf_page.visit!- click_on "Create a new custom field"- end-- it "shows all form elements" do- expect(cf_page).to have_form_element("Name")- expect(cf_page).to have_form_element("Required")- expect(cf_page).to have_form_element("For all projects")- expect(cf_page).to have_form_element("Used as a filter")- expect(cf_page).to have_form_element("Searchable")- end- end-- describe "creating a new bool custom field" do- before do- cf_page.visit!- click_on "Create a new custom field"- wait_for_reload- end-- it "creates a new bool custom field" do- cf_page.set_name "New Field"- cf_page.select_format "Date"- click_on "Save"-- expect(page).to have_text("Successful creation")- expect(page).to have_text("New Field")- end- end-enddiff --git a/spec/features/custom_fields/create_date_spec.rb b/spec/features/custom_fields/create_date_spec.rbdeleted file mode 100644index e4e49704644..00000000000--- a/spec/features/custom_fields/create_date_spec.rb+++ /dev/null@@ -1,31 +0,0 @@-# frozen_string_literal: true--require "spec_helper"-require "support/pages/custom_fields/index_page"--RSpec.describe "custom fields", :js do- let(:user) { create(:admin) }- let(:cf_page) { Pages::CustomFields::IndexPage.new }-- before do- login_as user- end-- describe "creating a new date custom field" do- before do- cf_page.visit!-- click_on "Create a new custom field"- wait_for_reload- end-- it "creates a new date custom field" do- cf_page.set_name "New Field"- cf_page.select_format "Date"- click_on "Save"-- expect(page).to have_text("Successful creation")- expect(page).to have_text("New Field")- end- end-enddiff --git a/spec/features/custom_fields/create_float_spec.rb b/spec/features/custom_fields/create_float_spec.rbdeleted file mode 100644index 8431637ef92..00000000000--- a/spec/features/custom_fields/create_float_spec.rb+++ /dev/null@@ -1,32 +0,0 @@-# frozen_string_literal: true--require "spec_helper"-require "support/pages/custom_fields/index_page"--RSpec.describe "custom fields", :js do- let(:user) { create(:admin) }- let(:cf_page) { Pages::CustomFields::IndexPage.new }-- before do- login_as user- end-- describe "creating a new float custom field" do- before do- cf_page.visit!-- click_on "Create a new custom field"- wait_for_reload- end-- it "creates a new float custom field" do- cf_page.set_name "New Field"- cf_page.select_format "Float"- cf_page.set_default_value "20.34"- click_on "Save"-- expect(page).to have_text("Successful creation")- expect(page).to have_text("New Field")- end- end-enddiff --git a/spec/features/custom_fields/create_int_spec.rb b/spec/features/custom_fields/create_int_spec.rbdeleted file mode 100644index 24a0e181888..00000000000--- a/spec/features/custom_fields/create_int_spec.rb+++ /dev/null@@ -1,32 +0,0 @@-# frozen_string_literal: true--require "spec_helper"-require "support/pages/custom_fields/index_page"--RSpec.describe "custom fields", :js do- let(:user) { create(:admin) }- let(:cf_page) { Pages::CustomFields::IndexPage.new }-- before do- login_as user- end-- describe "creating a new float custom field" do- before do- cf_page.visit!-- click_on "Create a new custom field"- wait_for_reload- end-- it "creates a new float custom field" do- cf_page.set_name "New Field"- cf_page.select_format "Integer"- cf_page.set_default_value "342"- click_on "Save"-- expect(page).to have_text("Successful creation")- expect(page).to have_text("New Field")- end- end-enddiff --git a/spec/features/custom_fields/custom_fields_spec.rb b/spec/features/custom_fields/custom_fields_spec.rbdeleted file mode 100644index 14b99d7473d..00000000000--- a/spec/features/custom_fields/custom_fields_spec.rb+++ /dev/null@@ -1,367 +0,0 @@-# frozen_string_literal: true--require "spec_helper"-require "support/pages/custom_fields/index_page"--RSpec.describe "custom fields", :js do- let(:user) { create(:admin) }- let(:cf_page) { Pages::CustomFields::IndexPage.new }-- before do- login_as user- end-- shared_examples "creating a new custom field" do |type|- it "has the options in the right order for a list custom field" do- cf_page.visit_tab type-- click_on "Create a new custom field"- wait_for_reload- cf_page.set_name "Operating System"-- select "List", from: "custom_field_field_format"- expect(page).to have_text("Allow multi-select")- check("custom_field_multi_value")-- expect(page).to have_css(".custom-option-row", count: 1)- within all(".custom-option-row").last do- find(".custom-option-value input").set "Windows"- find(".custom-option-default-value input").set true- end-- page.find_test_selector("add-custom-option").click-- expect(page).to have_css(".custom-option-row", count: 2)- within all(".custom-option-row").last do- find(".custom-option-value input").set "Linux"- end-- page.find_test_selector("add-custom-option").click-- expect(page).to have_css(".custom-option-row", count: 3)- within all(".custom-option-row").last do- find(".custom-option-value input").set "Solaris"-- click_on "Move to top"- end-- click_on "Save"-- expect(page).to have_text("Successful creation")-- click_on "Operating System"- wait_for_reload-- expect(page).to have_field("custom_field_multi_value", checked: true)-- expect(page).to have_css(".custom-option-row", count: 3)- expect(page).to have_field("custom_field_custom_options_attributes_0_value", with: "Solaris")- expect(page).to have_field("custom_field_custom_options_attributes_1_value", with: "Windows")- expect(page).to have_field("custom_field_custom_options_attributes_2_value", with: "Linux")-- expect(page).to have_field("custom_field_custom_options_attributes_0_default_value", checked: false)- expect(page).to have_field("custom_field_custom_options_attributes_1_default_value", checked: true)- expect(page).to have_field("custom_field_custom_options_attributes_2_default_value", checked: false)- end-- it "shows the right options for each custom field type" do- cf_page.visit_tab type-- click_on "Create a new custom field"- wait_for_reload- cf_page.set_name "Ignored"-- # Form element labels, default English translation in the trailing comment:- label_min_length = I18n.t("activerecord.attributes.custom_field.min_length") # Minimum length- label_max_length = I18n.t("activerecord.attributes.custom_field.max_length") # Maximum length- label_regexp = I18n.t("activerecord.attributes.custom_field.regexp") # Regular expression- label_multi_value = I18n.t("activerecord.attributes.custom_field.multi_value") # Allow multi-select- label_allow_non_open_versions = I18n.t("activerecord.attributes.custom_field.allow_non_open_versions") # Allow non-open versions- label_possible_values = I18n.t("activerecord.attributes.custom_field.possible_values").upcase # Possible values, capitalized on UI- label_default_value = I18n.t("activerecord.attributes.custom_field.default_value") # Default value- label_is_required = I18n.t("activerecord.attributes.custom_field.is_required") # Required- label_ee_banner_hierarchy = I18n.t("ee.upsell.custom_field_hierarchies.description") # Hierarchy Enterprise banner- # Spent time SFs don't show "Searchable". Not tested here.- # Project CFs don't show "For all projects" and "Used as a filter". Not tested here.- # Content right to left is not shown for Project CFs Long text. Strange. Not tested.-- def expect_page_to_have_texts(*text)- text.each do |t|- expect(page).to have_text(t)- end- end-- def expect_page_not_to_have_texts(*text)- text.each do |t|- expect(page).to have_no_text(t)- end- end-- select "Text", from: "custom_field_field_format"- expect_page_to_have_texts(- label_min_length, label_max_length, label_regexp, label_default_value, label_is_required- )- expect_page_not_to_have_texts(- label_multi_value, label_allow_non_open_versions, label_possible_values, label_ee_banner_hierarchy- )-- select "Long text", from: "custom_field_field_format"- expect_page_to_have_texts(- label_min_length, label_max_length, label_regexp, label_default_value, label_is_required- )- expect_page_not_to_have_texts(- label_multi_value, label_allow_non_open_versions, label_possible_values, label_ee_banner_hierarchy- )-- # Both Integer and Float have min/max_len and regex as well which seems strange.- select "Integer", from: "custom_field_field_format"- expect_page_to_have_texts(- label_min_length, label_max_length, label_regexp, label_default_value, label_is_required- )- expect_page_not_to_have_texts(- label_multi_value, label_allow_non_open_versions, label_possible_values, label_ee_banner_hierarchy- )-- select "Float", from: "custom_field_field_format"- expect_page_to_have_texts(- label_min_length, label_max_length, label_regexp, label_default_value, label_is_required- )- expect_page_not_to_have_texts(- label_multi_value, label_allow_non_open_versions, label_possible_values, label_ee_banner_hierarchy- )-- select "List", from: "custom_field_field_format"- expect_page_to_have_texts(- label_multi_value, label_possible_values, label_is_required- )- expect_page_not_to_have_texts(- label_min_length, label_max_length, label_regexp, label_allow_non_open_versions,- label_default_value, label_ee_banner_hierarchy- )-- select "Date", from: "custom_field_field_format"- expect_page_to_have_texts(label_is_required)- expect_page_not_to_have_texts(- label_min_length, label_max_length, label_regexp, label_multi_value,- label_allow_non_open_versions, label_possible_values, label_default_value,- label_ee_banner_hierarchy- )-- select "Boolean", from: "custom_field_field_format"- expect_page_to_have_texts(- label_default_value, label_is_required- )- expect_page_not_to_have_texts(- label_min_length, label_max_length, label_regexp, label_multi_value,- label_allow_non_open_versions, label_possible_values, label_ee_banner_hierarchy- )-- select "User", from: "custom_field_field_format"- expect_page_to_have_texts(- label_multi_value, label_is_required- )- expect_page_not_to_have_texts(- label_min_length, label_max_length, label_regexp, label_allow_non_open_versions,- label_possible_values, label_default_value, label_ee_banner_hierarchy- )-- select "Version", from: "custom_field_field_format"- expect_page_to_have_texts(- label_multi_value, label_allow_non_open_versions, label_is_required- )- expect_page_not_to_have_texts(- label_min_length, label_max_length, label_regexp,- label_possible_values, label_default_value, label_ee_banner_hierarchy- )-- if hierarchy_type_available- select "Hierarchy", from: "custom_field_field_format"- expect_page_to_have_texts(- label_multi_value, label_is_required, label_ee_banner_hierarchy- )- expect_page_not_to_have_texts(- label_min_length, label_max_length, label_regexp, label_allow_non_open_versions,- label_possible_values, label_default_value- )- expect(page).to have_button("Save", disabled: true)- end- end-- it "shows the correct breadcrumbs" do- cf_page.visit_tab type-- click_on "Create a new custom field"- wait_for_reload-- page.within_test_selector("custom-fields--page-header") do- expect(page).to have_css(".breadcrumb-item", text: type)- expect(page).to have_css(".breadcrumb-item.breadcrumb-item-selected", text: "New custom field")- end- end- end-- describe "work packages" do- let(:hierarchy_type_available) { true }-- it_behaves_like "creating a new custom field", "Work packages"-- context "for hierarchy type" do- before do- cf_page.visit_tab "Work packages"-- click_on "Create a new custom field"- wait_for_reload- cf_page.set_name "Ignored"-- select "Hierarchy", from: "custom_field_field_format"- end-- context "with an active enterprise token with custom_field_hierarchies feature", with_ee: [:custom_field_hierarchies] do- it "does not show the enterprise upsell banner and can save" do- expect(page).to have_no_text(I18n.t("ee.upsell.custom_field_hierarchies.description"))- expect(page).to have_button("Save", disabled: false)- end- end-- context "with an active enterprise token without custom_field_hierarchies feature", with_ee: [:another_feature] do- it "shows the enterprise upsell banner and cannot save" do- expect(page).to have_text(I18n.t("ee.upsell.custom_field_hierarchies.description"))- expect(page).to have_button("Save", disabled: true)- end- end-- context "with a trial enterprise token", :with_ee_trial, with_ee: [:custom_field_hierarchies] do- it "shows the enterprise upsell banner and can save" do- expect(page).to have_text(I18n.t("ee.upsell.custom_field_hierarchies.description"))- expect(page).to have_button("Save", disabled: false)- end- end- end- end-- describe "time entries" do- let(:hierarchy_type_available) { false }-- it_behaves_like "creating a new custom field", "Spent time"- end-- describe "versions" do- let(:hierarchy_type_available) { false }-- it_behaves_like "creating a new custom field", "Versions"- end-- context "with an existing list custom field" do- let!(:custom_field) do- create(- :list_wp_custom_field,- name: "Platform",- possible_values: %w[Playstation Xbox Nintendo PC]- )- end-- before do- cf_page.visit!- wait_for_reload-- click_on custom_field.name- wait_for_reload- end-- it "adds new options" do- page.find_test_selector("add-custom-option").click- wait_for_reload-- expect(page).to have_css(".custom-option-row", count: 5)- within all(".custom-option-row").last do- find(".custom-option-value input").set "Sega"- end-- page.find_test_selector("add-custom-option").click- wait_for_reload-- expect(page).to have_css(".custom-option-row", count: 6)- within all(".custom-option-row").last do- find(".custom-option-value input").set "Atari"- end-- click_on "Save"-- expect(page).to have_text("Successful update")- expect(page).to have_text("Platform")- expect(page).to have_css(".custom-option-row", count: 6)-- %w[Playstation Xbox Nintendo PC Sega Atari].each_with_index do |value, i|- expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)- end- end-- it "updates the values and orders of the custom options" do- expect(page).to have_text("Platform")-- expect(page).to have_css(".custom-option-row", count: 4)- %w[Playstation Xbox Nintendo PC].each_with_index do |value, i|- expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)- end-- fill_in("custom_field_custom_options_attributes_1_value", with: "")- fill_in("custom_field_custom_options_attributes_1_value", with: "Sega")- check("custom_field_multi_value")- check("custom_field_custom_options_attributes_0_default_value")- check("custom_field_custom_options_attributes_2_default_value")- within first(".custom-option-row") do- click_on "Move to bottom"- end- click_on "Save"-- expect(page).to have_text("Successful update")- expect(page).to have_text("Platform")- expect(page).to have_field("custom_field_multi_value", checked: true)-- %w[Sega Nintendo PC Playstation].each_with_index do |value, i|- expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)- end-- expect(page).to have_field("custom_field_custom_options_attributes_0_default_value", checked: false)- expect(page).to have_field("custom_field_custom_options_attributes_1_default_value", checked: true)- expect(page).to have_field("custom_field_custom_options_attributes_2_default_value", checked: false)- expect(page).to have_field("custom_field_custom_options_attributes_3_default_value", checked: true)- end-- it "shows the correct breadcrumbs" do- page.within_test_selector("custom-fields--page-header") do- expect(page).to have_css(".breadcrumb-item", text: "Work packages")- expect(page).to have_css(".breadcrumb-item.breadcrumb-item-selected", text: "Platform")- end- end-- context "with work packages using the options" do- before do- create_list(- :work_package_custom_value,- 3,- custom_field:,- value: custom_field.custom_options[1].id- )- end-- it "deletes a custom option and all values using it" do- within all(".custom-option-row")[1] do- accept_alert do- find(".icon-delete").click- end- end-- expect(page).to have_text("Option 'Xbox' and its 3 occurrences were deleted.")-- rows = all(".custom-option-value input")-- expect(rows.size).to be(3)-- expect(rows[0].value).to eql("Playstation")- expect(rows[1].value).to eql("Nintendo")- expect(rows[2].value).to eql("PC")- end- end- end-enddiff --git a/spec/support/pages/admin/custom_fields/custom_fields_projects/custom_field_projects_index.rb b/spec/support/pages/admin/custom_fields/custom_fields_projects/index.rbsimilarity index 74%rename from spec/support/pages/admin/custom_fields/custom_fields_projects/custom_field_projects_index.rbrename to spec/support/pages/admin/custom_fields/custom_fields_projects/index.rbindex 60d2322ea21..3684942b422 100644--- a/spec/support/pages/admin/custom_fields/custom_fields_projects/custom_field_projects_index.rb+++ b/spec/support/pages/admin/custom_fields/custom_fields_projects/index.rb@@ -28,26 +28,24 @@# See COPYRIGHT and LICENSE files for more details.#++-require "support/pages/projects/index"+require "support/pages/custom_fields/index_page"module Pagesmodule Adminmodule CustomFieldsmodule CustomFieldsProjects- class CustomFieldProjectsIndex < ::Pages::Projects::Index- def path(custom_field)- "/custom_fields/#{custom_field.id}/projects"+ class Index < ::Pages::CustomFields::IndexPage+ def path+ "/admin/settings/project_custom_fields"end- def within_row(project)- row = page.find("#{row_id_prefix}-#{project.id}")- row.hover- within row do- yield row- end- end+ def click_to_create_new_custom_field(type)+ wait_for_network_idle++ click_button "Add"- def row_id_prefix = "#admin-custom-fields-custom-field-projects-row-component-project"+ click_on type+ endendendenddiff --git a/spec/support/pages/admin/settings/project_custom_fields/project_custom_field_mappings_index.rb b/spec/support/pages/admin/custom_fields/custom_fields_projects/project_mappings.rbsimilarity index 86%rename from spec/support/pages/admin/settings/project_custom_fields/project_custom_field_mappings_index.rbrename to spec/support/pages/admin/custom_fields/custom_fields_projects/project_mappings.rbindex 44b3055d82c..326bb290b70 100644--- a/spec/support/pages/admin/settings/project_custom_fields/project_custom_field_mappings_index.rb+++ b/spec/support/pages/admin/custom_fields/custom_fields_projects/project_mappings.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-#-- copyright+# -- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH#@@ -26,15 +26,15 @@# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.## See COPYRIGHT and LICENSE files for more details.-#+++# ++-require "support/pages/projects/index"+require "support/pages/custom_fields/project_mappings"module Pagesmodule Admin- module Settings- module ProjectCustomFields- class ProjectCustomFieldMappingsIndex < ::Pages::Admin::CustomFields::CustomFieldsProjects::CustomFieldProjectsIndex+ module CustomFields+ module CustomFieldsProjects+ class ProjectMappings < ::Pages::CustomFields::ProjectMappingsdef path(project_custom_field)"/admin/settings/project_custom_fields/#{project_custom_field.id}/project_mappings"enddiff --git a/spec/support/pages/custom_fields/index_page.rb b/spec/support/pages/custom_fields/index_page.rbindex 82f5d60dd0d..f5154b2fecd 100644--- a/spec/support/pages/custom_fields/index_page.rb+++ b/spec/support/pages/custom_fields/index_page.rb@@ -44,10 +44,6 @@ module Pagesendend- def select_format(label)- select label, from: "custom_field_field_format"- end-def set_name(name)find_by_id("custom_field_name").set nameend@@ -63,6 +59,18 @@ module Pagesdef has_form_element?(name)page.has_css? "label.form--label", text: nameend++ def click_to_create_new_custom_field(type)+ wait_for_network_idle++ click_button "New custom field"++ click_on type+ end++ def expect_none_listed+ expect(page).to have_text("There are currently no custom fields.")+ endendendenddiff --git a/spec/support/pages/custom_fields/project_mappings.rb b/spec/support/pages/custom_fields/project_mappings.rbnew file mode 100644index 00000000000..5a7329d6122--- /dev/null+++ b/spec/support/pages/custom_fields/project_mappings.rb@@ -0,0 +1,51 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++require "support/pages/projects/index"++module Pages+ module CustomFields+ class ProjectMappings < ::Pages::Projects::Index+ def path(project_custom_field)+ "/custom_fields/#{project_custom_field.id}/projects"+ end++ def within_row(project)+ row = page.find("#{row_id_prefix}-#{project.id}")+ row.hover+ within row do+ yield row+ end+ end++ def row_id_prefix = "#admin-custom-fields-custom-field-projects-row-component-project"+ end+ end+end