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

Attempt to fix specs.

Dombi Attila2745ba02dfa6
diff --git a/spec/features/projects/projects_index_spec.rb b/spec/features/projects/projects_index_spec.rb
index bc36edf58fb..6abc4517b78 100644
--- a/spec/features/projects/projects_index_spec.rb
+++ b/spec/features/projects/projects_index_spec.rb
@@ -532,7 +532,7 @@ RSpec.describe "Projects index page", :js, :with_cuprite, with_settings: { login
load_and_open_filters admin
# value selection defaults to "active"'
- expect(page).to have_css('li[filter-name="active"]')
+ expect(page).to have_css('li[data-filter-name="active"]')
projects_page.expect_projects_listed(parent_project,
child_project,
@@ -748,7 +748,6 @@ RSpec.describe "Projects index page", :js, :with_cuprite, with_settings: { login
"Created on",
"today")
wait_for_reload
-
expect(page).to have_no_text(project_created_on_this_week.name)
expect(page).to have_text(project_created_on_today.name)
expect(page).to have_no_text(project_created_on_fixed_date.name)
@@ -838,7 +837,7 @@ RSpec.describe "Projects index page", :js, :with_cuprite, with_settings: { login
expect(page).to have_text(project_created_on_today.name)
# switching to multiselect keeps the current selection
- cf_filter = page.find("li[filter-name='#{list_custom_field.column_name}']")
+ cf_filter = page.find("li[data-filter-name='#{list_custom_field.column_name}']")
within(cf_filter) do
# Initial filter is a 'single select'
expect(cf_filter.find(:select, "value")).not_to be_multiple
@@ -851,7 +850,7 @@ RSpec.describe "Projects index page", :js, :with_cuprite, with_settings: { login
end
wait_for_reload
- cf_filter = page.find("li[filter-name='#{list_custom_field.column_name}']")
+ cf_filter = page.find("li[data-filter-name='#{list_custom_field.column_name}']")
within(cf_filter) do
# Query has two values for that filter, so it should show a 'multi select'.
expect(cf_filter.find(:select, "value")).to be_multiple
@@ -871,7 +870,7 @@ RSpec.describe "Projects index page", :js, :with_cuprite, with_settings: { login
end
wait_for_reload
- cf_filter = page.find("li[filter-name='#{list_custom_field.column_name}']")
+ cf_filter = page.find("li[data-filter-name='#{list_custom_field.column_name}']")
within(cf_filter) do
# Query has one value for that filter, so it should show a 'single select'.
expect(cf_filter.find(:select, "value")).not_to be_multiple
@@ -937,7 +936,7 @@ RSpec.describe "Projects index page", :js, :with_cuprite, with_settings: { login
projects_page.expect_projects_listed(development_project)
projects_page.expect_projects_not_listed(project)
# Filter form is visible and the filter is still set.
- expect(page).to have_css("li[filter-name=\"#{list_custom_field.column_name}\"]")
+ expect(page).to have_css("li[data-filter-name=\"#{list_custom_field.column_name}\"]")
end
end
end
diff --git a/spec/support/pages/projects/index.rb b/spec/support/pages/projects/index.rb
index b38aede0718..45c37befd18 100644
--- a/spec/support/pages/projects/index.rb
+++ b/spec/support/pages/projects/index.rb
@@ -213,16 +213,26 @@ module Pages
end
def set_filter(name, human_name, human_operator = nil, values = [])
- return unless values.any?
+ if name == "name_and_identifier"
+ set_simple_filter(name, values)
+ else
+ set_advanced_filter(name, human_name, human_operator, values)
+ end
+ end
- return set_name_and_identifier_filter(values) if name == "name_and_identifier"
+ def set_simple_filter(_name, values)
+ return unless values.any?
+ set_name_and_identifier_filter(values) # This is the only one simple filter at the moment.
+ end
+ def set_advanced_filter(name, human_name, human_operator = nil, values = [])
select human_name, from: "add_filter_select"
selected_filter = page.find("li[data-filter-name='#{name}']")
-
select(human_operator, from: "operator") unless boolean_filter?(name)
within(selected_filter) do
+ return unless values.any?
+
if boolean_filter?(name)
set_toggle_filter(values)
elsif name == "created_at"