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
tests[Op#57989]: pagination links should have page param
Kabiru Mwenja368ec4da83d7
diff --git a/spec/features/admin/custom_fields/custom_fields_project_spec.rb b/spec/features/admin/custom_fields/custom_fields_project_spec.rbindex 8081ae4c153..d77540491ba 100644--- a/spec/features/admin/custom_fields/custom_fields_project_spec.rb+++ b/spec/features/admin/custom_fields/custom_fields_project_spec.rb@@ -115,15 +115,7 @@ RSpec.describe "Custom Fields Multi-Project Activation", :js doexpect(page).to have_text(subproject.name)aggregate_failures "pagination links maintain the correct url" do- within ".op-pagination" do- pagination_links = page.all(".op-pagination--item-link")- expect(pagination_links.size).to be_positive-- pagination_links.each do |pagination_link|- uri = URI.parse(pagination_link["href"])- expect(uri.path).to eq(custom_field_projects_path(custom_field))- end- end+ custom_field_projects_page.expect_correct_pagination_links(model: custom_field)endend@@ -138,15 +130,7 @@ RSpec.describe "Custom Fields Multi-Project Activation", :js doexpect(page).to have_no_text(project.name)aggregate_failures "pagination links maintain the correct url after unlinking is done" do- within ".op-pagination" do- pagination_links = page.all(".op-pagination--item-link")- expect(pagination_links.size).to be_positive-- pagination_links.each do |pagination_link|- uri = URI.parse(pagination_link["href"])- expect(uri.path).to eq(custom_field_projects_path(custom_field))- end- end+ custom_field_projects_page.expect_correct_pagination_links(model: custom_field)endenddiff --git a/spec/features/admin/project_custom_fields/project_mappings_spec.rb b/spec/features/admin/project_custom_fields/project_mappings_spec.rbindex ea0eee6e21e..9742080eee5 100644--- a/spec/features/admin/project_custom_fields/project_mappings_spec.rb+++ b/spec/features/admin/project_custom_fields/project_mappings_spec.rb@@ -119,15 +119,7 @@ RSpec.describe "Project Custom Field Mappings", :js doexpect(page).to have_text(subproject.name)aggregate_failures "pagination links maintain the correct url" do- within ".op-pagination" do- pagination_links = page.all(".op-pagination--item-link")- expect(pagination_links.size).to be_positive-- pagination_links.each do |pagination_link|- uri = URI.parse(pagination_link["href"])- expect(uri.path).to eq(project_mappings_admin_settings_project_custom_field_path(project_custom_field))- end- end+ project_custom_field_mappings_page.expect_correct_pagination_links(model: project_custom_field)endend@@ -142,15 +134,7 @@ RSpec.describe "Project Custom Field Mappings", :js doexpect(page).to have_no_text(project.name)aggregate_failures "pagination links maintain the correct url after unlinking is done" do- within ".op-pagination" do- pagination_links = page.all(".op-pagination--item-link")- expect(pagination_links.size).to be_positive-- pagination_links.each do |pagination_link|- uri = URI.parse(pagination_link["href"])- expect(uri.path).to eq(project_mappings_admin_settings_project_custom_field_path(project_custom_field))- end- end+ project_custom_field_mappings_page.expect_correct_pagination_links(model: project_custom_field)endenddiff --git a/spec/support/pages/admin/custom_fields/custom_fields_projects/custom_field_projects_index.rb b/spec/support/pages/admin/custom_fields/custom_fields_projects/custom_field_projects_index.rbindex a170b17e58e..1b692f34369 100644--- a/spec/support/pages/admin/custom_fields/custom_fields_projects/custom_field_projects_index.rb+++ b/spec/support/pages/admin/custom_fields/custom_fields_projects/custom_field_projects_index.rb@@ -33,17 +33,32 @@ module Pagesmodule CustomFieldsmodule CustomFieldsProjectsclass CustomFieldProjectsIndex < ::Pages::Projects::Index- def path+ def path(custom_field)"/custom_fields/#{custom_field.id}/projects"enddef within_row(project)- row = page.find("#admin-custom-fields-custom-field-projects-row-component-project-#{project.id}")+ row = page.find("#{row_id_prefix}-#{project.id}")row.hoverwithin row doyield rowendend++ def expect_correct_pagination_links(model:)+ within ".op-pagination" do+ pagination_links = page.all(".op-pagination--item-link")+ expect(pagination_links.size).to be_positive++ pagination_links.each.with_index(1) do |pagination_link, page_number|+ uri = URI.parse(pagination_link["href"])+ expect(uri.path).to eq(path(model))+ expect(uri.query).to include("page=#{page_number}")+ end+ end+ end++ def row_id_prefix = "#admin-custom-fields-custom-field-projects-row-component-project"endendenddiff --git a/spec/support/pages/admin/settings/project_custom_fields/project_custom_field_mappings_index.rb b/spec/support/pages/admin/settings/project_custom_fields/project_custom_field_mappings_index.rbindex ab41fabafb8..136762591a4 100644--- a/spec/support/pages/admin/settings/project_custom_fields/project_custom_field_mappings_index.rb+++ b/spec/support/pages/admin/settings/project_custom_fields/project_custom_field_mappings_index.rb@@ -32,18 +32,12 @@ module Pagesmodule Adminmodule Settingsmodule ProjectCustomFields- class ProjectCustomFieldMappingsIndex < ::Pages::Projects::Index- def path+ class ProjectCustomFieldMappingsIndex < ::Pages::Admin::CustomFields::CustomFieldsProjects::CustomFieldProjectsIndex+ def path(project_custom_field)"/admin/settings/project_custom_fields/#{project_custom_field.id}/project_mappings"end- def within_row(project)- row = page.find("#settings-project-custom-fields-project-custom-field-mapping-row-component-project-#{project.id}")- row.hover- within row do- yield row- end- end+ def row_id_prefix = "#settings-project-custom-fields-project-custom-field-mapping-row-component-project"endendend