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 accessibility specs for alternative filter matches

Aaron Contreras2afb0cf1e211
diff --git a/spec/features/a11y/work_packages/alternative_name_autcompleting_spec.rb b/spec/features/a11y/work_packages/alternative_name_autcompleting_spec.rb
new file mode 100644
index 00000000000..7cefaacbc1c
--- /dev/null
+++ b/spec/features/a11y/work_packages/alternative_name_autcompleting_spec.rb
@@ -0,0 +1,64 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+# ++
+
+require 'spec_helper'
+
+RSpec.describe "Alternative name autocompleting",
+ :js,
+ :with_cuprite do
+ let!(:project) { create(:project_with_types) }
+ let!(:work_package) { create(:work_package, project:) }
+ let!(:user) { create(:admin) }
+
+ let(:work_packages_page) { Pages::WorkPackagesTable.new(project) }
+ let(:filters) { Components::WorkPackages::Filters.new }
+
+ before { login_as(user) }
+
+ describe 'Work package filter autocompleter' do
+ it 'allows discovering attributes by alternative names' do
+ work_packages_page.visit!
+ work_packages_page.expect_work_package_listed(work_package)
+
+ filters.open!
+
+ # Exact alternative match
+ filters.expect_alternative_available_filter('Progress', '% Complete')
+ # Partial alternative match
+ filters.expect_alternative_available_filter('rog', '% Complete')
+ # Exact "real" match
+ filters.expect_alternative_available_filter('% Complete', '% Complete')
+ # Partial "real" match
+ filters.expect_alternative_available_filter('Comp', '% Complete')
+ # Indifferent to casing
+ filters.expect_alternative_available_filter('comp', '% Complete')
+ end
+ end
+end
diff --git a/spec/support/components/work_packages/filters.rb b/spec/support/components/work_packages/filters.rb
index 04fa768107e..4a050632694 100644
--- a/spec/support/components/work_packages/filters.rb
+++ b/spec/support/components/work_packages/filters.rb
@@ -48,6 +48,11 @@ module Components
end
end
+ def open!
+ open
+ expect_open
+ end
+
def expect_filter_count(num)
expect(filter_button).to have_css('.badge', text: num, wait: 10)
end
@@ -96,6 +101,16 @@ module Components
input.set ""
end
+ def expect_alternative_available_filter(search_term, displayed_name)
+ input = page.find('.advanced-filters--add-filter-value input')
+ input.set(search_term)
+
+ expect(page)
+ .to have_css('.ng-dropdown-panel .ng-option-label', text: displayed_name)
+
+ input.set('')
+ end
+
def expect_loaded
SeleniumHubWaiter.wait
expect(filter_button).to have_css('.badge', wait: 2, visible: :all)