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#52449]: use consistent test selectors for storage health

Kabiru Mwenjabf9437838c53
diff --git a/modules/storages/app/components/storages/admin/sidebar/health_status_component.html.erb b/modules/storages/app/components/storages/admin/sidebar/health_status_component.html.erb
index 6f51e23d39a..9504c12bc09 100644
--- a/modules/storages/app/components/storages/admin/sidebar/health_status_component.html.erb
+++ b/modules/storages/app/components/storages/admin/sidebar/health_status_component.html.erb
@@ -16,18 +16,18 @@
health_status_container.with_row(mt: 2) do
flex_layout do |health_status_label|
health_status_label.with_row do
- concat(render(Primer::Beta::Text.new(pr: 2)) do
+ concat(render(Primer::Beta::Text.new(pr: 2, test_selector: "storage-health-checked-at")) do
I18n.t('storages.health.checked', datetime: helpers.format_time(@storage.health_checked_at))
end)
- concat(render(Primer::Beta::Label.new(scheme: health_status_indicator[:scheme])) do
+ concat(render(Primer::Beta::Label.new(scheme: health_status_indicator[:scheme], test_selector: "storage-health-status")) do
health_status_indicator[:label]
end)
end
if @storage.health_unhealthy?
health_status_label.with_row(mt: 2) do
- render(Primer::Beta::Text.new(color: :muted)) do
+ render(Primer::Beta::Text.new(color: :muted, test_selector: "storage-health-error")) do
formatted_health_reason
end
end
diff --git a/modules/storages/spec/components/storages/admin/sidebar/health_status_component_spec.rb b/modules/storages/spec/components/storages/admin/sidebar/health_status_component_spec.rb
index d91cf6cbad5..7a371df9eaa 100644
--- a/modules/storages/spec/components/storages/admin/sidebar/health_status_component_spec.rb
+++ b/modules/storages/spec/components/storages/admin/sidebar/health_status_component_spec.rb
@@ -47,7 +47,7 @@ RSpec.describe Storages::Admin::Sidebar::HealthStatusComponent, type: :component
end
it "shows a healthy status" do
- expect(page).to have_test_selector("storage-health-label-healthy", text: "Healthy")
+ expect(page).to have_test_selector("storage-health-status", text: "Healthy")
expect(page).to have_test_selector("storage-health-checked-at", text: "Last checked 11/28/2023 01:02 AM")
end
end
@@ -60,7 +60,7 @@ RSpec.describe Storages::Admin::Sidebar::HealthStatusComponent, type: :component
end
it "shows pending label" do
- expect(page).to have_test_selector("storage-health-label-pending", text: "Pending")
+ expect(page).to have_test_selector("storage-health-status", text: "Pending")
end
end
@@ -72,8 +72,8 @@ RSpec.describe Storages::Admin::Sidebar::HealthStatusComponent, type: :component
end
it "shows an error status" do
- expect(page).to have_test_selector("storage-health-label-error", text: "Error")
- expect(page).to have_test_selector("storage-health-reason", text: "Error code: description since 11/28/2023 01:02 AM")
+ expect(page).to have_test_selector("storage-health-status", text: "Error")
+ expect(page).to have_test_selector("storage-health-error", text: "Error code: description since 11/28/2023 01:02 AM")
end
end
@@ -85,8 +85,8 @@ RSpec.describe Storages::Admin::Sidebar::HealthStatusComponent, type: :component
end
it "shows a formatted error reason" do
- expect(page).to have_test_selector("storage-health-label-error", text: "Error")
- expect(page).to have_test_selector("storage-health-reason",
+ expect(page).to have_test_selector("storage-health-status", text: "Error")
+ expect(page).to have_test_selector("storage-health-error",
text: "Unauthorized: Outbound request not authorized since 11/28/2023 01:02 AM")
end
end
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 bbe471e671a..4bca4388f26 100644
--- a/modules/storages/spec/features/storages/admin/edit_storage_spec.rb
+++ b/modules/storages/spec/features/storages/admin/edit_storage_spec.rb
@@ -223,7 +223,7 @@ RSpec.describe "Admin Edit File storage",
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")
+ expect(page).to have_test_selector("storage-health-status", text: "Pending")
end
end
@@ -233,7 +233,7 @@ RSpec.describe "Admin Edit File 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")
+ expect(page).not_to have_test_selector("storage-health-status", text: "Pending")
end
end
@@ -330,7 +330,7 @@ RSpec.describe "Admin Edit File storage",
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")
+ expect(page).to have_test_selector("storage-health-status", text: "Pending")
end
end
@@ -340,7 +340,7 @@ RSpec.describe "Admin Edit File 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")
+ expect(page).not_to have_test_selector("storage-health-status", text: "Pending")
end
end
end