Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add missing Projects::Index support methods

Dombi Attila05b34b7bfcbd
diff --git a/spec/features/projects/projects_index_spec.rb b/spec/features/projects/projects_index_spec.rb
index 6230db1fa9d..9bb8105f8c1 100644
--- a/spec/features/projects/projects_index_spec.rb
+++ b/spec/features/projects/projects_index_spec.rb
@@ -172,6 +172,20 @@ RSpec.describe "Projects index page", :js, :with_cuprite, with_settings: { login
)
end
end
+ context "with project attributes" do
+ let!(:list_custom_field) do
+ create(:list_project_custom_field, multi_value: true).tap do |cf|
+ development_project.update(custom_field_values: { cf.id => [cf.value_of("A"), cf.value_of("B")] })
+ project.update(custom_field_values: { cf.id => [cf.value_of("A"), cf.value_of("B")] })
+ end
+ end
+
+ it "cannot see the project attribute field in the filter section" do
+ load_and_open_filters user
+
+ expect(page).to have_no_select("add_filter_select", with_options: [list_custom_field.name])
+ end
+ end
end
context "for admins" do
diff --git a/spec/support/pages/projects/index.rb b/spec/support/pages/projects/index.rb
index 3d41811496a..a59dcf5add1 100644
--- a/spec/support/pages/projects/index.rb
+++ b/spec/support/pages/projects/index.rb
@@ -71,6 +71,33 @@ module Pages
end
end
+ def expect_project_at_place(project, place)
+ within_table do
+ expect(page)
+ .to have_css(".project:nth-of-type(#{place}) td.name", text: project.name)
+ end
+ end
+
+ def expect_projects_in_order(*projects)
+ projects.each_with_index do |project, index|
+ expect_project_at_place(project, index + 1)
+ end
+ end
+
+ def expect_project_attribute_value(project, custom_field, value)
+ within_table do
+ expect(page)
+ .to have_css("#project-#{project.id} td.#{custom_field.column_name}", text: value)
+ end
+ end
+
+ def expect_empty_project_attribute_value(project, custom_field)
+ within_table do
+ expect(page)
+ .to have_css("#project-#{project.id} td.#{custom_field.column_name}", text: "")
+ end
+ end
+
def expect_title(name)
expect(page).to have_css('[data-test-selector="project-query-name"]', text: name)
end