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#55966]: add feature test for storage activation

Kabiru Mwenja578a1a2253dd
diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml
index db6614f7b89..bf8894bde5c 100644
--- a/modules/storages/config/locales/en.yml
+++ b/modules/storages/config/locales/en.yml
@@ -23,6 +23,8 @@ en:
attributes:
project_folder_mode:
mode_unavailable: is not available for this storage.
+ project_ids:
+ blank: Please select a project.
storages/storage:
attributes:
host:
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 7e621e9ce3b..55d6edfd8c8 100644
--- a/modules/storages/spec/features/storages/admin/project_storages_spec.rb
+++ b/modules/storages/spec/features/storages/admin/project_storages_spec.rb
@@ -33,7 +33,7 @@ require_module_spec_helper
RSpec.describe "Admin lists project mappings for a storage",
:js,
- :storage_server_helpers,
+ :with_cuprite,
with_flag: { enable_storage_for_multiple_projects: true } do
shared_let(:admin) { create(:admin, preferences: { time_zone: "Etc/UTC" }) }
shared_let(:non_admin) { create(:user) }
@@ -111,5 +111,52 @@ RSpec.describe "Admin lists project mappings for a storage",
end
end
end
+
+ it "shows an error in the dialog when no project is selected before adding" do
+ create(:project)
+ expect(page).to have_no_css("dialog")
+ click_on "Add projects"
+
+ page.within("dialog") do
+ click_on "Add"
+
+ wait_for(page).to have_text("Please select a project.")
+ end
+ end
+
+ it "allows linking a project to a storage" do
+ project = create(:project)
+ subproject = create(:project, parent: project)
+ click_on "Add projects"
+
+ within("dialog") do
+ autocompleter = page.find(".op-project-autocompleter")
+ autocompleter.fill_in with: project.name
+
+ expect(page).to have_no_text(archived_project.name)
+
+ find(".ng-option-label", text: project.name).click
+ check "Include sub-projects"
+
+ expect(page.find_by_id("storages_project_storage_project_folder_mode_automatic")).to be_checked
+
+ click_on "Add"
+ end
+
+ expect(page).to have_text(project.name)
+ expect(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(admin_settings_storage_project_storages_path(storage))
+ end
+ end
+ end
+ end
end
end