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
[#58160] project list: check for stages and gates feature flag
Tobias Dillmann80d457380582
diff --git a/app/models/queries/projects/selects/life_cycle_step.rb b/app/models/queries/projects/selects/life_cycle_step.rbindex a2190ca0a7f..425b53588bc 100644--- a/app/models/queries/projects/selects/life_cycle_step.rb+++ b/app/models/queries/projects/selects/life_cycle_step.rb@@ -55,7 +55,7 @@ class Queries::Projects::Selects::LifeCycleStep < Queries::Selects::Baseenddef available?- life_cycle_step_definition.present?+ OpenProject::FeatureDecisions.stages_and_gates_active? && life_cycle_step_definition.present?enddef visual_icondiff --git a/spec/features/projects/projects_index_spec.rb b/spec/features/projects/projects_index_spec.rbindex 522998574e3..999bfb9dd7f 100644--- a/spec/features/projects/projects_index_spec.rb+++ b/spec/features/projects/projects_index_spec.rb@@ -339,63 +339,78 @@ RSpec.describe "Projects index page", :js, :with_cuprite, with_settings: { loginshared_let(:inactive_life_cycle_gate) { create(:project_gate, active: false) }shared_let(:inactive_life_cycle_stage) { create(:project_stage, active: false) }- specify "life cycle columns do not show up by default" do- login_as(admin)- projects_page.visit!+ context "with the feature flag disabled", with_flag: { stages_and_gates: false } do+ specify "life cycle columns cannot be configured to show up" do+ login_as(admin)+ projects_page.visit!- expect(page).to have_no_text(life_cycle_gate.definition.name.upcase)- expect(page).to have_no_text(life_cycle_stage.definition.name.upcase)- expect(page).to have_no_text(inactive_life_cycle_gate.definition.name.upcase)- expect(page).to have_no_text(inactive_life_cycle_stage.definition.name.upcase)- end+ # Trying to set the column via configure view+ projects_page.set_columns(life_cycle_gate.definition.name)- specify "life cycle columns show up when configured to do so" do- login_as(admin)- projects_page.visit!+ # It didn't work+ expect(page).to have_no_text(life_cycle_gate.definition.name.upcase)+ end+ end- projects_page.expect_columns("Name")- projects_page.set_columns(life_cycle_gate.definition.name)+ context "with the feature flag enabled", with_flag: { stages_and_gates: true } do+ specify "life cycle columns do not show up by default" do+ login_as(admin)+ projects_page.visit!- expect(page).to have_text(life_cycle_gate.definition.name.upcase)- end+ expect(page).to have_no_text(life_cycle_gate.definition.name.upcase)+ expect(page).to have_no_text(life_cycle_stage.definition.name.upcase)+ expect(page).to have_no_text(inactive_life_cycle_gate.definition.name.upcase)+ expect(page).to have_no_text(inactive_life_cycle_stage.definition.name.upcase)+ end- specify "inactive life cycle columns have no cell content" do- login_as(admin)- projects_page.visit!+ specify "life cycle columns show up when configured to do so" do+ login_as(admin)+ projects_page.visit!- projects_page.expect_columns("Name")+ projects_page.expect_columns("Name")+ projects_page.set_columns(life_cycle_gate.definition.name)- col_names = [life_cycle_gate, life_cycle_stage,- inactive_life_cycle_gate,- inactive_life_cycle_stage].map { |l| l.definition.name }-- projects_page.set_columns(*col_names)- # Inactive columns are still displayed in the header:- projects_page.expect_columns("Name", *col_names)-- gate_project = life_cycle_gate.project- projects_page.within_row(gate_project) do- expect(page).to have_css(".name", text: gate_project.name)- expect(page).to have_css(".lcsd_#{life_cycle_gate.definition.id}", text: "12/13/2024")- # life cycle assigned to other project, no text here- expect(page).to have_css(".lcsd_#{life_cycle_stage.definition.id}", text: "")- # inactive life cycles, no text here- expect(page).to have_css(".lcsd_#{inactive_life_cycle_stage.definition.id}", text: "")- expect(page).to have_css(".lcsd_#{inactive_life_cycle_gate.definition.id}", text: "")+ expect(page).to have_text(life_cycle_gate.definition.name.upcase)end- stage_project = life_cycle_stage.project- projects_page.within_row(stage_project) do- expect(page).to have_css(".name", text: stage_project.name)- expect(page).to have_css(".lcsd_#{life_cycle_stage.definition.id}", text: "12/01/2024 - 12/13/2024")- # life cycle assigned to other project, no text here- expect(page).to have_css(".lcsd_#{life_cycle_gate.definition.id}", text: "")- end+ specify "inactive life cycle columns have no cell content" do+ login_as(admin)+ projects_page.visit!++ projects_page.expect_columns("Name")++ col_names = [life_cycle_gate, life_cycle_stage,+ inactive_life_cycle_gate,+ inactive_life_cycle_stage].map { |l| l.definition.name }++ projects_page.set_columns(*col_names)+ # Inactive columns are still displayed in the header:+ projects_page.expect_columns("Name", *col_names)++ gate_project = life_cycle_gate.project+ projects_page.within_row(gate_project) do+ expect(page).to have_css(".name", text: gate_project.name)+ expect(page).to have_css(".lcsd_#{life_cycle_gate.definition.id}", text: "12/13/2024")+ # life cycle assigned to other project, no text here+ expect(page).to have_css(".lcsd_#{life_cycle_stage.definition.id}", text: "")+ # inactive life cycles, no text here+ expect(page).to have_css(".lcsd_#{inactive_life_cycle_stage.definition.id}", text: "")+ expect(page).to have_css(".lcsd_#{inactive_life_cycle_gate.definition.id}", text: "")+ end- # Inactive life cycle steps never show their date values- other_proj = inactive_life_cycle_stage.project- projects_page.within_row(other_proj) do- expect(page).to have_css(".lcsd_#{inactive_life_cycle_stage.definition.id}", text: "")+ stage_project = life_cycle_stage.project+ projects_page.within_row(stage_project) do+ expect(page).to have_css(".name", text: stage_project.name)+ expect(page).to have_css(".lcsd_#{life_cycle_stage.definition.id}", text: "12/01/2024 - 12/13/2024")+ # life cycle assigned to other project, no text here+ expect(page).to have_css(".lcsd_#{life_cycle_gate.definition.id}", text: "")+ end++ # Inactive life cycle steps never show their date values+ other_proj = inactive_life_cycle_stage.project+ projects_page.within_row(other_proj) do+ expect(page).to have_css(".lcsd_#{inactive_life_cycle_stage.definition.id}", text: "")+ endendendend