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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
tests[Op#50212]: Expand Storage "OAuth applications" spec
Kabiru Mwenja6c5a0285384f
diff --git a/modules/storages/app/components/storages/admin/oauth_application_credentials_copy_component.html.erb b/modules/storages/app/components/storages/admin/oauth_application_credentials_copy_component.html.erbindex c24dad5502b..a30a2f73e5c 100644--- a/modules/storages/app/components/storages/admin/oauth_application_credentials_copy_component.html.erb+++ b/modules/storages/app/components/storages/admin/oauth_application_credentials_copy_component.html.erb@@ -1,39 +1,40 @@<%=- flex_layout(flex_items: :center) do |credentials_row|- credentials_row.with_row(mb: 3) do- render(Primer::Beta::Flash.new(icon: :alert, scheme: :warning)) do- I18n.t('storages.instructions.oauth_application_details', oauth_application_details_link: oauth_application_details_link).html_safe+ render(Primer::Beta::Text.new(tag: :div, test_selector: 'storage-openproject-oauth-application-form')) do+ flex_layout(flex_items: :center) do |credentials_row|+ credentials_row.with_row(mb: 3, test_selector: 'storage-openproject_oauth_application_warning') do+ render(Primer::Beta::Flash.new(icon: :alert, scheme: :warning)) do+ I18n.t('storages.instructions.oauth_application_details', oauth_application_details_link: oauth_application_details_link).html_safe+ endend- end- credentials_row.with_row(mb: 3) do- render(- OpenProject::Common::ClipboardCopyComponent.new(- name: :openproject_oauth_application_uid,- visually_hide_label: false,- value_to_copy: oauth_application.uid,- label: I18n.t('storages.label_openproject_oauth_client_id'),- required: true+ credentials_row.with_row(mb: 3) do+ render(+ OpenProject::Common::ClipboardCopyComponent.new(+ name: :openproject_oauth_application_uid,+ visually_hide_label: false,+ value_to_copy: oauth_application.uid,+ label: I18n.t('storages.label_openproject_oauth_application_id'),+ required: true+ ))- )- end+ end- credentials_row.with_row(mb: 3) do- render(- OpenProject::Common::ClipboardCopyComponent.new(- name: :openproject_oauth_application_secret,- visually_hide_label: false,- value_to_copy: oauth_application.secret,- label: I18n.t('storages.label_openproject_oauth_client_secret'),- required: true+ credentials_row.with_row(mb: 3) do+ render(+ OpenProject::Common::ClipboardCopyComponent.new(+ name: :openproject_oauth_application_secret,+ visually_hide_label: false,+ value_to_copy: oauth_application.secret,+ label: I18n.t('storages.label_openproject_oauth_application_secret'),+ required: true+ ))- )- end+ end- credentials_row.with_row do- # TODO: Check with product if "Done, Continue" button is context aware- concat(render(Primer::Beta::Button.new(scheme: :primary, tag: :a, href: edit_admin_settings_storage_path(storage))) { I18n.t('storages.buttons.done_continue') })- concat(render(Primer::Beta::Button.new(scheme: :default, tag: :a, href: edit_admin_settings_storage_path(storage))) { I18n.t('button_cancel') })+ credentials_row.with_row do+ concat(render(Primer::Beta::Button.new(scheme: :primary, tag: :a, href: edit_admin_settings_storage_path(storage))) { I18n.t('storages.buttons.done_continue') })+ concat(render(Primer::Beta::Button.new(scheme: :default, tag: :a, href: edit_admin_settings_storage_path(storage))) { I18n.t('button_cancel') })+ endendend%>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.erbindex 633e2b43d3c..cab0777937c 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@@ -56,7 +56,7 @@concat(configuration_check_label_for(:openproject_oauth_application_configured))end- grid.with_area(:description, tag: :div, color: :subtle, test_selector: 'storage-openproject-oauth-client-description') do+ grid.with_area(:description, tag: :div, color: :subtle, test_selector: 'storage-openproject-oauth-application-description') dorender(Primer::Beta::Truncate.new(font_weight: :light)) { openproject_oauth_client_description }enddiff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex 53c38815bff..add3b0a619e 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -186,8 +186,8 @@ en:one_drive: "OneDrive OAuth"label_oauth_application_details: "OAuth application details"label_oauth_client_details: "OAuth client details"- label_openproject_oauth_client_id: "OpenProject OAuth Client ID"- label_openproject_oauth_client_secret: "OpenProject OAuth Client Secret"+ label_openproject_oauth_application_id: "OpenProject OAuth Client ID"+ label_openproject_oauth_application_secret: "OpenProject OAuth Client Secret"label_oauth_client_id: "OAuth Client ID"label_oauth_client_secret: "OAuth Client Secret"label_provider_type: "Provider type"diff --git a/modules/storages/spec/features/admin_storages_spec.rb b/modules/storages/spec/features/admin_storages_spec.rbindex 8fd511fec9b..2bc62b3b635 100644--- a/modules/storages/spec/features/admin_storages_spec.rb+++ b/modules/storages/spec/features/admin_storages_spec.rb@@ -136,8 +136,28 @@ RSpec.describe 'Admin storages',aggregate_failures 'OAuth application' doexpect(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: 'Connected')- expect(page).to have_test_selector('storage-openproject-oauth-client-description',+ expect(page).to have_test_selector('storage-openproject-oauth-application-description',text: "OAuth Client ID: #{oauth_application.uid}")++ accept_confirm do+ find_test_selector('storage-replace-openproject-oauth-application-button').click+ end++ within_test_selector('storage-openproject-oauth-application-form') do+ warning_section = find_test_selector('storage-openproject_oauth_application_warning')+ expect(warning_section).to have_text('The client secret value will not be accessible again after you close ' \+ 'this window. Please copy these values into the Nextcloud ' \+ 'OpenProject Integration settings.')+ expect(warning_section).to have_link('Nextcloud OpenProject Integration settings',+ href: "#{storage.host}/settings/admin/openproject")++ expect(page).to have_css('#openproject_oauth_application_uid',+ value: storage.reload.oauth_application.uid)+ expect(page).to have_css('#openproject_oauth_application_secret',+ value: storage.reload.oauth_application.secret)++ click_link 'Done, continue'+ endendaggregate_failures 'Nextcloud OAuth' do