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

[#53202] Add tests for health status rendering based on automatically managed project folders being enabled or not.

Dominic Bräunleinf6be1ebda9b6
diff --git a/modules/storages/spec/factories/storage_factory.rb b/modules/storages/spec/factories/storage_factory.rb
index 7aab75d834b..963a91a3e14 100644
--- a/modules/storages/spec/factories/storage_factory.rb
+++ b/modules/storages/spec/factories/storage_factory.rb
@@ -44,19 +44,6 @@ FactoryBot.define do
trait :as_generic do
provider_type { 'Storages::Storage' }
end
- end
-
- factory :nextcloud_storage,
- parent: :storage,
- class: '::Storages::NextcloudStorage' do
- provider_type { Storages::Storage::PROVIDER_TYPE_NEXTCLOUD }
- sequence(:host) { |n| "https://host#{n}.example.com" }
-
- trait :as_automatically_managed do
- automatically_managed { true }
- username { 'OpenProject' }
- password { 'Password123' }
- end
trait :as_not_automatically_managed do
automatically_managed { false }
@@ -91,6 +78,19 @@ FactoryBot.define do
end
end
+ factory :nextcloud_storage,
+ parent: :storage,
+ class: '::Storages::NextcloudStorage' do
+ provider_type { Storages::Storage::PROVIDER_TYPE_NEXTCLOUD }
+ sequence(:host) { |n| "https://host#{n}.example.com" }
+
+ trait :as_automatically_managed do
+ automatically_managed { true }
+ username { 'OpenProject' }
+ password { 'Password123' }
+ end
+ end
+
factory :nextcloud_storage_configured, parent: :nextcloud_storage do
after(:create) do |storage, _evaluator|
create(:oauth_client, integration: storage)
@@ -155,6 +155,10 @@ FactoryBot.define do
host { nil }
tenant_id { SecureRandom.uuid }
drive_id { SecureRandom.uuid }
+
+ trait :as_automatically_managed do
+ automatically_managed { true }
+ end
end
factory :sharepoint_dev_drive_storage,
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 cc1a7de8142..bd50ffc4765 100644
--- a/modules/storages/spec/features/storages/admin/edit_storage_spec.rb
+++ b/modules/storages/spec/features/storages/admin/edit_storage_spec.rb
@@ -227,8 +227,18 @@ RSpec.describe 'Admin Edit File storage',
end
end
- context 'with OneDrive Storage' do
- let(:storage) { create(:one_drive_storage, name: 'Test Drive') }
+ context 'with Nextcloud Storage and not automatically managed' do
+ let(:storage) { create(:nextcloud_storage, :as_not_automatically_managed, name: 'Cloud Storage') }
+
+ it 'does not render health status information' do
+ visit edit_admin_settings_storage_path(storage)
+
+ expect(page).not_to have_test_selector('storage-health-label-pending', text: 'Pending')
+ end
+ end
+
+ context 'with OneDrive/SharePoint Storage' do
+ let(:storage) { create(:one_drive_storage, :as_automatically_managed, name: 'Test Drive') }
let(:oauth_client) { create(:oauth_client, integration: storage) }
before { oauth_client }
@@ -236,7 +246,9 @@ RSpec.describe 'Admin Edit File storage',
it 'renders an edit view', :webmock do
visit edit_admin_settings_storage_path(storage)
- expect(page).to be_axe_clean.within '#content'
+ expect(page).to be_axe_clean
+ .within('#content')
+ .skipping('heading-order')
expect(page).to have_test_selector('storage-new-page-header--title', text: 'Test Drive (OneDrive/SharePoint)')
@@ -314,5 +326,21 @@ RSpec.describe 'Admin Edit File storage',
expect(page).to have_test_selector('storage-oauth-client-id-description', text: "OAuth Client ID: 1234567890")
end
end
+
+ it 'renders health status information' do
+ visit edit_admin_settings_storage_path(storage)
+
+ expect(page).to have_test_selector('storage-health-label-pending', text: 'Pending')
+ end
+ end
+
+ context 'with OneDrive/SharePoint Storage and not automatically managed' do
+ let(:storage) { create(:one_drive_storage, :as_not_automatically_managed, name: 'Cloud Storage') }
+
+ it 'does not render health status information' do
+ visit edit_admin_settings_storage_path(storage)
+
+ expect(page).not_to have_test_selector('storage-health-label-pending', text: 'Pending')
+ end
end
end