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

Extract `#click_to_sort_by` into parent Page Class

Aaron Contrerasb71416b41d60
diff --git a/modules/boards/spec/features/support/board_list_page.rb b/modules/boards/spec/features/support/board_list_page.rb
index c6717b4598c..3f04747de6f 100644
--- a/modules/boards/spec/features/support/board_list_page.rb
+++ b/modules/boards/spec/features/support/board_list_page.rb
@@ -72,12 +72,6 @@ module Pages
end
end
- def click_to_sort_by(header_name)
- within '.generic-table thead' do
- click_link header_name
- end
- end
-
def expect_boards_listed_in_order(*boards)
within '#content-wrapper' do
listed_board_names = all("td.name").map(&:text)
diff --git a/modules/calendar/spec/support/pages/calendar.rb b/modules/calendar/spec/support/pages/calendar.rb
index f52501f1066..a7c267fbebe 100644
--- a/modules/calendar/spec/support/pages/calendar.rb
+++ b/modules/calendar/spec/support/pages/calendar.rb
@@ -175,12 +175,6 @@ module Pages
expect(page).not_to have_selector 'td', text: query.name
end
- def click_to_sort_by(header_name)
- within '.generic-table thead' do
- click_link header_name
- end
- end
-
def expect_views_listed_in_order(*queries)
within '.generic-table tbody' do
listed_view_names = all('tr td.name').map(&:text)
diff --git a/modules/meeting/spec/support/pages/meetings/index.rb b/modules/meeting/spec/support/pages/meetings/index.rb
index a1357b95d68..fa29f97b61e 100644
--- a/modules/meeting/spec/support/pages/meetings/index.rb
+++ b/modules/meeting/spec/support/pages/meetings/index.rb
@@ -82,12 +82,6 @@ module Pages::Meetings
end
end
- def click_to_sort_by(header_name)
- within '.generic-table thead' do
- click_link header_name
- end
- end
-
def set_sidebar_filter(filter_name)
within '#main-menu' do
click_link text: filter_name
diff --git a/modules/team_planner/spec/support/pages/team_planner.rb b/modules/team_planner/spec/support/pages/team_planner.rb
index 75d805f4d71..7de934212f1 100644
--- a/modules/team_planner/spec/support/pages/team_planner.rb
+++ b/modules/team_planner/spec/support/pages/team_planner.rb
@@ -183,12 +183,6 @@ module Pages
end
end
- def click_to_sort_by(header_name)
- within '.generic-table thead' do
- click_link header_name
- end
- end
-
def expect_views_listed_in_order(*queries)
within '.generic-table tbody' do
listed_view_names = all('tr td.name').map(&:text)
diff --git a/spec/support/pages/page.rb b/spec/support/pages/page.rb
index bf2a1e7c684..2a36a758f37 100644
--- a/spec/support/pages/page.rb
+++ b/spec/support/pages/page.rb
@@ -121,6 +121,12 @@ module Pages
end
end
+ def click_to_sort_by(header_name)
+ within '.generic-table thead' do
+ click_link header_name
+ end
+ end
+
def drag_and_drop_list(from:, to:, elements:, handler:)
# Wait a bit because drag & drop in selenium is easily offended
sleep 1