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#50212]: add tests for edit view

Kabiru Mwenjae58cbb99c1ea
diff --git a/modules/storages/app/components/storages/admin/storage_view_component.html.erb b/modules/storages/app/components/storages/admin/storage_view_component.html.erb
index 95c6ed6144f..633e2b43d3c 100644
--- a/modules/storages/app/components/storages/admin/storage_view_component.html.erb
+++ b/modules/storages/app/components/storages/admin/storage_view_component.html.erb
@@ -12,7 +12,7 @@
render(OpTurbo::FrameComponent.new(storage, context: :storage_view_general_info)) do
grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|
grid.with_area(:item, tag: :div, mr: 3) do
- concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.storage_provider') })
+ concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1, test_selector: 'storage-provider-label')) { I18n.t('storages.file_storage_view.storage_provider') })
concat(configuration_check_label_for(:host_name_configured))
end
@@ -52,7 +52,7 @@
render(OpTurbo::FrameComponent.new(storage, context: :openproject_oauth)) do
grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|
grid.with_area(:item, tag: :div, mr: 3) do
- concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.openproject_oauth') })
+ concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1, test_selector: 'storage-openproject-oauth-label')) { I18n.t('storages.file_storage_view.openproject_oauth') })
concat(configuration_check_label_for(:openproject_oauth_application_configured))
end
@@ -93,7 +93,7 @@
render(OpTurbo::FrameComponent.new(storage, context: :oauth_client)) do
grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|
grid.with_area(:item, tag: :div, mr: 3) do
- concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.nextcloud_oauth') })
+ concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1, test_selector: 'storage-oauth-client-label')) { I18n.t('storages.file_storage_view.nextcloud_oauth') })
concat(configuration_check_label_for(:storage_oauth_client_configured))
end
@@ -134,7 +134,7 @@
render(OpTurbo::FrameComponent.new(storage, context: :automatically_managed_project_folders)) do
grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|
grid.with_area(:item, tag: :div, mr: 3) do
- concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.automatically_managed_folders') })
+ concat(render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1, test_selector: 'storage-managed-project-folders-label')) { I18n.t('storages.file_storage_view.automatically_managed_folders') })
concat(automatically_managed_project_folders_status_label)
end
diff --git a/modules/storages/spec/features/admin_storages_spec.rb b/modules/storages/spec/features/admin_storages_spec.rb
index 84197b35c7c..aca420bdb63 100644
--- a/modules/storages/spec/features/admin_storages_spec.rb
+++ b/modules/storages/spec/features/admin_storages_spec.rb
@@ -100,10 +100,33 @@ RSpec.describe 'Admin storages',
expect(page).to have_test_selector('storage-name-title', text: storage.name.capitalize)
aggregate_failures 'General information' do
+ expect(page).to have_test_selector('storage-provider-label', text: 'Storage provider')
+ expect(page).to have_test_selector('label-host_name_configured-status', text: 'Connected')
expect(page).to have_test_selector('storage-description', text: [storage.short_provider_type.capitalize,
storage.name,
storage.host].join(' - '))
end
+
+ aggregate_failures 'OAuth application' do
+ expect(page).to have_test_selector('storage-openproject-oauth-label', text: 'OpenProject OAuth')
+ expect(page).to have_test_selector('label-openproject_oauth_application_configured-status', text: 'Incomplete')
+ end
+
+ aggregate_failures 'Nextcloud OAuth' do
+ expect(page).to have_test_selector('storage-oauth-client-label', text: 'Nextcloud OAuth')
+ expect(page).to have_test_selector('label-storage_oauth_client_configured-status', text: 'Incomplete')
+ expect(page).to have_test_selector('storage-oauth-client-id-description',
+ text: "Allow OpenProject to access Nextcloud data using an OAuth.")
+ end
+
+ aggregate_failures 'Automatically managed project folders' do
+ expect(page).to have_test_selector('storage-managed-project-folders-label',
+ text: 'Automatically managed folders')
+ expect(page).to have_test_selector('label-managed-project-folders-status',
+ text: 'Incomplete')
+ expect(page).to have_test_selector('storage-automatically-managed-project-folders-description',
+ text: 'Let OpenProject create folders per project automatically.')
+ end
end
end