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
Add help texts examples to edit settings feature
Alexander Brandon Colesbc02f86c0d4c
diff --git a/spec/features/projects/edit_settings_spec.rb b/spec/features/projects/edit_settings_spec.rbindex 68f1d40afda..7810337f87c 100644--- a/spec/features/projects/edit_settings_spec.rb+++ b/spec/features/projects/edit_settings_spec.rb@@ -229,4 +229,66 @@ RSpec.describe "Projects", "editing settings", :js doendendend++ describe "attribute help texts", :selenium do+ let(:general_page) { Pages::Projects::Settings::General.new(project) }++ context "without attribute help texts defined" do+ before do+ general_page.visit!+ end++ it "shows field labels without help text link" do+ general_page.expect_field_label_without_help_text "Name"+ general_page.expect_field_label_without_help_text "Description"+ general_page.expect_field_label_without_help_text "Project status description"+ general_page.expect_field_label_without_help_text "Subproject of"+ end++ it "does not show help text link next to status button" do+ within_section "Project status" do+ button = find_button("Edit project status")+ expect(page).to have_no_link accessible_name: "Show help text", right_of: button+ end+ end+ end++ context "with attribute help texts defined" do+ let!(:name_help_text) { create(:project_help_text, attribute_name: :name) }+ let!(:description_help_text) { create(:project_help_text, attribute_name: :description) }+ let!(:status_help_text) { create(:project_help_text, attribute_name: :status) }+ let!(:status_description_help_text) { create(:project_help_text, attribute_name: :status_explanation) }+ let!(:subproject_of_help_text) { create(:project_help_text, attribute_name: :parent) }++ before do+ general_page.visit!+ end++ it "shows field labels with help text link" do+ general_page.expect_field_label_with_help_text "Name"+ general_page.expect_field_label_with_help_text "Description"+ general_page.expect_field_label_with_help_text "Project status description"+ general_page.expect_field_label_with_help_text "Subproject of"+ end++ it "shows help text link next to status button" do+ within_section "Project status" do+ button = find_button("Edit project status")+ expect(page).to have_link accessible_name: "Show help text", right_of: button+ end+ end++ it "shows help text modal on clicking help text link" do+ general_page.click_help_text_link_for_label "Description"++ expect(page).to have_modal "Description"+ within_modal "Description" do+ expect(page).to have_text "Attribute help text"++ click_on "Close"+ end+ expect(page).to have_no_modal "Description"+ end+ end+ endenddiff --git a/spec/support/pages/projects/settings/general.rb b/spec/support/pages/projects/settings/general.rbindex 11ce8da2a63..ac1064b7813 100644--- a/spec/support/pages/projects/settings/general.rb+++ b/spec/support/pages/projects/settings/general.rb@@ -50,6 +50,29 @@ module Pagespage.find_test_selector("project-settings-more-menu").clickpage.find_test_selector("project-settings--copy").clickend++ def expect_field_label_with_help_text(label_text)+ expect_field_label(label_text)+ expect(find_field_label(label_text)).to have_link accessible_name: "Show help text"+ end++ def expect_field_label_without_help_text(label_text)+ expect_field_label(label_text)+ expect(find_field_label(label_text)).to have_no_link accessible_name: "Show help text"+ end++ def click_help_text_link_for_label(label_text)+ link = find_field_label(label_text).find(:link, accessible_name: "Show help text")+ link.click+ end++ def expect_field_label(label_text)+ expect(page).to have_element :label, text: label_text+ end++ def find_field_label(label_text)+ page.find(:element, :label, text: label_text)+ endendendend