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
removed feature flag as discussed with @oliverguenther
Jonas Jabari8685d3eb724a
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rbindex c229492a5db..9a34b25614f 100644--- a/app/controllers/custom_fields_controller.rb+++ b/app/controllers/custom_fields_controller.rb@@ -40,7 +40,7 @@ class CustomFieldsController < ApplicationController@custom_fields_by_type = CustomField.all.where.not(type: 'WorkPackageCustomField')# ProjectCustomFields now managed in a different UI- .tap { |query| query.where.not(type: 'ProjectCustomField') unless OpenProject::FeatureDecisions.project_attributes_active? }+ .tap { |query| query.where.not(type: 'ProjectCustomField') }.group_by { |f| f.class.name }@custom_fields_by_type['WorkPackageCustomField'] = WorkPackageCustomField.includes(:types).all@@ -80,9 +80,7 @@ class CustomFieldsController < ApplicationControllerdef check_custom_field# ProjecCustomFields now managed in a different UI- if- OpenProject::FeatureDecisions.project_attributes_active? &&- (@custom_field.nil? || @custom_field.type == 'ProjectCustomField')+ if @custom_field.nil? || @custom_field.type == 'ProjectCustomField'flash[:error] = 'Invalid CF type'redirect_to action: :indexenddiff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rbindex 873052d234a..b82a181d1b4 100644--- a/app/helpers/custom_fields_helper.rb+++ b/app/helpers/custom_fields_helper.rb@@ -28,7 +28,7 @@module CustomFieldsHelperdef custom_fields_tabs- tabs = [+ [{name: 'WorkPackageCustomField',partial: 'custom_fields/tab',@@ -41,13 +41,6 @@ module CustomFieldsHelperpath: custom_fields_path(tab: :TimeEntryCustomField),label: :label_spent_time},-- {- name: 'ProjectCustomField',- partial: 'custom_fields/tab',- path: custom_fields_path(tab: :ProjectCustomField),- label: :label_project_plural- },{name: 'VersionCustomField',partial: 'custom_fields/tab',@@ -67,11 +60,6 @@ module CustomFieldsHelperlabel: :label_group_plural}]-- # ProjecCustomFields now managed in a different UI- tabs.delete_if { |tab| tab[:name] == 'ProjectCustomField' && OpenProject::FeatureDecisions.project_attributes_active? }-- tabsend# Return custom field html tag corresponding to its formatdiff --git a/app/models/project.rb b/app/models/project.rbindex 3c088d7409c..d92a7c22307 100644--- a/app/models/project.rb+++ b/app/models/project.rb@@ -36,9 +36,7 @@ class Project < ApplicationRecordinclude ::Scopes::Scoped- if OpenProject::FeatureDecisions.project_attributes_active?- include Projects::ActsAsCustomizablePatches- end+ include Projects::ActsAsCustomizablePatches# Maximum length for project identifiersIDENTIFIER_MAX_LENGTH = 100diff --git a/app/views/custom_fields/_form.html.erb b/app/views/custom_fields/_form.html.erbindex c9033425b5f..c8d6cd1a10a 100644--- a/app/views/custom_fields/_form.html.erb+++ b/app/views/custom_fields/_form.html.erb@@ -30,7 +30,7 @@ See COPYRIGHT and LICENSE files for more details.<div class="form--field -required" id="custom_field_name_attributes"><%= f.text_field :name, required: true, container_class: '-middle' %></div>- <% if @custom_field.type == 'ProjectCustomField' && OpenProject::FeatureDecisions.project_attributes_active? %>+ <% if @custom_field.type == 'ProjectCustomField' %><div class="form--field"><%= f.select :custom_field_section_id,ProjectCustomFieldSection.all.collect { |s| [s.name, s.id] },diff --git a/config/initializers/menus.rb b/config/initializers/menus.rbindex 5cacde0fa89..f3fb236594c 100644--- a/config/initializers/menus.rb+++ b/config/initializers/menus.rb@@ -330,25 +330,17 @@ Redmine::MenuManager.map :admin_menu do |menu|caption: Proc.new { Workflow.model_name.human },parent: :admin_work_packages- if OpenProject::FeatureDecisions.project_attributes_active?- menu.push :admin_projects_settings,- { controller: '/admin/settings/project_custom_fields', action: :index },- if: Proc.new { User.current.admin? },- caption: :label_project_plural,- icon: 'projects'-- menu.push :project_custom_fields_settings,- { controller: '/admin/settings/project_custom_fields', action: :index },- if: Proc.new { User.current.admin? },- caption: :label_project_attributes_plural,- parent: :admin_projects_settings- else- menu.push :admin_projects_settings,- { controller: '/admin/settings/projects_settings', action: :show },- if: Proc.new { User.current.admin? },- caption: :label_project_plural,- icon: 'projects'- end+ menu.push :admin_projects_settings,+ { controller: '/admin/settings/project_custom_fields', action: :index },+ if: Proc.new { User.current.admin? },+ caption: :label_project_plural,+ icon: 'projects'++ menu.push :project_custom_fields_settings,+ { controller: '/admin/settings/project_custom_fields', action: :index },+ if: Proc.new { User.current.admin? },+ caption: :label_project_attributes_plural,+ parent: :admin_projects_settingsmenu.push :projects_settings,{ controller: '/admin/settings/projects_settings', action: :show },@@ -623,6 +615,7 @@ Redmine::MenuManager.map :project_menu do |menu|project_menu_items = {general: :label_information_plural,+ project_custom_fields: :label_project_attributes_plural,modules: :label_module_plural,types: :label_work_package_types,custom_fields: :label_custom_field_plural,@@ -633,10 +626,6 @@ Redmine::MenuManager.map :project_menu do |menu|storage: :label_required_disk_storage}- if OpenProject::FeatureDecisions.project_attributes_active?- project_menu_items = project_menu_items.to_a.insert(1, %i[project_custom_fields label_project_attributes_plural]).to_h- end-project_menu_items.each do |key, caption|menu.push :"settings_#{key}",{ controller: "/projects/settings/#{key}", action: 'show' },diff --git a/docker/pullpreview/docker-compose.yml b/docker/pullpreview/docker-compose.ymlindex 528af54590d..f4879929d17 100644--- a/docker/pullpreview/docker-compose.yml+++ b/docker/pullpreview/docker-compose.yml@@ -25,7 +25,6 @@ x-defaults: &defaults- "OPENPROJECT_RAILS__CACHE__STORE=file_store"- "RAILS_ENV=production"- "SECRET_KEY_BASE=d4e74f017910ac56c6ebad01165b7e1b37f4c9c02e9716836f8670cdc8d65a231e64e4f6416b19c8"- - "OPENPROJECT_FEATURE_PROJECT_ATTRIBUTES_ACTIVE=true"networks:- backenddiff --git a/modules/overviews/app/controllers/overviews/overviews_controller.rb b/modules/overviews/app/controllers/overviews/overviews_controller.rbindex 01f7b480927..fb60ac5f3c1 100644--- a/modules/overviews/app/controllers/overviews/overviews_controller.rb+++ b/modules/overviews/app/controllers/overviews/overviews_controller.rb@@ -4,8 +4,6 @@ module ::Overviewsbefore_action :authorizebefore_action :jump_to_project_menu_item- before_action :check_project_attributes_feature_enabled,- only: %i[project_custom_fields_sidebar project_custom_field_section_dialog update_project_custom_values]menu_item :overview@@ -63,10 +61,6 @@ module ::Overviewsprivate- def check_project_attributes_feature_enabled- render_404 unless OpenProject::FeatureDecisions.project_attributes_active?- end-def pre_process(project_params)# TODO: find better solution for this:# quick fixing wrong submit format of multi user custom fields, should be fixed on the frontend sidediff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/inputs_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/inputs_spec.rbindex da39c3bc241..549b10d15c4 100644--- a/spec/features/projects/project_custom_fields/overview_page/dialog/inputs_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/inputs_spec.rb@@ -34,581 +34,579 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:overview_page) { Pages::Projects::Show.new(project) }- describe 'with enabled project attributes feature', with_flag: { project_attributes: true } do- before do- login_as member_with_project_edit_permissions- overview_page.visit_page- end+ before do+ login_as member_with_project_edit_permissions+ overview_page.visit_page+ end- describe 'with correct initialization and input behaviour' do- describe 'with input fields' do- let(:section) { section_for_input_fields }- let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }+ describe 'with correct initialization and input behaviour' do+ describe 'with input fields' do+ let(:section) { section_for_input_fields }+ let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a custom field checkbox' do- it 'shows the correct value if given' do- overview_page.open_edit_dialog_for_section(section)+ shared_examples 'a custom field checkbox' do+ it 'shows the correct value if given' do+ overview_page.open_edit_dialog_for_section(section)- dialog.within_async_content(close_after_yield: true) do- if expected_initial_value- expect(page).to have_checked_field(custom_field.name)- else- expect(page).to have_no_checked_field(custom_field.name)- end+ dialog.within_async_content(close_after_yield: true) do+ if expected_initial_value+ expect(page).to have_checked_field(custom_field.name)+ else+ expect(page).to have_no_checked_field(custom_field.name)endend+ end- it 'is unchecked if no value and no default value is given' do- custom_field.custom_values.destroy_all+ it 'is unchecked if no value and no default value is given' do+ custom_field.custom_values.destroy_all- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- dialog.within_async_content(close_after_yield: true) do- expect(page).to have_no_checked_field(custom_field.name)- end+ dialog.within_async_content(close_after_yield: true) do+ expect(page).to have_no_checked_field(custom_field.name)end+ end- it 'shows default value if no value is given' do- custom_field.custom_values.destroy_all+ it 'shows default value if no value is given' do+ custom_field.custom_values.destroy_all- custom_field.update!(default_value: true)+ custom_field.update!(default_value: true)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- dialog.within_async_content(close_after_yield: true) do- expect(page).to have_checked_field(custom_field.name)- end+ dialog.within_async_content(close_after_yield: true) do+ expect(page).to have_checked_field(custom_field.name)+ end- custom_field.update!(default_value: false)+ custom_field.update!(default_value: false)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- dialog.within_async_content(close_after_yield: true) do- expect(page).to have_no_checked_field(custom_field.name)- end+ dialog.within_async_content(close_after_yield: true) do+ expect(page).to have_no_checked_field(custom_field.name)endend+ end- shared_examples 'a custom field input' do- it 'shows the correct value if given' do- overview_page.open_edit_dialog_for_section(section)+ shared_examples 'a custom field input' do+ it 'shows the correct value if given' do+ overview_page.open_edit_dialog_for_section(section)- dialog.within_async_content(close_after_yield: true) do- expect(page).to have_field(custom_field.name, with: expected_initial_value)- end+ dialog.within_async_content(close_after_yield: true) do+ expect(page).to have_field(custom_field.name, with: expected_initial_value)end+ end- it 'shows a blank input if no value or default value is given' do- custom_field.custom_values.destroy_all+ it 'shows a blank input if no value or default value is given' do+ custom_field.custom_values.destroy_all- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- dialog.within_async_content(close_after_yield: true) do- expect(page).to have_field(custom_field.name, with: expected_blank_value)- end+ dialog.within_async_content(close_after_yield: true) do+ expect(page).to have_field(custom_field.name, with: expected_blank_value)end+ end- it 'shows the default value if no value is given' do- custom_field.custom_values.destroy_all- custom_field.update!(default_value:)+ it 'shows the default value if no value is given' do+ custom_field.custom_values.destroy_all+ custom_field.update!(default_value:)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- dialog.within_async_content(close_after_yield: true) do- expect(page).to have_field(custom_field.name, with: default_value)- end+ dialog.within_async_content(close_after_yield: true) do+ expect(page).to have_field(custom_field.name, with: default_value)endend+ end- shared_examples 'a rich text custom field input' do- it 'shows the correct value if given' do- overview_page.open_edit_dialog_for_section(section)+ shared_examples 'a rich text custom field input' do+ it 'shows the correct value if given' do+ overview_page.open_edit_dialog_for_section(section)- dialog.within_async_content(close_after_yield: true) do- field.expect_value(expected_initial_value)- end+ dialog.within_async_content(close_after_yield: true) do+ field.expect_value(expected_initial_value)end+ end- it 'shows a blank input if no value or default value is given' do- custom_field.custom_values.destroy_all+ it 'shows a blank input if no value or default value is given' do+ custom_field.custom_values.destroy_all- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- dialog.within_async_content(close_after_yield: true) do- field.expect_value(expected_blank_value)- end+ dialog.within_async_content(close_after_yield: true) do+ field.expect_value(expected_blank_value)end+ end- it 'shows the default value if no value is given' do- custom_field.custom_values.destroy_all- custom_field.update!(default_value:)+ it 'shows the default value if no value is given' do+ custom_field.custom_values.destroy_all+ custom_field.update!(default_value:)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- dialog.within_async_content(close_after_yield: true) do- field.expect_value(default_value)- end+ dialog.within_async_content(close_after_yield: true) do+ field.expect_value(default_value)endend+ end- describe 'with boolean CF' do- let(:custom_field) { boolean_project_custom_field }- let(:default_value) { false }- let(:expected_blank_value) { false }- let(:expected_initial_value) { true }+ describe 'with boolean CF' do+ let(:custom_field) { boolean_project_custom_field }+ let(:default_value) { false }+ let(:expected_blank_value) { false }+ let(:expected_initial_value) { true }- it_behaves_like 'a custom field checkbox'- end+ it_behaves_like 'a custom field checkbox'+ end- describe 'with string CF' do- let(:custom_field) { string_project_custom_field }- let(:default_value) { 'Default value' }- let(:expected_blank_value) { '' }- let(:expected_initial_value) { 'Foo' }+ describe 'with string CF' do+ let(:custom_field) { string_project_custom_field }+ let(:default_value) { 'Default value' }+ let(:expected_blank_value) { '' }+ let(:expected_initial_value) { 'Foo' }- it_behaves_like 'a custom field input'- end+ it_behaves_like 'a custom field input'+ end- describe 'with integer CF' do- let(:custom_field) { integer_project_custom_field }- let(:default_value) { 789 }- let(:expected_blank_value) { '' }- let(:expected_initial_value) { 123 }+ describe 'with integer CF' do+ let(:custom_field) { integer_project_custom_field }+ let(:default_value) { 789 }+ let(:expected_blank_value) { '' }+ let(:expected_initial_value) { 123 }- it_behaves_like 'a custom field input'- end+ it_behaves_like 'a custom field input'+ end- describe 'with float CF' do- let(:custom_field) { float_project_custom_field }- let(:default_value) { 789.123 }- let(:expected_blank_value) { '' }- let(:expected_initial_value) { 123.456 }+ describe 'with float CF' do+ let(:custom_field) { float_project_custom_field }+ let(:default_value) { 789.123 }+ let(:expected_blank_value) { '' }+ let(:expected_initial_value) { 123.456 }- it_behaves_like 'a custom field input'- end+ it_behaves_like 'a custom field input'+ end- describe 'with date CF' do- let(:custom_field) { date_project_custom_field }- let(:default_value) { Date.new(2026, 1, 1) }- let(:expected_blank_value) { '' }- let(:expected_initial_value) { Date.new(2024, 1, 1) }+ describe 'with date CF' do+ let(:custom_field) { date_project_custom_field }+ let(:default_value) { Date.new(2026, 1, 1) }+ let(:expected_blank_value) { '' }+ let(:expected_initial_value) { Date.new(2024, 1, 1) }- it_behaves_like 'a custom field input'- end+ it_behaves_like 'a custom field input'+ end- describe 'with text CF' do- let(:custom_field) { text_project_custom_field }- let(:field) { FormFields::Primerized::EditorFormField.new(custom_field) }- let(:default_value) { 'Default value' }- let(:expected_blank_value) { '' }- let(:expected_initial_value) { "Lorem\nipsum" } # TBD: why is the second newline missing?+ describe 'with text CF' do+ let(:custom_field) { text_project_custom_field }+ let(:field) { FormFields::Primerized::EditorFormField.new(custom_field) }+ let(:default_value) { 'Default value' }+ let(:expected_blank_value) { '' }+ let(:expected_initial_value) { "Lorem\nipsum" } # TBD: why is the second newline missing?- it_behaves_like 'a rich text custom field input'- end+ it_behaves_like 'a rich text custom field input'end+ end- describe 'with single select fields' do- let(:section) { section_for_select_fields }- let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }+ describe 'with single select fields' do+ let(:section) { section_for_select_fields }+ let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a autocomplete single select field' do- it 'shows the correct value if given' do- overview_page.open_edit_dialog_for_section(section)+ shared_examples 'a autocomplete single select field' do+ it 'shows the correct value if given' do+ overview_page.open_edit_dialog_for_section(section)- field.expect_selected(expected_initial_value)- end+ field.expect_selected(expected_initial_value)+ end- it 'shows a blank input if no value or default value is given' do- custom_field.custom_values.destroy_all+ it 'shows a blank input if no value or default value is given' do+ custom_field.custom_values.destroy_all- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.expect_blank- end+ field.expect_blank+ end- it 'filters the list based on the input' do- overview_page.open_edit_dialog_for_section(section)+ it 'filters the list based on the input' do+ overview_page.open_edit_dialog_for_section(section)- field.search(second_option)+ field.search(second_option)- field.expect_option(second_option)- field.expect_no_option(first_option)- field.expect_no_option(third_option)- end+ field.expect_option(second_option)+ field.expect_no_option(first_option)+ field.expect_no_option(third_option)+ end- it 'enables the user to select a single value from a list' do- overview_page.open_edit_dialog_for_section(section)+ it 'enables the user to select a single value from a list' do+ overview_page.open_edit_dialog_for_section(section)- field.search(second_option)- field.select_option(second_option)+ field.search(second_option)+ field.select_option(second_option)- field.expect_selected(second_option)+ field.expect_selected(second_option)- field.search(third_option)- field.select_option(third_option)+ field.search(third_option)+ field.select_option(third_option)- field.expect_selected(third_option)- field.expect_not_selected(second_option)- end+ field.expect_selected(third_option)+ field.expect_not_selected(second_option)+ end- it 'clears the input if clicked on the clear button' do- overview_page.open_edit_dialog_for_section(section)+ it 'clears the input if clicked on the clear button' do+ overview_page.open_edit_dialog_for_section(section)- field.clear+ field.clear- field.expect_blank- end+ field.expect_blankend+ end- describe 'with single select list CF' do- let(:custom_field) { list_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with single select list CF' do+ let(:custom_field) { list_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:expected_initial_value) { custom_field.custom_options.first.value }+ let(:expected_initial_value) { custom_field.custom_options.first.value }- let(:first_option) { custom_field.custom_options.first.value }- let(:second_option) { custom_field.custom_options.second.value }- let(:third_option) { custom_field.custom_options.third.value }+ let(:first_option) { custom_field.custom_options.first.value }+ let(:second_option) { custom_field.custom_options.second.value }+ let(:third_option) { custom_field.custom_options.third.value }- it_behaves_like 'a autocomplete single select field'+ it_behaves_like 'a autocomplete single select field'- it 'shows the default value if no value is given' do- custom_field.custom_values.destroy_all+ it 'shows the default value if no value is given' do+ custom_field.custom_values.destroy_all- custom_field.custom_options.first.update!(default_value: true)+ custom_field.custom_options.first.update!(default_value: true)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.expect_selected(custom_field.custom_options.first.value)- end+ field.expect_selected(custom_field.custom_options.first.value)end+ end- describe 'with single version select list CF' do- let(:custom_field) { version_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with single version select list CF' do+ let(:custom_field) { version_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:expected_initial_value) { first_version.name }+ let(:expected_initial_value) { first_version.name }- let(:first_option) { first_version.name }- let(:second_option) { second_version.name }- let(:third_option) { third_version.name }+ let(:first_option) { first_version.name }+ let(:second_option) { second_version.name }+ let(:third_option) { third_version.name }- it_behaves_like 'a autocomplete single select field'+ it_behaves_like 'a autocomplete single select field'- describe 'with correct version scoping' do- let!(:version_in_other_project) do- create(:version, name: 'Version 1 in other project', project: other_project)- end+ describe 'with correct version scoping' do+ let!(:version_in_other_project) do+ create(:version, name: 'Version 1 in other project', project: other_project)+ end- it 'shows only versions that are associated with this project' do- overview_page.open_edit_dialog_for_section(section)+ it 'shows only versions that are associated with this project' do+ overview_page.open_edit_dialog_for_section(section)- field.search('Version 1')+ field.search('Version 1')- field.expect_option(first_version.name)- field.expect_no_option(version_in_other_project.name)- end+ field.expect_option(first_version.name)+ field.expect_no_option(version_in_other_project.name)endend+ end- describe 'with single user select list CF' do- let(:custom_field) { user_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with single user select list CF' do+ let(:custom_field) { user_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:expected_initial_value) { member_in_project.name }+ let(:expected_initial_value) { member_in_project.name }- let(:first_option) { member_in_project.name }- let(:second_option) { another_member_in_project.name }- let(:third_option) { one_more_member_in_project.name }+ let(:first_option) { member_in_project.name }+ let(:second_option) { another_member_in_project.name }+ let(:third_option) { one_more_member_in_project.name }- it_behaves_like 'a autocomplete single select field'+ it_behaves_like 'a autocomplete single select field'- describe 'with correct user scoping' do- let!(:member_in_other_project) do- create(:user,- firstname: 'Member 1',- lastname: 'In other Project',- member_with_roles: { other_project => reader_role })- end+ describe 'with correct user scoping' do+ let!(:member_in_other_project) do+ create(:user,+ firstname: 'Member 1',+ lastname: 'In other Project',+ member_with_roles: { other_project => reader_role })+ end- it 'shows only users that are members of the project' do- overview_page.open_edit_dialog_for_section(section)+ it 'shows only users that are members of the project' do+ overview_page.open_edit_dialog_for_section(section)- field.search('Member 1')+ field.search('Member 1')- field.expect_option(member_in_project.name)- field.expect_no_option(member_in_other_project.name)- end+ field.expect_option(member_in_project.name)+ field.expect_no_option(member_in_other_project.name)end+ end- describe 'with support for user groups' do- let!(:member_in_other_project) do- create(:user,- firstname: 'Member 1',- lastname: 'In other Project',- member_with_roles: { other_project => reader_role })- end- let!(:group) do- create(:group, name: 'Group 1 in project',- member_with_roles: { project => reader_role })- end- let!(:group_in_other_project) do- create(:group, name: 'Group 1 in other project', members: [member_in_other_project],- member_with_roles: { other_project => reader_role })- end+ describe 'with support for user groups' do+ let!(:member_in_other_project) do+ create(:user,+ firstname: 'Member 1',+ lastname: 'In other Project',+ member_with_roles: { other_project => reader_role })+ end+ let!(:group) do+ create(:group, name: 'Group 1 in project',+ member_with_roles: { project => reader_role })+ end+ let!(:group_in_other_project) do+ create(:group, name: 'Group 1 in other project', members: [member_in_other_project],+ member_with_roles: { other_project => reader_role })+ end- it 'shows only groups that are associated with this project' do- overview_page.open_edit_dialog_for_section(section)+ it 'shows only groups that are associated with this project' do+ overview_page.open_edit_dialog_for_section(section)- field.search('Group 1')+ field.search('Group 1')- field.expect_option(group.name)- field.expect_no_option(group_in_other_project.name)- end+ field.expect_option(group.name)+ field.expect_no_option(group_in_other_project.name)end+ end- describe 'with support for placeholder users' do- let!(:placeholder_user) do- create(:placeholder_user, name: 'Placeholder User',- member_with_roles: { project => reader_role })- end+ describe 'with support for placeholder users' do+ let!(:placeholder_user) do+ create(:placeholder_user, name: 'Placeholder User',+ member_with_roles: { project => reader_role })+ end- it 'shows the placeholder user' do- overview_page.open_edit_dialog_for_section(section)+ it 'shows the placeholder user' do+ overview_page.open_edit_dialog_for_section(section)- field.search('Placeholder User')+ field.search('Placeholder User')- field.expect_option(placeholder_user.name)- end+ field.expect_option(placeholder_user.name)endendend+ end- describe 'with multi select fields' do- let(:section) { section_for_multi_select_fields }- let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }+ describe 'with multi select fields' do+ let(:section) { section_for_multi_select_fields }+ let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a autocomplete multi select field' do- it 'shows the correct value if given' do- overview_page.open_edit_dialog_for_section(section)+ shared_examples 'a autocomplete multi select field' do+ it 'shows the correct value if given' do+ overview_page.open_edit_dialog_for_section(section)- field.expect_selected(*expected_initial_value)- end+ field.expect_selected(*expected_initial_value)+ end- it 'shows a blank input if no value or default value is given' do- custom_field.custom_values.destroy_all+ it 'shows a blank input if no value or default value is given' do+ custom_field.custom_values.destroy_all- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.expect_blank- end+ field.expect_blank+ end- it 'filters the list based on the input' do- overview_page.open_edit_dialog_for_section(section)+ it 'filters the list based on the input' do+ overview_page.open_edit_dialog_for_section(section)- field.search(second_option)+ field.search(second_option)- field.expect_option(second_option)- field.expect_no_option(first_option)- field.expect_no_option(third_option)- end+ field.expect_option(second_option)+ field.expect_no_option(first_option)+ field.expect_no_option(third_option)+ end- it 'allows to select multiple values' do- custom_field.custom_values.destroy_all+ it 'allows to select multiple values' do+ custom_field.custom_values.destroy_all- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.select_option(second_option)- field.select_option(third_option)+ field.select_option(second_option)+ field.select_option(third_option)- field.expect_selected(second_option)- field.expect_selected(third_option)- end+ field.expect_selected(second_option)+ field.expect_selected(third_option)+ end- it 'allows to remove selected values' do- custom_field.custom_values.destroy_all+ it 'allows to remove selected values' do+ custom_field.custom_values.destroy_all- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.select_option(second_option)- field.select_option(third_option)+ field.select_option(second_option)+ field.select_option(third_option)- field.deselect_option(third_option)+ field.deselect_option(third_option)- field.expect_selected(second_option)- field.expect_not_selected(third_option)- end+ field.expect_selected(second_option)+ field.expect_not_selected(third_option)+ end- it 'allows to remove all selected values at once' do- custom_field.custom_values.destroy_all+ it 'allows to remove all selected values at once' do+ custom_field.custom_values.destroy_all- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.select_option(second_option)- field.select_option(third_option)+ field.select_option(second_option)+ field.select_option(third_option)- field.clear+ field.clear- field.expect_not_selected(second_option)- field.expect_not_selected(third_option)- end+ field.expect_not_selected(second_option)+ field.expect_not_selected(third_option)end+ end- describe 'with multi select list CF' do- let(:custom_field) { multi_list_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with multi select list CF' do+ let(:custom_field) { multi_list_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:expected_initial_value) { [custom_field.custom_options.first.value, custom_field.custom_options.second.value] }+ let(:expected_initial_value) { [custom_field.custom_options.first.value, custom_field.custom_options.second.value] }- let(:first_option) { custom_field.custom_options.first.value }- let(:second_option) { custom_field.custom_options.second.value }- let(:third_option) { custom_field.custom_options.third.value }+ let(:first_option) { custom_field.custom_options.first.value }+ let(:second_option) { custom_field.custom_options.second.value }+ let(:third_option) { custom_field.custom_options.third.value }- it_behaves_like 'a autocomplete multi select field'+ it_behaves_like 'a autocomplete multi select field'- it 'shows the default value if no value is given' do- multi_list_project_custom_field.custom_values.destroy_all+ it 'shows the default value if no value is given' do+ multi_list_project_custom_field.custom_values.destroy_all- multi_list_project_custom_field.custom_options.first.update!(default_value: true)- multi_list_project_custom_field.custom_options.second.update!(default_value: true)+ multi_list_project_custom_field.custom_options.first.update!(default_value: true)+ multi_list_project_custom_field.custom_options.second.update!(default_value: true)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.expect_selected(multi_list_project_custom_field.custom_options.first.value)- field.expect_selected(multi_list_project_custom_field.custom_options.second.value)- end+ field.expect_selected(multi_list_project_custom_field.custom_options.first.value)+ field.expect_selected(multi_list_project_custom_field.custom_options.second.value)end+ end- describe 'with multi version select list CF' do- let(:custom_field) { multi_version_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with multi version select list CF' do+ let(:custom_field) { multi_version_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:expected_initial_value) { [first_version.name, second_version.name] }+ let(:expected_initial_value) { [first_version.name, second_version.name] }- let(:first_option) { first_version.name }- let(:second_option) { second_version.name }- let(:third_option) { third_version.name }+ let(:first_option) { first_version.name }+ let(:second_option) { second_version.name }+ let(:third_option) { third_version.name }- it_behaves_like 'a autocomplete multi select field'+ it_behaves_like 'a autocomplete multi select field'- describe 'with correct version scoping' do- let!(:version_in_other_project) do- create(:version, name: 'Version 1 in other project', project: other_project)- end+ describe 'with correct version scoping' do+ let!(:version_in_other_project) do+ create(:version, name: 'Version 1 in other project', project: other_project)+ end- it 'shows only versions that are associated with this project' do- overview_page.open_edit_dialog_for_section(section)+ it 'shows only versions that are associated with this project' do+ overview_page.open_edit_dialog_for_section(section)- field.search('Version 1')+ field.search('Version 1')- field.expect_option(first_version.name)- field.expect_no_option(version_in_other_project.name)- end+ field.expect_option(first_version.name)+ field.expect_no_option(version_in_other_project.name)endend+ end- describe 'with multi user select list CF' do- let(:custom_field) { multi_user_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with multi user select list CF' do+ let(:custom_field) { multi_user_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:expected_initial_value) { [member_in_project.name, another_member_in_project.name] }+ let(:expected_initial_value) { [member_in_project.name, another_member_in_project.name] }- let(:first_option) { member_in_project.name }- let(:second_option) { another_member_in_project.name }- let(:third_option) { one_more_member_in_project.name }+ let(:first_option) { member_in_project.name }+ let(:second_option) { another_member_in_project.name }+ let(:third_option) { one_more_member_in_project.name }- it_behaves_like 'a autocomplete multi select field'+ it_behaves_like 'a autocomplete multi select field'- describe 'with correct user scoping' do- let!(:member_in_other_project) do- create(:user,- firstname: 'Member 1',- lastname: 'In other Project',- member_with_roles: { other_project => reader_role })- end+ describe 'with correct user scoping' do+ let!(:member_in_other_project) do+ create(:user,+ firstname: 'Member 1',+ lastname: 'In other Project',+ member_with_roles: { other_project => reader_role })+ end- it 'shows only users that are members of the project' do- overview_page.open_edit_dialog_for_section(section)+ it 'shows only users that are members of the project' do+ overview_page.open_edit_dialog_for_section(section)- field.search('Member 1')+ field.search('Member 1')- field.expect_option(member_in_project.name)- field.expect_no_option(member_in_other_project.name)- end+ field.expect_option(member_in_project.name)+ field.expect_no_option(member_in_other_project.name)end+ end- describe 'with support for user groups' do- let!(:member_in_other_project) do- create(:user,- firstname: 'Member 1',- lastname: 'In other Project',- member_with_roles: { other_project => reader_role })- end- let!(:group) do- create(:group, name: 'Group 1 in project',- member_with_roles: { project => reader_role })- end- let!(:another_group) do- create(:group, name: 'Group 2 in project',- member_with_roles: { project => reader_role })- end- let!(:group_in_other_project) do- create(:group, name: 'Group 1 in other project', members: [member_in_other_project],- member_with_roles: { other_project => reader_role })- end+ describe 'with support for user groups' do+ let!(:member_in_other_project) do+ create(:user,+ firstname: 'Member 1',+ lastname: 'In other Project',+ member_with_roles: { other_project => reader_role })+ end+ let!(:group) do+ create(:group, name: 'Group 1 in project',+ member_with_roles: { project => reader_role })+ end+ let!(:another_group) do+ create(:group, name: 'Group 2 in project',+ member_with_roles: { project => reader_role })+ end+ let!(:group_in_other_project) do+ create(:group, name: 'Group 1 in other project', members: [member_in_other_project],+ member_with_roles: { other_project => reader_role })+ end- it 'shows only groups that are associated with this project' do- overview_page.open_edit_dialog_for_section(section)+ it 'shows only groups that are associated with this project' do+ overview_page.open_edit_dialog_for_section(section)- field.search('Group 1')- field.expect_option(group.name)- field.expect_no_option(group_in_other_project.name)- end+ field.search('Group 1')+ field.expect_option(group.name)+ field.expect_no_option(group_in_other_project.name)+ end- it 'enables to select multiple user groups' do- overview_page.open_edit_dialog_for_section(section)+ it 'enables to select multiple user groups' do+ overview_page.open_edit_dialog_for_section(section)- field.select_option('Group 1 in project')- field.select_option('Group 2 in project')+ field.select_option('Group 1 in project')+ field.select_option('Group 2 in project')- field.expect_selected('Group 1 in project')- field.expect_selected('Group 2 in project')- end+ field.expect_selected('Group 1 in project')+ field.expect_selected('Group 2 in project')end+ end- describe 'with support for placeholder users' do- let!(:placeholder_user) do- create(:placeholder_user, name: 'Placeholder user',- member_with_roles: { project => reader_role })- end- let!(:another_placeholder_user) do- create(:placeholder_user, name: 'Another placeholder User',- member_with_roles: { project => reader_role })- end- let!(:placeholder_user_in_other_project) do- create(:placeholder_user, name: 'Placeholder user in other project',- member_with_roles: { other_project => reader_role })- end+ describe 'with support for placeholder users' do+ let!(:placeholder_user) do+ create(:placeholder_user, name: 'Placeholder user',+ member_with_roles: { project => reader_role })+ end+ let!(:another_placeholder_user) do+ create(:placeholder_user, name: 'Another placeholder User',+ member_with_roles: { project => reader_role })+ end+ let!(:placeholder_user_in_other_project) do+ create(:placeholder_user, name: 'Placeholder user in other project',+ member_with_roles: { other_project => reader_role })+ end- it 'shows only placeholder users from this project' do- overview_page.open_edit_dialog_for_section(section)+ it 'shows only placeholder users from this project' do+ overview_page.open_edit_dialog_for_section(section)- field.search('Placeholder User')+ field.search('Placeholder User')- field.expect_option(placeholder_user.name)- field.expect_option(another_placeholder_user.name)- field.expect_no_option(placeholder_user_in_other_project.name)- end+ field.expect_option(placeholder_user.name)+ field.expect_option(another_placeholder_user.name)+ field.expect_no_option(placeholder_user_in_other_project.name)+ end- it 'enables to select multiple placeholder users' do- overview_page.open_edit_dialog_for_section(section)+ it 'enables to select multiple placeholder users' do+ overview_page.open_edit_dialog_for_section(section)- field.select_option(placeholder_user.name)- field.select_option(another_placeholder_user.name)+ field.select_option(placeholder_user.name)+ field.select_option(another_placeholder_user.name)- field.expect_selected(placeholder_user.name)- field.expect_selected(another_placeholder_user.name)- end+ field.expect_selected(placeholder_user.name)+ field.expect_selected(another_placeholder_user.name)endendenddiff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rbindex 2e6b353ff5b..60c7414eaf9 100644--- a/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/permission_spec.rb@@ -34,33 +34,31 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:overview_page) { Pages::Projects::Show.new(project) }- describe 'with enabled project attributes feature', with_flag: { project_attributes: true } do- describe 'with insufficient permissions' do- # turboframe sidebar request is covered by a controller spec checking for 403- # async dialog content request is be covered by a controller spec checking for 403- # via spec/permissions/manage_project_custom_values_spec.rb- before do- login_as member_without_project_edit_permissions- overview_page.visit_page- end+ describe 'with insufficient permissions' do+ # turboframe sidebar request is covered by a controller spec checking for 403+ # async dialog content request is be covered by a controller spec checking for 403+ # via spec/permissions/manage_project_custom_values_spec.rb+ before do+ login_as member_without_project_edit_permissions+ overview_page.visit_page+ end- it 'does not show the edit buttons' do- overview_page.within_async_loaded_sidebar do- expect(page).to have_no_css("[data-qa-selector='project-custom-field-section-edit-button']")- end+ it 'does not show the edit buttons' do+ overview_page.within_async_loaded_sidebar do+ expect(page).to have_no_css("[data-qa-selector='project-custom-field-section-edit-button']")endend+ end- describe 'with sufficient permissions' do- before do- login_as member_with_project_edit_permissions- overview_page.visit_page- end+ describe 'with sufficient permissions' do+ before do+ login_as member_with_project_edit_permissions+ overview_page.visit_page+ end- it 'shows the edit buttons' do- overview_page.within_async_loaded_sidebar do- expect(page).to have_css("[data-qa-selector='project-custom-field-section-edit-button']", count: 3)- end+ it 'shows the edit buttons' do+ overview_page.within_async_loaded_sidebar do+ expect(page).to have_css("[data-qa-selector='project-custom-field-section-edit-button']", count: 3)endendenddiff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rbindex 0afdd15017c..86c4772d16f 100644--- a/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rb@@ -33,113 +33,110 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doinclude_context 'with seeded projects, members and project custom fields'let(:overview_page) { Pages::Projects::Show.new(project) }+ let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section_for_input_fields) }- describe 'with enabled project attributes feature', with_flag: { project_attributes: true } do- before do- login_as member_with_project_edit_permissions- overview_page.visit_page- end-- let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section_for_input_fields) }+ before do+ login_as member_with_project_edit_permissions+ overview_page.visit_page+ end- it 'opens a dialog showing inputs for project custom fields of a specific section' do- overview_page.open_edit_dialog_for_section(section_for_input_fields)+ it 'opens a dialog showing inputs for project custom fields of a specific section' do+ overview_page.open_edit_dialog_for_section(section_for_input_fields)- dialog.expect_open- end+ dialog.expect_open+ end- it 'renders the dialog body asynchronically' do- expect(page).to have_no_css(dialog.async_content_container_css_selector, visible: :all)+ it 'renders the dialog body asynchronically' do+ expect(page).to have_no_css(dialog.async_content_container_css_selector, visible: :all)- overview_page.open_edit_dialog_for_section(section_for_input_fields)+ overview_page.open_edit_dialog_for_section(section_for_input_fields)- expect(page).to have_css(dialog.async_content_container_css_selector, visible: :visible)- end+ expect(page).to have_css(dialog.async_content_container_css_selector, visible: :visible)+ end- it 'can be closed via close icon or cancel button' do- overview_page.open_edit_dialog_for_section(section_for_input_fields)+ it 'can be closed via close icon or cancel button' do+ overview_page.open_edit_dialog_for_section(section_for_input_fields)- dialog.close_via_icon+ dialog.close_via_icon- dialog.expect_closed+ dialog.expect_closed- overview_page.open_edit_dialog_for_section(section_for_input_fields)+ overview_page.open_edit_dialog_for_section(section_for_input_fields)- dialog.close_via_button+ dialog.close_via_button- dialog.expect_closed- end+ dialog.expect_closed+ end- it 'shows only the project custom fields of the specific section within the dialog' do- overview_page.open_edit_dialog_for_section(section_for_input_fields)+ it 'shows only the project custom fields of the specific section within the dialog' do+ overview_page.open_edit_dialog_for_section(section_for_input_fields)- dialog.within_async_content(close_after_yield: true) do- (input_fields + select_fields + multi_select_fields).each do |project_custom_field|- if input_fields.include?(project_custom_field)- expect(page).to have_content(project_custom_field.name)- else- expect(page).to have_no_content(project_custom_field.name)- end+ dialog.within_async_content(close_after_yield: true) do+ (input_fields + select_fields + multi_select_fields).each do |project_custom_field|+ if input_fields.include?(project_custom_field)+ expect(page).to have_content(project_custom_field.name)+ else+ expect(page).to have_no_content(project_custom_field.name)endend+ end- dialog = Components::Projects::ProjectCustomFields::EditDialog.new(project, section_for_select_fields)+ dialog = Components::Projects::ProjectCustomFields::EditDialog.new(project, section_for_select_fields)- overview_page.open_edit_dialog_for_section(section_for_select_fields)+ overview_page.open_edit_dialog_for_section(section_for_select_fields)- dialog.within_async_content(close_after_yield: true) do- (input_fields + select_fields + multi_select_fields).each do |project_custom_field|- if select_fields.include?(project_custom_field)- expect(page).to have_content(project_custom_field.name)- else- expect(page).to have_no_content(project_custom_field.name)- end+ dialog.within_async_content(close_after_yield: true) do+ (input_fields + select_fields + multi_select_fields).each do |project_custom_field|+ if select_fields.include?(project_custom_field)+ expect(page).to have_content(project_custom_field.name)+ else+ expect(page).to have_no_content(project_custom_field.name)endend+ end- dialog = Components::Projects::ProjectCustomFields::EditDialog.new(project, section_for_multi_select_fields)+ dialog = Components::Projects::ProjectCustomFields::EditDialog.new(project, section_for_multi_select_fields)- overview_page.open_edit_dialog_for_section(section_for_multi_select_fields)+ overview_page.open_edit_dialog_for_section(section_for_multi_select_fields)- dialog.within_async_content(close_after_yield: true) do- (input_fields + select_fields + multi_select_fields).each do |project_custom_field|- if multi_select_fields.include?(project_custom_field)- expect(page).to have_content(project_custom_field.name)- else- expect(page).to have_no_content(project_custom_field.name)- end+ dialog.within_async_content(close_after_yield: true) do+ (input_fields + select_fields + multi_select_fields).each do |project_custom_field|+ if multi_select_fields.include?(project_custom_field)+ expect(page).to have_content(project_custom_field.name)+ else+ expect(page).to have_no_content(project_custom_field.name)endendend+ end- it 'shows the inputs in the correct order defined by the position of project custom field in a section' do- overview_page.open_edit_dialog_for_section(section_for_input_fields)+ it 'shows the inputs in the correct order defined by the position of project custom field in a section' do+ overview_page.open_edit_dialog_for_section(section_for_input_fields)- dialog.within_async_content(close_after_yield: true) do- containers = dialog.input_containers+ dialog.within_async_content(close_after_yield: true) do+ containers = dialog.input_containers- expect(containers[0].text).to include('Boolean field')- expect(containers[1].text).to include('String field')- expect(containers[2].text).to include('Integer field')- expect(containers[3].text).to include('Float field')- expect(containers[4].text).to include('Date field')- expect(containers[5].text).to include('Text field')- end+ expect(containers[0].text).to include('Boolean field')+ expect(containers[1].text).to include('String field')+ expect(containers[2].text).to include('Integer field')+ expect(containers[3].text).to include('Float field')+ expect(containers[4].text).to include('Date field')+ expect(containers[5].text).to include('Text field')+ end- boolean_project_custom_field.move_to_bottom+ boolean_project_custom_field.move_to_bottom- overview_page.open_edit_dialog_for_section(section_for_input_fields)+ overview_page.open_edit_dialog_for_section(section_for_input_fields)- dialog.within_async_content(close_after_yield: true) do- containers = dialog.input_containers+ dialog.within_async_content(close_after_yield: true) do+ containers = dialog.input_containers- expect(containers[0].text).to include('String field')- expect(containers[1].text).to include('Integer field')- expect(containers[2].text).to include('Float field')- expect(containers[3].text).to include('Date field')- expect(containers[4].text).to include('Text field')- expect(containers[5].text).to include('Boolean field')- end+ expect(containers[0].text).to include('String field')+ expect(containers[1].text).to include('Integer field')+ expect(containers[2].text).to include('Float field')+ expect(containers[3].text).to include('Date field')+ expect(containers[4].text).to include('Text field')+ expect(containers[5].text).to include('Boolean field')endendenddiff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rbindex 2a1e10cf08b..ad32844d47c 100644--- a/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rb@@ -34,605 +34,603 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:overview_page) { Pages::Projects::Show.new(project) }- describe 'with enabled project attributes feature', with_flag: { project_attributes: true } do- before do- login_as member_with_project_edit_permissions- overview_page.visit_page- end+ before do+ login_as member_with_project_edit_permissions+ overview_page.visit_page+ end- describe 'with correct updating behaviour' do- describe 'with input fields' do- let(:section) { section_for_input_fields }- let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }+ describe 'with correct updating behaviour' do+ describe 'with input fields' do+ let(:section) { section_for_input_fields }+ let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a custom field checkbox' do- it 'sets the value to true if checked' do- custom_field.custom_values.destroy_all+ shared_examples 'a custom field checkbox' do+ it 'sets the value to true if checked' do+ custom_field.custom_values.destroy_all- overview_page.visit_page+ overview_page.visit_page- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content "Not set yet"- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content "Not set yet"+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.check+ field.check- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content "Yes"- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content "Yes"end+ end- it 'sets the value to false if unchecked' do- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content "Yes"- end+ it 'sets the value to false if unchecked' do+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content "Yes"+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.uncheck+ field.uncheck- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content "No"- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content "No"end+ end- it 'does not change the value if untouched' do- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content "Yes"- end+ it 'does not change the value if untouched' do+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content "Yes"+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- # don't touch the input+ # don't touch the input- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content "Yes"- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content "Yes"endend+ end- shared_examples 'a custom field input' do- it 'saves the value properly' do- custom_field.custom_values.destroy_all+ shared_examples 'a custom field input' do+ it 'saves the value properly' do+ custom_field.custom_values.destroy_all- overview_page.visit_page+ overview_page.visit_page- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content "Not set yet"- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content "Not set yet"+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.fill_in(with: update_value)+ field.fill_in(with: update_value)- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content expected_updated_value- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content expected_updated_valueend+ end- it 'does not change the value if untouched' do- overview_page.visit_page+ it 'does not change the value if untouched' do+ overview_page.visit_page- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content expected_initial_value- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content expected_initial_value+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- # don't touch the input+ # don't touch the input- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content expected_initial_value- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content expected_initial_valueend+ end- it 'removes the value properly' do- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content expected_initial_value- end+ it 'removes the value properly' do+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content expected_initial_value+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.fill_in(with: '')+ field.fill_in(with: '')- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content "Not set yet"- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content "Not set yet"endend+ end- shared_examples 'a rich text custom field input' do- it 'saves the value properly' do- custom_field.custom_values.destroy_all+ shared_examples 'a rich text custom field input' do+ it 'saves the value properly' do+ custom_field.custom_values.destroy_all- overview_page.visit_page+ overview_page.visit_page- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_no_text(expected_updated_value)- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_no_text(expected_updated_value)+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.set_value(update_value)+ field.set_value(update_value)- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text(expected_updated_value)- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text(expected_updated_value)end+ end- it 'does not change the value if untouched' do- overview_page.visit_page+ it 'does not change the value if untouched' do+ overview_page.visit_page- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content expected_initial_value- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content expected_initial_value+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- # don't touch the input+ # don't touch the input- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_content expected_initial_value- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_content expected_initial_valueend+ end- it 'removes the value properly' do- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text(expected_initial_value)- end+ it 'removes the value properly' do+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text(expected_initial_value)+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.set_value('')+ field.set_value('')- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_no_text(expected_initial_value)- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_no_text(expected_initial_value)endend+ end- describe 'with boolean CF' do- let(:custom_field) { boolean_project_custom_field }- let(:field) { FormFields::Primerized::InputField.new(custom_field) }- let(:expected_initial_value) { true }+ describe 'with boolean CF' do+ let(:custom_field) { boolean_project_custom_field }+ let(:field) { FormFields::Primerized::InputField.new(custom_field) }+ let(:expected_initial_value) { true }- it_behaves_like 'a custom field checkbox'- end+ it_behaves_like 'a custom field checkbox'+ end- describe 'with string CF' do- let(:custom_field) { string_project_custom_field }- let(:field) { FormFields::Primerized::InputField.new(custom_field) }- let(:expected_initial_value) { 'Foo' }- let(:update_value) { 'Bar' }- let(:expected_updated_value) { update_value }+ describe 'with string CF' do+ let(:custom_field) { string_project_custom_field }+ let(:field) { FormFields::Primerized::InputField.new(custom_field) }+ let(:expected_initial_value) { 'Foo' }+ let(:update_value) { 'Bar' }+ let(:expected_updated_value) { update_value }- it_behaves_like 'a custom field input'- end+ it_behaves_like 'a custom field input'+ end- describe 'with integer CF' do- let(:custom_field) { integer_project_custom_field }- let(:field) { FormFields::Primerized::InputField.new(custom_field) }- let(:expected_initial_value) { 123 }- let(:update_value) { 456 }- let(:expected_updated_value) { update_value }+ describe 'with integer CF' do+ let(:custom_field) { integer_project_custom_field }+ let(:field) { FormFields::Primerized::InputField.new(custom_field) }+ let(:expected_initial_value) { 123 }+ let(:update_value) { 456 }+ let(:expected_updated_value) { update_value }- it_behaves_like 'a custom field input'- end+ it_behaves_like 'a custom field input'+ end- describe 'with float CF' do- let(:custom_field) { float_project_custom_field }- let(:field) { FormFields::Primerized::InputField.new(custom_field) }- let(:expected_initial_value) { 123.456 }- let(:update_value) { 456.789 }- let(:expected_updated_value) { update_value }+ describe 'with float CF' do+ let(:custom_field) { float_project_custom_field }+ let(:field) { FormFields::Primerized::InputField.new(custom_field) }+ let(:expected_initial_value) { 123.456 }+ let(:update_value) { 456.789 }+ let(:expected_updated_value) { update_value }- it_behaves_like 'a custom field input'- end+ it_behaves_like 'a custom field input'+ end- describe 'with date CF' do- let(:custom_field) { date_project_custom_field }- let(:field) { FormFields::Primerized::InputField.new(custom_field) }- let(:expected_initial_value) { '01/01/2024' }- let(:update_value) { Date.new(2024, 1, 2) }- let(:expected_updated_value) { '01/02/2024' }+ describe 'with date CF' do+ let(:custom_field) { date_project_custom_field }+ let(:field) { FormFields::Primerized::InputField.new(custom_field) }+ let(:expected_initial_value) { '01/01/2024' }+ let(:update_value) { Date.new(2024, 1, 2) }+ let(:expected_updated_value) { '01/02/2024' }- it_behaves_like 'a custom field input'- end+ it_behaves_like 'a custom field input'+ end- describe 'with text CF' do- let(:custom_field) { text_project_custom_field }- let(:field) { FormFields::Primerized::EditorFormField.new(custom_field) }- let(:expected_initial_value) { "Lorem\nipsum" } # TBD: why is the second newline missing?- let(:update_value) { "Dolor\n\nsit" }- let(:expected_updated_value) { "Dolor\nsit" }+ describe 'with text CF' do+ let(:custom_field) { text_project_custom_field }+ let(:field) { FormFields::Primerized::EditorFormField.new(custom_field) }+ let(:expected_initial_value) { "Lorem\nipsum" } # TBD: why is the second newline missing?+ let(:update_value) { "Dolor\n\nsit" }+ let(:expected_updated_value) { "Dolor\nsit" }- it_behaves_like 'a rich text custom field input'- end+ it_behaves_like 'a rich text custom field input'end+ end- describe 'with select fields' do- let(:section) { section_for_select_fields }- let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }+ describe 'with select fields' do+ let(:section) { section_for_select_fields }+ let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a select field' do- it 'saves the value properly' do- custom_field.custom_values.destroy_all+ shared_examples 'a select field' do+ it 'saves the value properly' do+ custom_field.custom_values.destroy_all- overview_page.visit_page+ overview_page.visit_page- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_no_text first_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_no_text first_option+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.select_option(first_option)+ field.select_option(first_option)- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_optionend+ end- it 'does not change the value if untouched' do- overview_page.visit_page+ it 'does not change the value if untouched' do+ overview_page.visit_page- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_option+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- # don't touch the input+ # don't touch the input- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_optionend+ end- it 'removes the value properly' do- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- end+ it 'removes the value properly' do+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_option+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.clear+ field.clear- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_no_text first_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_no_text first_optionendend+ end- describe 'with list CF' do- let(:custom_field) { list_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with list CF' do+ let(:custom_field) { list_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:first_option) { custom_field.custom_options.first.value }+ let(:first_option) { custom_field.custom_options.first.value }- it_behaves_like 'a select field'- end+ it_behaves_like 'a select field'+ end- describe 'with version select CF' do- let(:custom_field) { version_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with version select CF' do+ let(:custom_field) { version_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:first_option) { first_version.name }+ let(:first_option) { first_version.name }- it_behaves_like 'a select field'- end+ it_behaves_like 'a select field'+ end- describe 'with user select CF' do- let(:custom_field) { user_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with user select CF' do+ let(:custom_field) { user_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:first_option) { member_in_project.name }+ let(:first_option) { member_in_project.name }- it_behaves_like 'a select field'+ it_behaves_like 'a select field'- describe 'with support for user groups' do- let!(:group) do- create(:group, name: 'Group 1 in project',- member_with_roles: { project => reader_role })- end+ describe 'with support for user groups' do+ let!(:group) do+ create(:group, name: 'Group 1 in project',+ member_with_roles: { project => reader_role })+ end- it 'saves selected user group properly' do- custom_field.custom_values.destroy_all+ it 'saves selected user group properly' do+ custom_field.custom_values.destroy_all- overview_page.visit_page+ overview_page.visit_page- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.select_option(group.name)+ field.select_option(group.name)- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text group.name- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text group.nameendend+ end- describe 'with support for placeholder users' do- let!(:placeholder_user) do- create(:placeholder_user, name: 'Placeholder user',- member_with_roles: { project => reader_role })- end+ describe 'with support for placeholder users' do+ let!(:placeholder_user) do+ create(:placeholder_user, name: 'Placeholder user',+ member_with_roles: { project => reader_role })+ end- it 'saves selected placeholer user properly' do- custom_field.custom_values.destroy_all+ it 'saves selected placeholer user properly' do+ custom_field.custom_values.destroy_all- overview_page.visit_page+ overview_page.visit_page- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.select_option(placeholder_user.name)+ field.select_option(placeholder_user.name)- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text placeholder_user.name- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text placeholder_user.nameendendendend+ end- describe 'with multi select fields' do- let(:section) { section_for_multi_select_fields }- let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }+ describe 'with multi select fields' do+ let(:section) { section_for_multi_select_fields }+ let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a autocomplete multi select field' do- it 'saves single selected values properly' do- custom_field.custom_values.destroy_all+ shared_examples 'a autocomplete multi select field' do+ it 'saves single selected values properly' do+ custom_field.custom_values.destroy_all- overview_page.visit_page+ overview_page.visit_page- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_no_text first_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_no_text first_option+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.select_option(first_option)+ field.select_option(first_option)- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_optionend+ end- it 'saves multi selected values properly' do- custom_field.custom_values.destroy_all+ it 'saves multi selected values properly' do+ custom_field.custom_values.destroy_all- overview_page.visit_page+ overview_page.visit_page- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_no_text first_option- expect(page).to have_no_text second_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_no_text first_option+ expect(page).to have_no_text second_option+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.select_option(first_option)- field.select_option(second_option)+ field.select_option(first_option)+ field.select_option(second_option)- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- expect(page).to have_text second_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_option+ expect(page).to have_text second_optionend+ end- it 'removes deselected values properly' do- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- expect(page).to have_text second_option- end+ it 'removes deselected values properly' do+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_option+ expect(page).to have_text second_option+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.deselect_option(first_option)+ field.deselect_option(first_option)- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_no_text first_option- expect(page).to have_text second_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_no_text first_option+ expect(page).to have_text second_optionend+ end- it 'does not remove values when not touching the init values' do- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- expect(page).to have_text second_option- end+ it 'does not remove values when not touching the init values' do+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_option+ expect(page).to have_text second_option+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- # don't touch the values+ # don't touch the values- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- expect(page).to have_text second_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_option+ expect(page).to have_text second_optionend+ end- it 'removes all values when clearing the input' do- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- expect(page).to have_text second_option- end+ it 'removes all values when clearing the input' do+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_option+ expect(page).to have_text second_option+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.clear+ field.clear- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_no_text first_option- expect(page).to have_no_text second_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_no_text first_option+ expect(page).to have_no_text second_optionend+ end- it 'adds values properly to init values' do- custom_field.custom_values.last.destroy+ it 'adds values properly to init values' do+ custom_field.custom_values.last.destroy- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- expect(page).to have_no_text second_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_option+ expect(page).to have_no_text second_option+ end- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.select_option(second_option)+ field.select_option(second_option)- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text first_option- expect(page).to have_text second_option- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text first_option+ expect(page).to have_text second_optionendend+ end- describe 'with multi select list CF' do- let(:custom_field) { multi_list_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with multi select list CF' do+ let(:custom_field) { multi_list_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:first_option) { custom_field.custom_options.first.value }- let(:second_option) { custom_field.custom_options.second.value }+ let(:first_option) { custom_field.custom_options.first.value }+ let(:second_option) { custom_field.custom_options.second.value }- it_behaves_like 'a autocomplete multi select field'- end+ it_behaves_like 'a autocomplete multi select field'+ end- describe 'with multi version select list CF' do- let(:custom_field) { multi_version_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with multi version select list CF' do+ let(:custom_field) { multi_version_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:first_option) { first_version.name }- let(:second_option) { second_version.name }+ let(:first_option) { first_version.name }+ let(:second_option) { second_version.name }- it_behaves_like 'a autocomplete multi select field'- end+ it_behaves_like 'a autocomplete multi select field'+ end- describe 'with multi user select list CF' do- let(:custom_field) { multi_user_project_custom_field }- let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }+ describe 'with multi user select list CF' do+ let(:custom_field) { multi_user_project_custom_field }+ let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- let(:first_option) { member_in_project.name }- let(:second_option) { another_member_in_project.name }+ let(:first_option) { member_in_project.name }+ let(:second_option) { another_member_in_project.name }- it_behaves_like 'a autocomplete multi select field'+ it_behaves_like 'a autocomplete multi select field'- describe 'with support for user groups' do- let!(:group) do- create(:group, name: 'Group 1 in project',- member_with_roles: { project => reader_role })- end- let!(:another_group) do- create(:group, name: 'Group 2 in project',- member_with_roles: { project => reader_role })- end+ describe 'with support for user groups' do+ let!(:group) do+ create(:group, name: 'Group 1 in project',+ member_with_roles: { project => reader_role })+ end+ let!(:another_group) do+ create(:group, name: 'Group 2 in project',+ member_with_roles: { project => reader_role })+ end- it 'saves selected user groups properly' do- custom_field.custom_values.destroy_all+ it 'saves selected user groups properly' do+ custom_field.custom_values.destroy_all- overview_page.visit_page+ overview_page.visit_page- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.select_option(group.name)- field.select_option(another_group.name)+ field.select_option(group.name)+ field.select_option(another_group.name)- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text group.name- expect(page).to have_text another_group.name- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text group.name+ expect(page).to have_text another_group.nameendend+ end- describe 'with support for placeholder users' do- let!(:placeholder_user) do- create(:placeholder_user, name: 'Placeholder user',- member_with_roles: { project => reader_role })- end- let!(:another_placeholder_user) do- create(:placeholder_user, name: 'Another placeholder User',- member_with_roles: { project => reader_role })- end+ describe 'with support for placeholder users' do+ let!(:placeholder_user) do+ create(:placeholder_user, name: 'Placeholder user',+ member_with_roles: { project => reader_role })+ end+ let!(:another_placeholder_user) do+ create(:placeholder_user, name: 'Another placeholder User',+ member_with_roles: { project => reader_role })+ end- it 'shows only placeholder users from this project' do- custom_field.custom_values.destroy_all+ it 'shows only placeholder users from this project' do+ custom_field.custom_values.destroy_all- overview_page.visit_page+ overview_page.visit_page- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.select_option(placeholder_user.name)- field.select_option(another_placeholder_user.name)+ field.select_option(placeholder_user.name)+ field.select_option(another_placeholder_user.name)- dialog.submit- dialog.expect_closed+ dialog.submit+ dialog.expect_closed- overview_page.within_custom_field_container(custom_field) do- expect(page).to have_text placeholder_user.name- expect(page).to have_text another_placeholder_user.name- end+ overview_page.within_custom_field_container(custom_field) do+ expect(page).to have_text placeholder_user.name+ expect(page).to have_text another_placeholder_user.nameendendenddiff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rbindex 46089712936..3d8081008f5 100644--- a/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rb@@ -34,173 +34,171 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:overview_page) { Pages::Projects::Show.new(project) }- describe 'with enabled project attributes feature', with_flag: { project_attributes: true } do- before do- login_as member_with_project_edit_permissions- overview_page.visit_page- end+ before do+ login_as member_with_project_edit_permissions+ overview_page.visit_page+ end- describe 'with correct validation behaviour' do- describe 'with input fields' do- let(:section) { section_for_input_fields }- let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }+ describe 'with correct validation behaviour' do+ describe 'with input fields' do+ let(:section) { section_for_input_fields }+ let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a custom field input' do- it 'shows an error if the value is invalid' do- custom_field.update!(is_required: true)- custom_field.custom_values.destroy_all+ shared_examples 'a custom field input' do+ it 'shows an error if the value is invalid' do+ custom_field.update!(is_required: true)+ custom_field.custom_values.destroy_all- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- dialog.submit+ dialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.blank'))- end+ field.expect_error(I18n.t('activerecord.errors.messages.blank'))end+ end- # boolean CFs can not be validated+ # boolean CFs can not be validated- describe 'with string CF' do- let(:custom_field) { string_project_custom_field }- let(:field) { FormFields::Primerized::InputField.new(custom_field) }+ describe 'with string CF' do+ let(:custom_field) { string_project_custom_field }+ let(:field) { FormFields::Primerized::InputField.new(custom_field) }- it_behaves_like 'a custom field input'+ it_behaves_like 'a custom field input'- it 'shows an error if the value is too long' do- custom_field.update!(max_length: 3)+ it 'shows an error if the value is too long' do+ custom_field.update!(max_length: 3)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.fill_in(with: 'Foooo')+ field.fill_in(with: 'Foooo')- dialog.submit+ dialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 3))- end+ field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 3))+ end- it 'shows an error if the value is too short' do- custom_field.update!(min_length: 3, max_length: 5)+ it 'shows an error if the value is too short' do+ custom_field.update!(min_length: 3, max_length: 5)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.fill_in(with: 'Fo')+ field.fill_in(with: 'Fo')- dialog.submit+ dialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 3))- end+ field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 3))+ end- it 'shows an error if the value does not match the regex' do- custom_field.update!(regexp: '^[A-Z]+$')+ it 'shows an error if the value does not match the regex' do+ custom_field.update!(regexp: '^[A-Z]+$')- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.fill_in(with: 'foo')+ field.fill_in(with: 'foo')- dialog.submit+ dialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.invalid'))- end+ field.expect_error(I18n.t('activerecord.errors.messages.invalid'))end+ end- describe 'with integer CF' do- let(:custom_field) { integer_project_custom_field }- let(:field) { FormFields::Primerized::InputField.new(custom_field) }+ describe 'with integer CF' do+ let(:custom_field) { integer_project_custom_field }+ let(:field) { FormFields::Primerized::InputField.new(custom_field) }- it_behaves_like 'a custom field input'+ it_behaves_like 'a custom field input'- it 'shows an error if the value is too long' do- custom_field.update!(max_length: 2)+ it 'shows an error if the value is too long' do+ custom_field.update!(max_length: 2)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.fill_in(with: '111')+ field.fill_in(with: '111')- dialog.submit+ dialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 2))- end+ field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 2))+ end- it 'shows an error if the value is too short' do- custom_field.update!(min_length: 2, max_length: 5)+ it 'shows an error if the value is too short' do+ custom_field.update!(min_length: 2, max_length: 5)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.fill_in(with: '1')+ field.fill_in(with: '1')- dialog.submit+ dialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 2))- end+ field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 2))end+ end- describe 'with float CF' do- let(:custom_field) { float_project_custom_field }- let(:field) { FormFields::Primerized::InputField.new(custom_field) }+ describe 'with float CF' do+ let(:custom_field) { float_project_custom_field }+ let(:field) { FormFields::Primerized::InputField.new(custom_field) }- it_behaves_like 'a custom field input'+ it_behaves_like 'a custom field input'- it 'shows an error if the value is too long' do- custom_field.update!(max_length: 4)+ it 'shows an error if the value is too long' do+ custom_field.update!(max_length: 4)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.fill_in(with: '1111.1')+ field.fill_in(with: '1111.1')- dialog.submit+ dialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 4))- end+ field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 4))+ end- it 'shows an error if the value is too short' do- custom_field.update!(min_length: 4, max_length: 5)+ it 'shows an error if the value is too short' do+ custom_field.update!(min_length: 4, max_length: 5)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.fill_in(with: '1.1')+ field.fill_in(with: '1.1')- dialog.submit+ dialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 4))- end+ field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 4))end+ end- describe 'with date CF' do- let(:custom_field) { date_project_custom_field }- let(:field) { FormFields::Primerized::InputField.new(custom_field) }+ describe 'with date CF' do+ let(:custom_field) { date_project_custom_field }+ let(:field) { FormFields::Primerized::InputField.new(custom_field) }- it_behaves_like 'a custom field input'- end+ it_behaves_like 'a custom field input'+ end- describe 'with text CF' do- let(:custom_field) { text_project_custom_field }- let(:field) { FormFields::Primerized::EditorFormField.new(custom_field) }+ describe 'with text CF' do+ let(:custom_field) { text_project_custom_field }+ let(:field) { FormFields::Primerized::EditorFormField.new(custom_field) }- it_behaves_like 'a custom field input'+ it_behaves_like 'a custom field input'- it 'shows an error if the value is too long' do- custom_field.update!(max_length: 3)+ it 'shows an error if the value is too long' do+ custom_field.update!(max_length: 3)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.set_value('Foooo')+ field.set_value('Foooo')- dialog.submit+ dialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 3))- end+ field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 3))+ end- it 'shows an error if the value is too short' do- custom_field.update!(min_length: 3, max_length: 5)+ it 'shows an error if the value is too short' do+ custom_field.update!(min_length: 3, max_length: 5)- overview_page.open_edit_dialog_for_section(section)+ overview_page.open_edit_dialog_for_section(section)- field.set_value('Fo')+ field.set_value('Fo')- dialog.submit+ dialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 3))- end+ field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 3))endendenddiff --git a/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rb b/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rbindex bfb559075ab..a4afafe2a8d 100644--- a/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rb@@ -38,831 +38,819 @@ RSpec.describe 'Show project custom fields on project overview page', :js, :withlogin_as adminend- describe 'with disabled project attributes feature', with_flag: { project_attributes: false } do- it 'does not show the project attributes sidebar' do- overview_page.visit_page+ it 'does show the project attributes sidebar' do+ overview_page.visit_page- within '.op-grid-page' do- expect(page).to have_no_css('#project-custom-fields-sidebar')- end+ within '.op-grid-page' do+ expect(page).to have_css('#project-custom-fields-sidebar')endend- describe 'with enabled project attributes feature', with_flag: { project_attributes: true } do- it 'does show the project attributes sidebar' do+ describe 'with correct scoping' do+ it 'shows enabled project custom fields in a sidebar grouped by section' dooverview_page.visit_page- within '.op-grid-page' do- expect(page).to have_css('#project-custom-fields-sidebar')- end- end-- describe 'with correct scoping' do- it 'shows enabled project custom fields in a sidebar grouped by section' do- overview_page.visit_page+ overview_page.within_async_loaded_sidebar do+ expect(page).to have_css('.op-project-custom-field-section-container', count: 3)- overview_page.within_async_loaded_sidebar do- expect(page).to have_css('.op-project-custom-field-section-container', count: 3)+ overview_page.within_custom_field_section_container(section_for_input_fields) do+ expect(page).to have_text 'Input fields'- overview_page.within_custom_field_section_container(section_for_input_fields) do- expect(page).to have_text 'Input fields'-- expect(page).to have_text 'Boolean field'- expect(page).to have_text 'String field'- expect(page).to have_text 'Integer field'- expect(page).to have_text 'Float field'- expect(page).to have_text 'Date field'- expect(page).to have_text 'Text field'- end+ expect(page).to have_text 'Boolean field'+ expect(page).to have_text 'String field'+ expect(page).to have_text 'Integer field'+ expect(page).to have_text 'Float field'+ expect(page).to have_text 'Date field'+ expect(page).to have_text 'Text field'+ end- overview_page.within_custom_field_section_container(section_for_select_fields) do- expect(page).to have_text 'Select fields'+ overview_page.within_custom_field_section_container(section_for_select_fields) do+ expect(page).to have_text 'Select fields'- expect(page).to have_text 'List field'- expect(page).to have_text 'Version field'- expect(page).to have_text 'User field'- end+ expect(page).to have_text 'List field'+ expect(page).to have_text 'Version field'+ expect(page).to have_text 'User field'+ end- overview_page.within_custom_field_section_container(section_for_multi_select_fields) do- expect(page).to have_text 'Multi select fields'+ overview_page.within_custom_field_section_container(section_for_multi_select_fields) do+ expect(page).to have_text 'Multi select fields'- expect(page).to have_text 'Multi list field'- expect(page).to have_text 'Multi version field'- expect(page).to have_text 'Multi user field'- end+ expect(page).to have_text 'Multi list field'+ expect(page).to have_text 'Multi version field'+ expect(page).to have_text 'Multi user field'endend+ end- it 'does not show project custom fields not enabled for this project in a sidebar' do- create(:string_project_custom_field, projects: [other_project], name: 'String field enabled for other project')+ it 'does not show project custom fields not enabled for this project in a sidebar' do+ create(:string_project_custom_field, projects: [other_project], name: 'String field enabled for other project')- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- expect(page).to have_no_text 'String field enabled for other project'- end+ overview_page.within_async_loaded_sidebar do+ expect(page).to have_no_text 'String field enabled for other project'endend+ end- describe 'with correct order' do- it 'shows the project custom field sections in the correct order' do- overview_page.visit_page+ describe 'with correct order' do+ it 'shows the project custom field sections in the correct order' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- sections = page.all('.op-project-custom-field-section-container')+ overview_page.within_async_loaded_sidebar do+ sections = page.all('.op-project-custom-field-section-container')- expect(sections.size).to eq(3)+ expect(sections.size).to eq(3)- expect(sections[0].text).to include('Input fields')- expect(sections[1].text).to include('Select fields')- expect(sections[2].text).to include('Multi select fields')- end+ expect(sections[0].text).to include('Input fields')+ expect(sections[1].text).to include('Select fields')+ expect(sections[2].text).to include('Multi select fields')+ end- section_for_input_fields.move_to_bottom+ section_for_input_fields.move_to_bottom- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- sections = page.all('.op-project-custom-field-section-container')+ overview_page.within_async_loaded_sidebar do+ sections = page.all('.op-project-custom-field-section-container')- expect(sections.size).to eq(3)+ expect(sections.size).to eq(3)- expect(sections[0].text).to include('Select fields')- expect(sections[1].text).to include('Multi select fields')- expect(sections[2].text).to include('Input fields')- end+ expect(sections[0].text).to include('Select fields')+ expect(sections[1].text).to include('Multi select fields')+ expect(sections[2].text).to include('Input fields')end+ end- it 'shows the project custom fields in the correct order within the sections' do- overview_page.visit_page+ it 'shows the project custom fields in the correct order within the sections' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_section_container(section_for_input_fields) do- fields = page.all('.op-project-custom-field-container')+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_section_container(section_for_input_fields) do+ fields = page.all('.op-project-custom-field-container')- expect(fields.size).to eq(6)+ expect(fields.size).to eq(6)- expect(fields[0].text).to include('Boolean field')- expect(fields[1].text).to include('String field')- expect(fields[2].text).to include('Integer field')- expect(fields[3].text).to include('Float field')- expect(fields[4].text).to include('Date field')- expect(fields[5].text).to include('Text field')- end+ expect(fields[0].text).to include('Boolean field')+ expect(fields[1].text).to include('String field')+ expect(fields[2].text).to include('Integer field')+ expect(fields[3].text).to include('Float field')+ expect(fields[4].text).to include('Date field')+ expect(fields[5].text).to include('Text field')end+ end- string_project_custom_field.move_to_bottom+ string_project_custom_field.move_to_bottom- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_section_container(section_for_input_fields) do- fields = page.all('.op-project-custom-field-container')+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_section_container(section_for_input_fields) do+ fields = page.all('.op-project-custom-field-container')- expect(fields.size).to eq(6)+ expect(fields.size).to eq(6)- expect(fields[0].text).to include('Boolean field')- expect(fields[1].text).to include('Integer field')- expect(fields[2].text).to include('Float field')- expect(fields[3].text).to include('Date field')- expect(fields[4].text).to include('Text field')- expect(fields[5].text).to include('String field')- end+ expect(fields[0].text).to include('Boolean field')+ expect(fields[1].text).to include('Integer field')+ expect(fields[2].text).to include('Float field')+ expect(fields[3].text).to include('Date field')+ expect(fields[4].text).to include('Text field')+ expect(fields[5].text).to include('String field')endendend+ end- describe 'with correct values' do- describe 'with boolean CF' do- # it_behaves_like 'a project custom field' do- # let(subject) { boolean_project_custom_field }- # end+ describe 'with correct values' do+ describe 'with boolean CF' do+ # it_behaves_like 'a project custom field' do+ # let(subject) { boolean_project_custom_field }+ # end- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ describe 'with value set by user' do+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(boolean_project_custom_field) do- expect(page).to have_text 'Boolean field'- expect(page).to have_text 'Yes'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(boolean_project_custom_field) do+ expect(page).to have_text 'Boolean field'+ expect(page).to have_text 'Yes'endendend+ end- describe 'with value unset by user' do- # A boolean cannot be completely unset via UI, only toggle between true and false, no blank value possible- before do- boolean_project_custom_field.custom_values.where(customized: project).first.update!(value: false)- end+ describe 'with value unset by user' do+ # A boolean cannot be completely unset via UI, only toggle between true and false, no blank value possible+ before do+ boolean_project_custom_field.custom_values.where(customized: project).first.update!(value: false)+ end- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(boolean_project_custom_field) do- expect(page).to have_text 'Boolean field'- expect(page).to have_text 'No'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(boolean_project_custom_field) do+ expect(page).to have_text 'Boolean field'+ expect(page).to have_text 'No'endendend+ end- describe 'with no value set by user' do- before do- boolean_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ boolean_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(boolean_project_custom_field) do- expect(page).to have_text 'Boolean field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(boolean_project_custom_field) do+ expect(page).to have_text 'Boolean field'+ expect(page).to have_text 'Not set yet'endend+ end- it 'does not show the default value for the project custom field if no value given' do- boolean_project_custom_field.update!(default_value: true)+ it 'does not show the default value for the project custom field if no value given' do+ boolean_project_custom_field.update!(default_value: true)- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(boolean_project_custom_field) do- expect(page).to have_text 'Boolean field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(boolean_project_custom_field) do+ expect(page).to have_text 'Boolean field'+ expect(page).to have_text 'Not set yet'end+ end- boolean_project_custom_field.update!(default_value: false)+ boolean_project_custom_field.update!(default_value: false)- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(boolean_project_custom_field) do- expect(page).to have_text 'Boolean field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(boolean_project_custom_field) do+ expect(page).to have_text 'Boolean field'+ expect(page).to have_text 'Not set yet'endendendend+ end- describe 'with string CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ describe 'with string CF' do+ describe 'with value set by user' do+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(string_project_custom_field) do- expect(page).to have_text 'String field'- expect(page).to have_text 'Foo'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(string_project_custom_field) do+ expect(page).to have_text 'String field'+ expect(page).to have_text 'Foo'endendend+ end- describe 'with value unset by user' do- before do- string_project_custom_field.custom_values.where(customized: project).first.update!(value: '')- end+ describe 'with value unset by user' do+ before do+ string_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ end- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(string_project_custom_field) do- expect(page).to have_text 'String field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(string_project_custom_field) do+ expect(page).to have_text 'String field'+ expect(page).to have_text 'Not set yet'endendend+ end- describe 'with no value set by user' do- before do- string_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ string_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(string_project_custom_field) do- expect(page).to have_text 'String field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(string_project_custom_field) do+ expect(page).to have_text 'String field'+ expect(page).to have_text 'Not set yet'endend+ end- it 'does not show the default value for the project custom field if no value given' do- string_project_custom_field.update!(default_value: 'Bar')+ it 'does not show the default value for the project custom field if no value given' do+ string_project_custom_field.update!(default_value: 'Bar')- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(string_project_custom_field) do- expect(page).to have_text 'String field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(string_project_custom_field) do+ expect(page).to have_text 'String field'+ expect(page).to have_text 'Not set yet'endendendend+ end- describe 'with integer CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ describe 'with integer CF' do+ describe 'with value set by user' do+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(integer_project_custom_field) do- expect(page).to have_text 'Integer field'- expect(page).to have_text '123'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(integer_project_custom_field) do+ expect(page).to have_text 'Integer field'+ expect(page).to have_text '123'endendend+ end- describe 'with value unset by user' do- before do- integer_project_custom_field.custom_values.where(customized: project).first.update!(value: '')- end+ describe 'with value unset by user' do+ before do+ integer_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ end- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(integer_project_custom_field) do- expect(page).to have_text 'Integer field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(integer_project_custom_field) do+ expect(page).to have_text 'Integer field'+ expect(page).to have_text 'Not set yet'endendend+ end- describe 'with no value set by user' do- before do- integer_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ integer_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(integer_project_custom_field) do- expect(page).to have_text 'Integer field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(integer_project_custom_field) do+ expect(page).to have_text 'Integer field'+ expect(page).to have_text 'Not set yet'endend+ end- it 'does not show the default value for the project custom field if no value given' do- integer_project_custom_field.update!(default_value: 456)+ it 'does not show the default value for the project custom field if no value given' do+ integer_project_custom_field.update!(default_value: 456)- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(integer_project_custom_field) do- expect(page).to have_text 'Integer field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(integer_project_custom_field) do+ expect(page).to have_text 'Integer field'+ expect(page).to have_text 'Not set yet'endendendend+ end- describe 'with date CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ describe 'with date CF' do+ describe 'with value set by user' do+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(date_project_custom_field) do- expect(page).to have_text 'Date field'- expect(page).to have_text '01/01/2024'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(date_project_custom_field) do+ expect(page).to have_text 'Date field'+ expect(page).to have_text '01/01/2024'endendend+ end- describe 'with value unset by user' do- before do- date_project_custom_field.custom_values.where(customized: project).first.update!(value: '')- end+ describe 'with value unset by user' do+ before do+ date_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ end- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(date_project_custom_field) do- expect(page).to have_text 'Date field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(date_project_custom_field) do+ expect(page).to have_text 'Date field'+ expect(page).to have_text 'Not set yet'endendend+ end- describe 'with no value set by user' do- before do- date_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ date_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(date_project_custom_field) do- expect(page).to have_text 'Date field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(date_project_custom_field) do+ expect(page).to have_text 'Date field'+ expect(page).to have_text 'Not set yet'endend+ end- it 'does not show the default value for the project custom field if no value given' do- date_project_custom_field.update!(default_value: Date.new(2024, 2, 2))+ it 'does not show the default value for the project custom field if no value given' do+ date_project_custom_field.update!(default_value: Date.new(2024, 2, 2))- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(date_project_custom_field) do- expect(page).to have_text 'Date field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(date_project_custom_field) do+ expect(page).to have_text 'Date field'+ expect(page).to have_text 'Not set yet'endendendend+ end- describe 'with float CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ describe 'with float CF' do+ describe 'with value set by user' do+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(float_project_custom_field) do- expect(page).to have_text 'Float field'- expect(page).to have_text '123.456'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(float_project_custom_field) do+ expect(page).to have_text 'Float field'+ expect(page).to have_text '123.456'endendend+ end- describe 'with value unset by user' do- before do- float_project_custom_field.custom_values.where(customized: project).first.update!(value: '')- end+ describe 'with value unset by user' do+ before do+ float_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ end- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(float_project_custom_field) do- expect(page).to have_text 'Float field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(float_project_custom_field) do+ expect(page).to have_text 'Float field'+ expect(page).to have_text 'Not set yet'endendend+ end- describe 'with no value set by user' do- before do- float_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ float_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(float_project_custom_field) do- expect(page).to have_text 'Float field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(float_project_custom_field) do+ expect(page).to have_text 'Float field'+ expect(page).to have_text 'Not set yet'endend+ end- it 'dies not show the default value for the project custom field if no value given' do- float_project_custom_field.update!(default_value: 456.789)+ it 'dies not show the default value for the project custom field if no value given' do+ float_project_custom_field.update!(default_value: 456.789)- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(float_project_custom_field) do- expect(page).to have_text 'Float field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(float_project_custom_field) do+ expect(page).to have_text 'Float field'+ expect(page).to have_text 'Not set yet'endendendend+ end- describe 'with text CF' do- describe 'with value set by user' do- context 'with a value that is shorter than 100 characters' do- it 'shows the correct value for the project custom field if given without truncation and dialog button' do- overview_page.visit_page+ describe 'with text CF' do+ describe 'with value set by user' do+ context 'with a value that is shorter than 100 characters' do+ it 'shows the correct value for the project custom field if given without truncation and dialog button' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(text_project_custom_field) do- expect(page).to have_text 'Text field'- expect(page).to have_text "Lorem\nipsum"- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(text_project_custom_field) do+ expect(page).to have_text 'Text field'+ expect(page).to have_text "Lorem\nipsum"endendend+ end- context 'with a value that is longer than 100 characters' do- before do- text_project_custom_field.custom_values.where(customized: project).first.update!(value: 'a' * 101)- end+ context 'with a value that is longer than 100 characters' do+ before do+ text_project_custom_field.custom_values.where(customized: project).first.update!(value: 'a' * 101)+ end- it 'shows the correct value for the project custom field if given with truncation and dialog button' do- overview_page.visit_page+ it 'shows the correct value for the project custom field if given with truncation and dialog button' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(text_project_custom_field) do- expect(page).to have_text 'Text field'- expect(page).to have_text ("#{'a' * 97}...")- expect(page).to have_text 'Expand'+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(text_project_custom_field) do+ expect(page).to have_text 'Text field'+ expect(page).to have_text ("#{'a' * 97}...")+ expect(page).to have_text 'Expand'- click_on 'Expand'+ click_on 'Expand'- within 'modal-dialog' do- expect(page).to have_text 'a' * 101- end+ within 'modal-dialog' do+ expect(page).to have_text 'a' * 101endendendendend+ end- describe 'with value unset by user' do- before do- text_project_custom_field.custom_values.where(customized: project).first.update!(value: '')- end+ describe 'with value unset by user' do+ before do+ text_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ end- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(text_project_custom_field) do- expect(page).to have_text 'Text field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(text_project_custom_field) do+ expect(page).to have_text 'Text field'+ expect(page).to have_text 'Not set yet'endendend+ end- describe 'with no value set by user' do- before do- text_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ text_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(text_project_custom_field) do- expect(page).to have_text 'Text field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(text_project_custom_field) do+ expect(page).to have_text 'Text field'+ expect(page).to have_text 'Not set yet'endend+ end- it 'does not show the default value for the project custom field if no value given' do- text_project_custom_field.update!(default_value: 'Dolor sit amet')+ it 'does not show the default value for the project custom field if no value given' do+ text_project_custom_field.update!(default_value: 'Dolor sit amet')- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(text_project_custom_field) do- expect(page).to have_text 'Text field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(text_project_custom_field) do+ expect(page).to have_text 'Text field'+ expect(page).to have_text 'Not set yet'endendendend+ end- describe 'with list CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ describe 'with list CF' do+ describe 'with value set by user' do+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(list_project_custom_field) do- expect(page).to have_text 'List field'- expect(page).to have_text 'Option 1'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(list_project_custom_field) do+ expect(page).to have_text 'List field'+ expect(page).to have_text 'Option 1'endendend+ end- describe 'with value unset by user' do- before do- list_project_custom_field.custom_values.where(customized: project).first.update!(value: '')- end+ describe 'with value unset by user' do+ before do+ list_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ end- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(list_project_custom_field) do- expect(page).to have_text 'List field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(list_project_custom_field) do+ expect(page).to have_text 'List field'+ expect(page).to have_text 'Not set yet'endendend+ end- describe 'with no value set by user' do- before do- list_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ list_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(list_project_custom_field) do- expect(page).to have_text 'List field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(list_project_custom_field) do+ expect(page).to have_text 'List field'+ expect(page).to have_text 'Not set yet'endend+ end- it 'does not show the default value for the project custom field if no value given' do- list_project_custom_field.custom_options.first.update!(default_value: true)+ it 'does not show the default value for the project custom field if no value given' do+ list_project_custom_field.custom_options.first.update!(default_value: true)- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(list_project_custom_field) do- expect(page).to have_text 'List field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(list_project_custom_field) do+ expect(page).to have_text 'List field'+ expect(page).to have_text 'Not set yet'endendendend+ end- describe 'with version CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ describe 'with version CF' do+ describe 'with value set by user' do+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(version_project_custom_field) do- expect(page).to have_text 'Version field'- expect(page).to have_text 'Version 1'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(version_project_custom_field) do+ expect(page).to have_text 'Version field'+ expect(page).to have_text 'Version 1'endendend+ end- describe 'with value unset by user' do- before do- version_project_custom_field.custom_values.where(customized: project).first.update!(value: '')- end+ describe 'with value unset by user' do+ before do+ version_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ end- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(version_project_custom_field) do- expect(page).to have_text 'Version field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(version_project_custom_field) do+ expect(page).to have_text 'Version field'+ expect(page).to have_text 'Not set yet'endendend+ end- describe 'with no value set by user' do- before do- version_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ version_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(version_project_custom_field) do- expect(page).to have_text 'Version field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(version_project_custom_field) do+ expect(page).to have_text 'Version field'+ expect(page).to have_text 'Not set yet'endendendend+ end- describe 'with user CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ describe 'with user CF' do+ describe 'with value set by user' do+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(user_project_custom_field) do- expect(page).to have_text 'User field'- expect(page).to have_css('opce-principal')- expect(page).to have_text 'Member 1 In Project'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(user_project_custom_field) do+ expect(page).to have_text 'User field'+ expect(page).to have_css('opce-principal')+ expect(page).to have_text 'Member 1 In Project'endendend+ end- describe 'with value unset by user' do- before do- user_project_custom_field.custom_values.where(customized: project).first.update!(value: '')- end+ describe 'with value unset by user' do+ before do+ user_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ end- it 'shows the correct value for the project custom field if given' do- overview_page.visit_page+ it 'shows the correct value for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(user_project_custom_field) do- expect(page).to have_text 'User field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(user_project_custom_field) do+ expect(page).to have_text 'User field'+ expect(page).to have_text 'Not set yet'endendend+ end- describe 'with no value set by user' do- before do- user_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ user_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(user_project_custom_field) do- expect(page).to have_text 'User field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(user_project_custom_field) do+ expect(page).to have_text 'User field'+ expect(page).to have_text 'Not set yet'endendend+ end- describe 'with support for user groups' do- # TODO- end+ describe 'with support for user groups' do+ # TODO+ end- describe 'with support for user placeholders' do- # TODO- end+ describe 'with support for user placeholders' do+ # TODOend+ end- describe 'with multi list CF' do- describe 'with value set by user' do- it 'shows the correct values for the project custom field if given' do- overview_page.visit_page+ describe 'with multi list CF' do+ describe 'with value set by user' do+ it 'shows the correct values for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(multi_list_project_custom_field) do- expect(page).to have_text 'Multi list field'- expect(page).to have_text 'Option 1, Option 2'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(multi_list_project_custom_field) do+ expect(page).to have_text 'Multi list field'+ expect(page).to have_text 'Option 1, Option 2'endendend+ end- describe 'with no value set by user' do- before do- multi_list_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ multi_list_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(multi_list_project_custom_field) do- expect(page).to have_text 'Multi list field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(multi_list_project_custom_field) do+ expect(page).to have_text 'Multi list field'+ expect(page).to have_text 'Not set yet'endend+ end- it 'does not show the default value(s) for the project custom field if no value given' do- multi_list_project_custom_field.custom_options.first.update!(default_value: true)- multi_list_project_custom_field.custom_options.second.update!(default_value: true)+ it 'does not show the default value(s) for the project custom field if no value given' do+ multi_list_project_custom_field.custom_options.first.update!(default_value: true)+ multi_list_project_custom_field.custom_options.second.update!(default_value: true)- overview_page.visit_page+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(multi_list_project_custom_field) do- expect(page).to have_text 'Multi list field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(multi_list_project_custom_field) do+ expect(page).to have_text 'Multi list field'+ expect(page).to have_text 'Not set yet'endendendend+ end- describe 'with multi version CF' do- describe 'with value set by user' do- it 'shows the correct values for the project custom field if given' do- overview_page.visit_page+ describe 'with multi version CF' do+ describe 'with value set by user' do+ it 'shows the correct values for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(multi_version_project_custom_field) do- expect(page).to have_text 'Multi version field'- expect(page).to have_text 'Version 1, Version 2'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(multi_version_project_custom_field) do+ expect(page).to have_text 'Multi version field'+ expect(page).to have_text 'Version 1, Version 2'endendend+ end- describe 'with no value set by user' do- before do- multi_version_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ multi_version_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(multi_version_project_custom_field) do- expect(page).to have_text 'Multi version field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(multi_version_project_custom_field) do+ expect(page).to have_text 'Multi version field'+ expect(page).to have_text 'Not set yet'endendendend+ end- describe 'with multi user CF' do- describe 'with value set by user' do- it 'shows the correct values for the project custom field if given' do- overview_page.visit_page+ describe 'with multi user CF' do+ describe 'with value set by user' do+ it 'shows the correct values for the project custom field if given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(multi_user_project_custom_field) do- expect(page).to have_text 'Multi user field'- expect(page).to have_css 'opce-principal', count: 2- expect(page).to have_text 'Member 1 In Project'- expect(page).to have_text 'Member 2 In Project'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(multi_user_project_custom_field) do+ expect(page).to have_text 'Multi user field'+ expect(page).to have_css 'opce-principal', count: 2+ expect(page).to have_text 'Member 1 In Project'+ expect(page).to have_text 'Member 2 In Project'endendend+ end- describe 'with no value set by user' do- before do- multi_user_project_custom_field.custom_values.where(customized: project).destroy_all- end+ describe 'with no value set by user' do+ before do+ multi_user_project_custom_field.custom_values.where(customized: project).destroy_all+ end- it 'shows an N/A text for the project custom field if no value given' do- overview_page.visit_page+ it 'shows an N/A text for the project custom field if no value given' do+ overview_page.visit_page- overview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_container(multi_user_project_custom_field) do- expect(page).to have_text 'Multi user field'- expect(page).to have_text 'Not set yet'- end+ overview_page.within_async_loaded_sidebar do+ overview_page.within_custom_field_container(multi_user_project_custom_field) do+ expect(page).to have_text 'Multi user field'+ expect(page).to have_text 'Not set yet'endendenddiff --git a/spec/features/projects/project_custom_fields/settings/mapping_spec.rb b/spec/features/projects/project_custom_fields/settings/mapping_spec.rbindex a3ef7368c56..f2d434d71c0 100644--- a/spec/features/projects/project_custom_fields/settings/mapping_spec.rb+++ b/spec/features/projects/project_custom_fields/settings/mapping_spec.rb@@ -101,20 +101,18 @@ RSpec.describe 'Projects custom fields mapping via project settings', :js, :withlogin_as member_in_project # can edit project but is not allowed to select project custom fieldsend- describe 'with enabled project attributes feature', with_flag: { project_attributes: true } do- it 'does not show the menu entry in the project settings menu' do- visit project_settings_general_path(project)+ it 'does not show the menu entry in the project settings menu' do+ visit project_settings_general_path(project)- within '#menu-sidebar' do- expect(page).to have_no_css("li[data-name='settings_project_custom_fields']")- end+ within '#menu-sidebar' do+ expect(page).to have_no_css("li[data-name='settings_project_custom_fields']")end+ end- it 'does not show the project custom fields page' do- visit project_settings_project_custom_fields_path(project)+ it 'does not show the project custom fields page' do+ visit project_settings_project_custom_fields_path(project)- expect(page).to have_content('You are not authorized to access this page.')- end+ expect(page).to have_content('You are not authorized to access this page.')endend@@ -123,218 +121,206 @@ RSpec.describe 'Projects custom fields mapping via project settings', :js, :withlogin_as user_with_sufficient_permissionsend- describe 'with disabled project attributes feature', with_flag: { project_attributes: false } do- it 'does not show the menu entry in the project settings menu' do- visit project_settings_general_path(project)+ it 'does show the menu entry in the project settings menu' do+ visit project_settings_general_path(project)- within '#menu-sidebar' do- expect(page).to have_no_css("li[data-name='settings_project_custom_fields']")- end+ within '#menu-sidebar' do+ expect(page).to have_css("li[data-name='settings_project_custom_fields']")endend- describe 'with enabled project attributes feature', with_flag: { project_attributes: true } do- it 'does show the menu entry in the project settings menu' do- visit project_settings_general_path(project)+ it 'shows all available project custom fields with their correct mapping state' do+ visit project_settings_project_custom_fields_path(project)- within '#menu-sidebar' do- expect(page).to have_css("li[data-name='settings_project_custom_fields']")+ within_custom_field_section_container(section_for_input_fields) do+ within_custom_field_container(boolean_project_custom_field) do+ expect(page).to have_content('Boolean field')+ expect_type("Bool")+ expect_unchecked_stateend- end-- it 'shows all available project custom fields with their correct mapping state' do- visit project_settings_project_custom_fields_path(project)-- within_custom_field_section_container(section_for_input_fields) do- within_custom_field_container(boolean_project_custom_field) do- expect(page).to have_content('Boolean field')- expect_type("Bool")- expect_unchecked_state- end- within_custom_field_container(string_project_custom_field) do- expect(page).to have_content('String field')- expect_type("String")- expect_unchecked_state- end+ within_custom_field_container(string_project_custom_field) do+ expect(page).to have_content('String field')+ expect_type("String")+ expect_unchecked_stateend+ end- within_custom_field_section_container(section_for_select_fields) do- within_custom_field_container(list_project_custom_field) do- expect(page).to have_content('List field')- expect_type("List")- expect_unchecked_state- end+ within_custom_field_section_container(section_for_select_fields) do+ within_custom_field_container(list_project_custom_field) do+ expect(page).to have_content('List field')+ expect_type("List")+ expect_unchecked_stateend+ end- within_custom_field_section_container(section_for_multi_select_fields) do- within_custom_field_container(multi_list_project_custom_field) do- expect(page).to have_content('Multi list field')- expect_type("List")- expect_unchecked_state- end+ within_custom_field_section_container(section_for_multi_select_fields) do+ within_custom_field_container(multi_list_project_custom_field) do+ expect(page).to have_content('Multi list field')+ expect_type("List")+ expect_unchecked_stateendend+ end- it 'toggles the mapping state of a project custom field for a specific project when clicked' do- visit project_settings_project_custom_fields_path(project)+ it 'toggles the mapping state of a project custom field for a specific project when clicked' do+ visit project_settings_project_custom_fields_path(project)- within_custom_field_section_container(section_for_input_fields) do- within_custom_field_container(boolean_project_custom_field) do- expect_unchecked_state+ within_custom_field_section_container(section_for_input_fields) do+ within_custom_field_container(boolean_project_custom_field) do+ expect_unchecked_state- page.find("[data-qa-selector='toggle-project-custom-field-mapping-#{boolean_project_custom_field.id}'] > button").click+ page.find("[data-qa-selector='toggle-project-custom-field-mapping-#{boolean_project_custom_field.id}'] > button").click- expect_checked_state # without reloading the page- end+ expect_checked_state # without reloading the pageend+ end- # propely persisted and visible after full page reload- visit project_settings_project_custom_fields_path(project)+ # propely persisted and visible after full page reload+ visit project_settings_project_custom_fields_path(project)- within_custom_field_container(boolean_project_custom_field) do- expect_checked_state- end+ within_custom_field_container(boolean_project_custom_field) do+ expect_checked_state+ end- # only for this project- visit project_settings_project_custom_fields_path(other_project)+ # only for this project+ visit project_settings_project_custom_fields_path(other_project)- within_custom_field_container(boolean_project_custom_field) do- expect_unchecked_state- end+ within_custom_field_container(boolean_project_custom_field) do+ expect_unchecked_stateend+ end- it 'enables all mapping states of a section for a specific project when bulk action button clicked' do- visit project_settings_project_custom_fields_path(project)+ it 'enables all mapping states of a section for a specific project when bulk action button clicked' do+ visit project_settings_project_custom_fields_path(project)- within_custom_field_section_container(section_for_input_fields) do- page.find("[data-qa-selector='enable-all-project-custom-field-mappings-#{section_for_input_fields.id}']").click+ within_custom_field_section_container(section_for_input_fields) do+ page.find("[data-qa-selector='enable-all-project-custom-field-mappings-#{section_for_input_fields.id}']").click- within_custom_field_container(boolean_project_custom_field) do- expect_checked_state- end- within_custom_field_container(string_project_custom_field) do- expect_checked_state- end+ within_custom_field_container(boolean_project_custom_field) do+ expect_checked_stateend+ within_custom_field_container(string_project_custom_field) do+ expect_checked_state+ end+ end- within_custom_field_section_container(section_for_select_fields) do- within_custom_field_container(list_project_custom_field) do- expect_unchecked_state- end+ within_custom_field_section_container(section_for_select_fields) do+ within_custom_field_container(list_project_custom_field) do+ expect_unchecked_stateend+ end- within_custom_field_section_container(section_for_multi_select_fields) do- within_custom_field_container(multi_list_project_custom_field) do- expect_unchecked_state- end+ within_custom_field_section_container(section_for_multi_select_fields) do+ within_custom_field_container(multi_list_project_custom_field) do+ expect_unchecked_stateendend+ end- it 'disables all mapping states of a section for a specific project when bulk action button clicked' do- visit project_settings_project_custom_fields_path(project)+ it 'disables all mapping states of a section for a specific project when bulk action button clicked' do+ visit project_settings_project_custom_fields_path(project)- within_custom_field_section_container(section_for_input_fields) do- page.find("[data-qa-selector='enable-all-project-custom-field-mappings-#{section_for_input_fields.id}']").click+ within_custom_field_section_container(section_for_input_fields) do+ page.find("[data-qa-selector='enable-all-project-custom-field-mappings-#{section_for_input_fields.id}']").click- within_custom_field_container(boolean_project_custom_field) do- expect_checked_state- end- within_custom_field_container(string_project_custom_field) do- expect_checked_state- end+ within_custom_field_container(boolean_project_custom_field) do+ expect_checked_state+ end+ within_custom_field_container(string_project_custom_field) do+ expect_checked_stateend+ end- within_custom_field_section_container(section_for_select_fields) do- within_custom_field_container(list_project_custom_field) do- expect_unchecked_state- end+ within_custom_field_section_container(section_for_select_fields) do+ within_custom_field_container(list_project_custom_field) do+ expect_unchecked_stateend+ end- within_custom_field_section_container(section_for_multi_select_fields) do- within_custom_field_container(multi_list_project_custom_field) do- expect_unchecked_state- end+ within_custom_field_section_container(section_for_multi_select_fields) do+ within_custom_field_container(multi_list_project_custom_field) do+ expect_unchecked_stateend+ end- within_custom_field_section_container(section_for_input_fields) do- page.find("[data-qa-selector='disable-all-project-custom-field-mappings-#{section_for_input_fields.id}']").click+ within_custom_field_section_container(section_for_input_fields) do+ page.find("[data-qa-selector='disable-all-project-custom-field-mappings-#{section_for_input_fields.id}']").click- within_custom_field_container(boolean_project_custom_field) do- expect_unchecked_state- end- within_custom_field_container(string_project_custom_field) do- expect_unchecked_state- end+ within_custom_field_container(boolean_project_custom_field) do+ expect_unchecked_state+ end+ within_custom_field_container(string_project_custom_field) do+ expect_unchecked_stateendend+ end- it 'filters the project custom fields by name with given user input' do- visit project_settings_project_custom_fields_path(project)+ it 'filters the project custom fields by name with given user input' do+ visit project_settings_project_custom_fields_path(project)- fill_in 'project-custom-fields-mapping-filter', with: 'Boolean'+ fill_in 'project-custom-fields-mapping-filter', with: 'Boolean'- within_custom_field_section_container(section_for_input_fields) do- expect(page).to have_content('Boolean field')- expect(page).to have_no_content('String field')- end+ within_custom_field_section_container(section_for_input_fields) do+ expect(page).to have_content('Boolean field')+ expect(page).to have_no_content('String field')+ end- within_custom_field_section_container(section_for_select_fields) do- expect(page).to have_no_content('List field')- end+ within_custom_field_section_container(section_for_select_fields) do+ expect(page).to have_no_content('List field')+ end- within_custom_field_section_container(section_for_multi_select_fields) do- expect(page).to have_no_content('Multi list field')- end+ within_custom_field_section_container(section_for_multi_select_fields) do+ expect(page).to have_no_content('Multi list field')end+ end- it 'shows the project custom field sections in the correct order' do- visit project_settings_project_custom_fields_path(project)+ it 'shows the project custom field sections in the correct order' do+ visit project_settings_project_custom_fields_path(project)- sections = page.all('.op-project-custom-field-section')+ sections = page.all('.op-project-custom-field-section')- expect(sections.size).to eq(3)+ expect(sections.size).to eq(3)- expect(sections[0].text).to include('Input fields')- expect(sections[1].text).to include('Select fields')- expect(sections[2].text).to include('Multi select fields')+ expect(sections[0].text).to include('Input fields')+ expect(sections[1].text).to include('Select fields')+ expect(sections[2].text).to include('Multi select fields')- section_for_input_fields.move_to_bottom+ section_for_input_fields.move_to_bottom- visit project_settings_project_custom_fields_path(project)+ visit project_settings_project_custom_fields_path(project)- sections = page.all('.op-project-custom-field-section')+ sections = page.all('.op-project-custom-field-section')- expect(sections.size).to eq(3)+ expect(sections.size).to eq(3)- expect(sections[0].text).to include('Select fields')- expect(sections[1].text).to include('Multi select fields')- expect(sections[2].text).to include('Input fields')- end+ expect(sections[0].text).to include('Select fields')+ expect(sections[1].text).to include('Multi select fields')+ expect(sections[2].text).to include('Input fields')+ end- it 'shows the project custom fields in the correct order within the sections' do- visit project_settings_project_custom_fields_path(project)+ it 'shows the project custom fields in the correct order within the sections' do+ visit project_settings_project_custom_fields_path(project)- within_custom_field_section_container(section_for_input_fields) do- custom_fields = page.all('.op-project-custom-field')+ within_custom_field_section_container(section_for_input_fields) do+ custom_fields = page.all('.op-project-custom-field')- expect(custom_fields.size).to eq(2)+ expect(custom_fields.size).to eq(2)- expect(custom_fields[0].text).to include('Boolean field')- expect(custom_fields[1].text).to include('String field')- end+ expect(custom_fields[0].text).to include('Boolean field')+ expect(custom_fields[1].text).to include('String field')+ end- boolean_project_custom_field.move_to_bottom+ boolean_project_custom_field.move_to_bottom- visit project_settings_project_custom_fields_path(project)+ visit project_settings_project_custom_fields_path(project)- within_custom_field_section_container(section_for_input_fields) do- custom_fields = page.all('.op-project-custom-field')+ within_custom_field_section_container(section_for_input_fields) do+ custom_fields = page.all('.op-project-custom-field')- expect(custom_fields.size).to eq(2)+ expect(custom_fields.size).to eq(2)- expect(custom_fields[0].text).to include('String field')- expect(custom_fields[1].text).to include('Boolean field')- end+ expect(custom_fields[0].text).to include('String field')+ expect(custom_fields[1].text).to include('Boolean field')endendend