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

chore[#50212]: Use primer text selector, set up basic spec

Kabiru Mwenja96cfa2b4eb3e
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 75a8abd2f61..eb610881f6d 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
@@ -16,7 +16,7 @@
concat(configuration_check_label_for(:host_name_configured))
end
- grid.with_area(:description, tag: :div, color: :subtle, data: { 'test-selector': 'storage-description' }) do
+ grid.with_area(:description, tag: :div, color: :subtle, test_selector: 'storage-description') do
render(Primer::Beta::Truncate.new(font_weight: :light)) { storage_description }
end
@@ -52,7 +52,7 @@
concat(configuration_check_label_for(:openproject_oauth_application_configured))
end
- grid.with_area(:description, tag: :div, color: :subtle, data: { 'test-selector': 'storage-openproject-oauth-client-description' }) do
+ grid.with_area(:description, tag: :div, color: :subtle, test_selector: 'storage-openproject-oauth-client-description') do
render(Primer::Beta::Truncate.new(font_weight: :light)) { openproject_oauth_client_description }
end
@@ -84,12 +84,12 @@
concat(configuration_check_label_for(:storage_oauth_client_configured))
end
- grid.with_area(:description, tag: :div, color: :subtle, data: { 'test-selector': 'storage-oauth-client-id-description' }) do
+ grid.with_area(:description, tag: :div, color: :subtle, test_selector: 'storage-oauth-client-id-description') do
render(Primer::Beta::Truncate.new(font_weight: :light)) { provider_oauth_client_description }
end
grid.with_area(:"icon-button", tag: :div, color: :subtle, mr: 3, justify_self: :end) do
- render(Primer::Beta::IconButton.new(icon: :sync, scheme: :invisible, aria: { label: I18n.t('storages.label_edit_storage') } , data: { 'test-selector': 'storage-edit-button' }))
+ render(Primer::Beta::IconButton.new(icon: :sync, scheme: :invisible, aria: { label: I18n.t('storages.label_edit_storage') } , test_selector: 'storage-edit-button'))
end
end
end
@@ -109,12 +109,12 @@
concat(automatically_managed_project_folders_status_label)
end
- grid.with_area(:description, tag: :div, color: :subtle, data: { 'test-selector': 'storage-oauth-client-id-description' }) do
+ grid.with_area(:description, tag: :div, color: :subtle, test_selector: 'storage-oauth-client-id-description') do
render(Primer::Beta::Truncate.new(font_weight: :light)) { I18n.t('storages.page_titles.managed_project_folders.subtitle_short') }
end
grid.with_area(:"icon-button", tag: :div, color: :subtle, mr: 3, justify_self: :end) do
- render(Primer::Beta::IconButton.new(icon: :pencil, scheme: :invisible, aria: { label: I18n.t('storages.label_edit_storage') } , data: { 'test-selector': 'storage-edit-button' }))
+ render(Primer::Beta::IconButton.new(icon: :pencil, scheme: :invisible, aria: { label: I18n.t('storages.label_edit_storage') } , test_selector: 'storage-edit-button'))
end
end
end
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 26cb7aea56a..8aa3eaff7d7 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.
<% if OpenProject::FeatureDecisions.storage_primer_design_active? %>
<%= render(Primer::OpenProject::PageHeader.new) do |header| %>
- <% header.with_title do %>
+ <% header.with_title(test_selector: 'storage-name-title') do %>
<%= @storage.name %>
<% end %>
diff --git a/modules/storages/spec/features/admin_storages_spec.rb b/modules/storages/spec/features/admin_storages_spec.rb
index a7ce4168ca9..29908af0ecf 100644
--- a/modules/storages/spec/features/admin_storages_spec.rb
+++ b/modules/storages/spec/features/admin_storages_spec.rb
@@ -89,6 +89,23 @@ RSpec.describe 'Admin storages',
end
end
+ describe 'File storage edit view', with_flag: { storage_primer_design: true } do
+ let(:storage) { create(:nextcloud_storage) }
+
+ before { storage }
+
+ it 'renders the edit view' do
+ visit edit_admin_settings_storage_path(storage)
+
+ expect(page).to have_test_selector('storage-name-title', text: storage.name.capitalize)
+
+ aggregate_failures 'storage host' do
+ expect(page).to have_test_selector('storage-host-title', text: 'Host')
+ expect(page).to have_test_selector('storage-host-value', text: storage.host)
+ end
+ end
+ end
+
it 'creates, edits and deletes storages', :webmock do
visit admin_settings_storages_path