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
Add specs to cover sorting in Boards Overview Page
Aaron Contreras00825be9ba03
diff --git a/modules/boards/spec/features/board_overview_spec.rb b/modules/boards/spec/features/board_overview_spec.rbindex d667476a305..853ec456291 100644--- a/modules/boards/spec/features/board_overview_spec.rb+++ b/modules/boards/spec/features/board_overview_spec.rb@@ -164,6 +164,55 @@ RSpec.describe 'Work Package Boards Overview',other_project_board_view)end+ describe 'sorting' do+ it 'allows sorting by "Name", "Project" and "Created on"' do+ # Initial sort is Name ASC+ # We can assert this behavior by expected the order to be+ # 1. board_view+ # 2. other_board_view+ # 3. other_project_board_view+ # upon page load+ aggregate_failures 'Sorting by Name' do+ board_overview.expect_boards_listed_in_order(board_view,+ other_board_view,+ other_project_board_view)++ board_overview.click_to_sort_by('Name')+ board_overview.expect_boards_listed_in_order(other_project_board_view,+ other_board_view,+ board_view)+ end++ aggregate_failures 'Sorting by Project' do+ board_overview.click_to_sort_by('Project')+ # TODO: for Aaron+ # This is the current behavior. Sorting seems to stack with the previous sort+ # even though to the user, one can only sort by a single column at a time.+ # It seems unintuitive to someone who would not know about this. Ask about+ # it in tomorrow's daily.+ board_overview.expect_boards_listed_in_order(other_project_board_view,+ other_board_view,+ board_view)+ board_overview.click_to_sort_by('Project')+ board_overview.expect_boards_listed_in_order(other_board_view,+ board_view,+ other_project_board_view)+ end++ aggregate_failures 'Sorting by Created on' do+ board_overview.click_to_sort_by('Created on')+ board_overview.expect_boards_listed_in_order(board_view,+ other_board_view,+ other_project_board_view)++ board_overview.click_to_sort_by('Created on')+ board_overview.expect_boards_listed_in_order(other_project_board_view,+ other_board_view,+ board_view)+ end+ end+ end+it 'paginates results', with_settings: { per_page_options: '1' } do# First page displays the historically last meetingboard_overview.expect_boards_listed(board_view)diff --git a/modules/boards/spec/features/support/board_list_page.rb b/modules/boards/spec/features/support/board_list_page.rbindex 04f6048e01d..c6717b4598c 100644--- a/modules/boards/spec/features/support/board_list_page.rb+++ b/modules/boards/spec/features/support/board_list_page.rb@@ -63,33 +63,44 @@ module Pagesenddef expect_boards_listed(*boards)- board_names = if boards.all? { |board| board.to_s == board }- boards- else- boards.map(&:name)- end+ expected_board_names = board_names_for(boards)within '#content-wrapper' do- board_names.each do |board_name|+ expected_board_names.each do |board_name|expect(page).to have_selector("td.name", text: board_name)endendend+ 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)+ expect_board_names = board_names_for(boards)++ expect(listed_board_names).to match_array(expect_board_names)+ end+ end+def expect_boards_not_listed(*boards)- board_names = if boards.all? { |board| board.to_s == board }- boards- else- boards.map(&:name)- end+ unexpected_board_names = board_names_for(boards)within '#content-wrapper' do- board_names.each do |board_name|+ unexpected_board_names.each do |board_name|expect(page).not_to have_selector("td.title", text: board_name)endendend+ def board_names_for(boards)+ boards.map { |board| board.to_s == board ? board : board.name }+ end+def expect_no_boards_listedwithin '#content-wrapper' doexpect(page).to have_content I18n.t(:no_results_title_text)