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

test[Op#51022]: Update admin storages feature specs

Kabiru Mwenja43b9b889ea80
diff --git a/modules/storages/app/components/storages/admin/new_storage_button_component.html.erb b/modules/storages/app/components/storages/admin/new_storage_button_component.html.erb
index 4d5d61567ac..e37e9caa770 100644
--- a/modules/storages/app/components/storages/admin/new_storage_button_component.html.erb
+++ b/modules/storages/app/components/storages/admin/new_storage_button_component.html.erb
@@ -1,5 +1,5 @@
<%=
- render(Primer::Alpha::ActionMenu.new) do |menu|
+ render(Primer::Alpha::ActionMenu.new(test_selector: 'storages-select-provider-action-menu')) do |menu|
menu.with_show_button(**show_button_options) do |button|
button.with_leading_visual_icon(icon: :plus)
label
diff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rb
index c248bfa5cc6..7018e180e31 100644
--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb
@@ -107,9 +107,7 @@ class Storages::Admin::StoragesController < ApplicationController
@oauth_application = oauth_application(service_result)
service_result.on_failure do
- respond_to do |format|
- format.turbo_stream { render :select_provider }
- end
+ render :new
end
service_result.on_success do
diff --git a/modules/storages/app/views/storages/admin/storages/edit.html.erb b/modules/storages/app/views/storages/admin/storages/edit.html.erb
index b06bc99be6e..c02a6204ec2 100644
--- a/modules/storages/app/views/storages/admin/storages/edit.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/edit.html.erb
@@ -31,7 +31,7 @@ See COPYRIGHT and LICENSE files for more details.
<% local_assigns[:additional_breadcrumb] = @storage.name %>
<%= render(Primer::OpenProject::PageHeader.new) do |header| %>
- <% header.with_title(test_selector: 'storage-name-title') do %>
+ <% header.with_title(test_selector: 'storage-new-page-header--title') do %>
<%= render OpTurbo::FrameComponent.new(@storage, context: :edit_storage_header) do %>
<%= @storage.name %>
<% end %>
diff --git a/modules/storages/app/views/storages/admin/storages/new.html.erb b/modules/storages/app/views/storages/admin/storages/new.html.erb
index 0ec295bc478..01a52515d0f 100644
--- a/modules/storages/app/views/storages/admin/storages/new.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/new.html.erb
@@ -8,7 +8,7 @@
<% local_assigns[:additional_breadcrumb] = label_new_file_storage %>
<%= render(Primer::OpenProject::PageHeader.new) do |header| %>
- <% header.with_title(test_selector: 'storage-name-title') do %>
+ <% header.with_title(test_selector: 'storage-new-page-header--title') do %>
<%= label_new_file_storage %>
<% end %>
@@ -18,7 +18,7 @@
<%= t(:project_module_storages) %>
<% end %>
- <% header.with_description do %>
+ <% header.with_description(test_selector: 'storage-new-page-header--description') do %>
<%=
t("storages.instructions.new_storage",
file_storage_docs_link: render(
diff --git a/modules/storages/app/views/storages/admin/storages/new.turbo_stream.erb b/modules/storages/app/views/storages/admin/storages/new.turbo_stream.erb
index 036c0a4897c..ca3c5aa7af4 100644
--- a/modules/storages/app/views/storages/admin/storages/new.turbo_stream.erb
+++ b/modules/storages/app/views/storages/admin/storages/new.turbo_stream.erb
@@ -27,8 +27,8 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= turbo_stream.replace :select_storage_provider do %>
+<%= turbo_stream.replace :storage_general_info_section do %>
<%=
- render(::Storages::Admin::SelectStorageProviderComponent.new(@storage))
+ render(::Storages::Admin::StorageViewComponent.new(@storage))
%>
<% end %>
diff --git a/modules/storages/spec/features/admin_storages_spec.rb b/modules/storages/spec/features/admin_storages_spec.rb
index 97529e136ed..be240e93149 100644
--- a/modules/storages/spec/features/admin_storages_spec.rb
+++ b/modules/storages/spec/features/admin_storages_spec.rb
@@ -126,16 +126,23 @@ RSpec.describe 'Admin storages',
it 'renders a Nextcloud specific multi-step form', :webmock do
visit admin_settings_storages_path
- within('.blankslate') { click_link("Storage") }
- expect(page).to have_current_path(new_admin_settings_storage_path)
+ within('.PageHeader') { click_button("Storage") }
+ within_test_selector('storages-select-provider-action-menu') { click_link('Nextcloud') }
+
+ expect(page).to have_current_path(select_provider_admin_settings_storages_path(provider: 'nextcloud'))
aggregate_failures 'Select provider view' do
- # General information
- expect(page).to have_select('storages_storage[provider_type]', with_options: %w[Nextcloud OneDrive/SharePoint])
- expect(find_test_selector('storage-select-provider-submit-button')).to be_disabled
+ # Page Header
+ expect(page).to have_test_selector('storage-new-page-header--title', text: 'New Nextcloud storage')
+ expect(page).to have_test_selector('storage-new-page-header--description',
+ text: "Read our documentation on setting up a Nextcloud file storage " \
+ "integration for more information.")
- # Select Nextcloud
- select('Nextcloud', from: 'storages_storage[provider_type]')
+ # General information
+ expect(page).to have_test_selector('storage-provider-configuration-instructions',
+ text: "Please make sure you have administration privileges in your " \
+ "Nextcloud instance and the application “Integration OpenProject” " \
+ "is installed before doing the setup.")
# OAuth application
expect(page).to have_test_selector('storage-openproject-oauth-label', text: 'OpenProject OAuth')
@@ -255,16 +262,22 @@ RSpec.describe 'Admin storages',
it 'renders a One Drive specific multi-step form', :webmock do
visit admin_settings_storages_path
- within('.PageHeader') { click_link("Storage") }
- expect(page).to have_current_path(new_admin_settings_storage_path)
+ within('.PageHeader') { click_button("Storage") }
+ within_test_selector('storages-select-provider-action-menu') { click_link('OneDrive/SharePoint') }
+
+ expect(page).to have_current_path(select_provider_admin_settings_storages_path(provider: 'one_drive'))
aggregate_failures 'Select provider view' do
- # General information
- expect(page).to have_select('storages_storage[provider_type]', with_options: %w[Nextcloud OneDrive/SharePoint])
- expect(find_test_selector('storage-select-provider-submit-button')).to be_disabled
+ # Page Header
+ expect(page).to have_test_selector('storage-new-page-header--title', text: 'New OneDrive/SharePoint storage')
+ expect(page).to have_test_selector('storage-new-page-header--description',
+ text: "Read our documentation on setting up a OneDrive/SharePoint " \
+ "file storage integration for more information.")
- # Select OneDrive
- select('OneDrive/SharePoint', from: 'storages_storage[provider_type]')
+ # General information
+ expect(page).to have_test_selector('storage-provider-configuration-instructions',
+ text: "Please make sure you have administration privileges in the " \
+ "Azure application before doing the setup.")
# OAuth client
wait_for(page).to have_test_selector('storage-oauth-client-label', text: 'Azure OAuth')
@@ -354,7 +367,7 @@ RSpec.describe 'Admin storages',
it 'renders an edit view', :webmock do
visit edit_admin_settings_storage_path(storage)
- expect(page).to have_test_selector('storage-name-title', text: storage.name.capitalize)
+ expect(page).to have_test_selector('storage-new-page-header--title', text: storage.name.capitalize)
aggregate_failures 'Storage edit view' do
# General information
@@ -393,7 +406,7 @@ RSpec.describe 'Admin storages',
click_button 'Save and continue'
end
- expect(page).to have_test_selector('storage-name-title', text: 'My Nextcloud')
+ expect(page).to have_test_selector('storage-new-page-header--title', text: 'My Nextcloud')
expect(page).to have_test_selector('storage-description', text: "Nextcloud - My Nextcloud - #{storage.host}")
# Update a storage - unhappy path
@@ -502,7 +515,7 @@ RSpec.describe 'Admin storages',
it 'renders an edit view', :webmock do
visit edit_admin_settings_storage_path(storage)
- expect(page).to have_test_selector('storage-name-title', text: 'Test Drive')
+ expect(page).to have_test_selector('storage-new-page-header--title', text: 'Test Drive')
aggregate_failures 'Storage edit view' do
# General information
@@ -528,7 +541,7 @@ RSpec.describe 'Admin storages',
click_button 'Save and continue'
end
- expect(page).to have_test_selector('storage-name-title', text: 'My OneDrive')
+ expect(page).to have_test_selector('storage-new-page-header--title', text: 'My OneDrive')
expect(page).to have_test_selector('storage-description', text: 'OneDrive/SharePoint - My OneDrive')
# Update a storage - unhappy path