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

tests[Op#57989]: elevate project pagination link assertions to base projects index

Kabiru Mwenjadf6bfc5280bb
diff --git a/modules/storages/spec/support/pages/admin/storages/project_storages/project_storages_index.rb b/modules/storages/spec/support/pages/admin/storages/project_storages/project_storages_index.rb
index b1008cb411a..ebd99db68b2 100644
--- a/modules/storages/spec/support/pages/admin/storages/project_storages/project_storages_index.rb
+++ b/modules/storages/spec/support/pages/admin/storages/project_storages/project_storages_index.rb
@@ -33,7 +33,7 @@ module Pages
module Storages
module ProjectStorages
class Index < ::Pages::Projects::Index
- def path
+ def path(storage)
"/admin/settings/storages/#{storage.id}/project_storages"
end
diff --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.rb
index 1b692f34369..78fb409497e 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
@@ -45,19 +45,6 @@ module Pages
end
end
- 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"
end
end
diff --git a/spec/support/pages/projects/index.rb b/spec/support/pages/projects/index.rb
index 66810eb38d4..9b504a33526 100644
--- a/spec/support/pages/projects/index.rb
+++ b/spec/support/pages/projects/index.rb
@@ -33,7 +33,7 @@ module Pages
class Index < ::Pages::Page
include ::Components::Autocompleter::NgSelectAutocompleteHelpers
- def path
+ def path(*)
"/projects"
end
@@ -127,6 +127,19 @@ module Pages
end
end
+ 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 expect_filters_container_toggled
expect(page).to have_css(".op-filters-form")
end