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

[#53718] amended feature spec to cover new one drive form

Eric Schuberta7e90720f619
diff --git a/modules/storages/app/components/storages/admin/forms/access_management_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/access_management_form_component.html.erb
index f8a28e105a9..dbb415d7edb 100644
--- a/modules/storages/app/components/storages/admin/forms/access_management_form_component.html.erb
+++ b/modules/storages/app/components/storages/admin/forms/access_management_form_component.html.erb
@@ -11,7 +11,9 @@
end
access_management_row.with_row(mb: 3) do
- render(Primer::Beta::Text.new) { I18n.t(:'storages.file_storage_view.access_management.description') }
+ render(Primer::Beta::Text.new(test_selector: 'storage-access-management-description')) do
+ I18n.t(:'storages.file_storage_view.access_management.description')
+ end
end
access_management_row.with_row do
diff --git a/modules/storages/app/components/storages/admin/storage_view_information.rb b/modules/storages/app/components/storages/admin/storage_view_information.rb
index 880c5a06424..baf91d6b529 100644
--- a/modules/storages/app/components/storages/admin/storage_view_information.rb
+++ b/modules/storages/app/components/storages/admin/storage_view_information.rb
@@ -18,7 +18,7 @@ module Storages::Admin
if storage.provider_type_nextcloud?
configuration_check_label_for(:host_name_configured)
elsif storage.provider_type_one_drive?
- configuration_check_label_for(:host_name_configured, :storage_tenant_drive_configured)
+ configuration_check_label_for(:name_configured, :storage_tenant_drive_configured)
end
end
diff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rb
index f412710a9b9..6b06e92efac 100644
--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb
@@ -85,7 +85,7 @@ class Storages::Admin::StoragesController < ApplicationController
def select_provider
@object = Storages::Storage.new(provider_type: @provider_type)
- service_result = ::Storages::Storages::SetProviderFieldsAttributesService
+ service_result = ::Storages::Storages::SetAttributesService
.new(user: current_user,
model: @object,
contract_class: EmptyContract)
diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml
index dfbaa453e64..e0acc1e502e 100644
--- a/modules/storages/config/locales/en.yml
+++ b/modules/storages/config/locales/en.yml
@@ -79,10 +79,10 @@ en:
error_invalid_provider_type: Please select a valid storage provider.
file_storage_view:
access_management:
- automatic_management: Automatically managed access and folders.
+ automatic_management: Automatically managed access and folders
automatic_management_description: Let OpenProject create folders per project automatically and manage its user access. This is recommended as it ensures that every team member has always the correct access permissions.
description: Select the type of management of user access and folder creation. We recommend to use the Automatically managed access to have a more organised structure and guarantee access to all relevant users.
- manual_management: Manually managed access and folders.
+ manual_management: Manually managed access and folders
manual_management_description: Create and manage folders per project manually on your own. You will need to manually ensure relevant users have access.
setup_incomplete: Select the type of management of user access and folder creation.
subtitle: Access management
diff --git a/modules/storages/spec/components/storages/admin/access_management_component_spec.rb b/modules/storages/spec/components/storages/admin/access_management_component_spec.rb
index 9eb73321400..f890954e6aa 100644
--- a/modules/storages/spec/components/storages/admin/access_management_component_spec.rb
+++ b/modules/storages/spec/components/storages/admin/access_management_component_spec.rb
@@ -51,7 +51,7 @@ RSpec.describe Storages::Admin::AccessManagementComponent, type: :component do
let(:storage) { create(:one_drive_storage, :as_automatically_managed) }
it "renders the access management description" do
- expect(page).to have_text("Automatically managed access and folders.")
+ expect(page).to have_text("Automatically managed access and folders")
expect(page).to have_test_selector("label-access_management_configured-status", text: "Completed")
end
end
@@ -60,7 +60,7 @@ RSpec.describe Storages::Admin::AccessManagementComponent, type: :component do
let(:storage) { create(:one_drive_storage, :as_not_automatically_managed) }
it "renders the access management description" do
- expect(page).to have_text("Manually managed access and folders.")
+ expect(page).to have_text("Manually managed access and folders")
expect(page).to have_test_selector("label-access_management_configured-status", text: "Completed")
end
end
diff --git a/modules/storages/spec/factories/storage_factory.rb b/modules/storages/spec/factories/storage_factory.rb
index bcce415cdc6..ec7232cb53c 100644
--- a/modules/storages/spec/factories/storage_factory.rb
+++ b/modules/storages/spec/factories/storage_factory.rb
@@ -163,6 +163,8 @@ FactoryBot.define do
factory :sharepoint_dev_drive_storage,
parent: :one_drive_storage do
+ automatically_managed { false }
+
transient do
oauth_client_token_user { association :user }
end
diff --git a/modules/storages/spec/features/storages/admin/create_storage_spec.rb b/modules/storages/spec/features/storages/admin/create_storage_spec.rb
index 85e7892292f..9df57620b0e 100644
--- a/modules/storages/spec/features/storages/admin/create_storage_spec.rb
+++ b/modules/storages/spec/features/storages/admin/create_storage_spec.rb
@@ -227,6 +227,13 @@ RSpec.describe "Admin Create a new file storage",
"doing the setup. In the portal, you also need to register an " \
"Azure application or use an existing one for authentication.")
+ # Access Management
+ wait_for(page).to have_test_selector("access-management-label", text: "Access management")
+ expect(page).not_to have_test_selector("label-access_management_configured-status")
+ expect(page).to have_text("Select the type of management of user access and folder creation.")
+ expect(page).to have_test_selector("access-management-description",
+ text: "Select the type of management of user access and folder creation.")
+
# OAuth client
wait_for(page).to have_test_selector("storage-oauth-client-label", text: "Azure OAuth")
expect(page).not_to have_test_selector("label-storage_oauth_client_configured-status")
@@ -249,11 +256,29 @@ RSpec.describe "Admin Create a new file storage",
click_on "Save and continue"
end
- wait_for(page).to have_test_selector("label-host_name_configured-storage_tenant_drive_configured-status",
+ wait_for(page).to have_test_selector("label-name_configured-storage_tenant_drive_configured-status",
text: "Completed")
expect(page).to have_test_selector("storage-description", text: "OneDrive/SharePoint - My OneDrive")
end
+ aggregate_failures "Access Management" do
+ within_test_selector("storage-access-management-form") do
+ expect(page).to have_test_selector("storage-access-management-description",
+ text: "Select the type of management of user access and folder " \
+ "creation. We recommend to use the Automatically managed access " \
+ "to have a more organised structure and guarantee access to all " \
+ "relevant users.")
+ expect(page).to have_checked_field("Automatically managed access and folders")
+ expect(page).to have_unchecked_field("Manually managed access and folders")
+
+ choose "Manually managed access and folders"
+ click_on "Save and continue"
+ end
+
+ wait_for(page).to have_test_selector("label-access_management_configured-status", text: "Completed")
+ expect(page).to have_test_selector("access-management-description", text: "Manually managed access and folders")
+ end
+
aggregate_failures "OAuth Client" do
within_test_selector("storage-oauth-client-form") do
expect(page).to have_test_selector("storage-provider-credentials-instructions",
diff --git a/modules/storages/spec/features/storages/admin/edit_storage_spec.rb b/modules/storages/spec/features/storages/admin/edit_storage_spec.rb
index bbe471e671a..6ebf2d48882 100644
--- a/modules/storages/spec/features/storages/admin/edit_storage_spec.rb
+++ b/modules/storages/spec/features/storages/admin/edit_storage_spec.rb
@@ -255,7 +255,7 @@ RSpec.describe "Admin Edit File storage",
aggregate_failures "Storage edit view" do
# General information
expect(page).to have_test_selector("storage-provider-label", text: "Storage provider")
- expect(page).to have_test_selector("label-host_name_configured-storage_tenant_drive_configured-status",
+ expect(page).to have_test_selector("label-name_configured-storage_tenant_drive_configured-status",
text: "Completed")
expect(page).to have_test_selector("storage-description", text: "OneDrive/SharePoint - Test Drive")