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]: project storage removal should also maintain current page

Kabiru Mwenja02dd9e1440c8
diff --git a/modules/storages/spec/features/storages/admin/project_storages_spec.rb b/modules/storages/spec/features/storages/admin/project_storages_spec.rb
index fa0d54eaacc..20a2d7f97ae 100644
--- a/modules/storages/spec/features/storages/admin/project_storages_spec.rb
+++ b/modules/storages/spec/features/storages/admin/project_storages_spec.rb
@@ -371,8 +371,15 @@ RSpec.describe "Admin lists project mappings for a storage",
expect(page).to have_text(project.name)
end
- it "is possible to remove the project after checking the confirmation checkbox in the dialog" do
- expect(page).to have_text(project.name)
+ it "is possible to remove the project after checking the confirmation checkbox in the dialog",
+ with_settings: { per_page_options: "2,5" } do
+ projects = create_list(:project, 4)
+ projects.each { |project| create(:project_storage, storage:, project:) }
+
+ current_page = 3
+ visit admin_settings_storage_project_storages_path(storage, page: current_page)
+
+ project = project_storages_index_page.project_in_first_row(column_text_separator: "\t")
project_storages_index_page.click_menu_item_of("Remove project", project)
# The original DeleteService would try to remove actual files from actual storages,
@@ -398,7 +405,7 @@ RSpec.describe "Admin lists project mappings for a storage",
expect(page).to have_no_text(project.name)
aggregate_failures "pagination links maintain the correct url" do
- project_storages_index_page.expect_correct_pagination_links(model: storage)
+ project_storages_index_page.expect_correct_pagination_links(model: storage, current_page:)
end
end
end
diff --git a/spec/support/pages/projects/index.rb b/spec/support/pages/projects/index.rb
index 8aa1d843477..c33a469d875 100644
--- a/spec/support/pages/projects/index.rb
+++ b/spec/support/pages/projects/index.rb
@@ -551,9 +551,9 @@ module Pages
within "#project-table", &
end
- def project_in_first_row
+ def project_in_first_row(column_text_separator: "\n")
first_row = within("#projects-table") { find(".op-project-row-component", match: :first) }
- Project.find_by!(name: first_row.text.split("\n").first)
+ Project.find_by!(name: first_row.text.split(column_text_separator).first)
end
def within_row(project)