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]: Add integration specs, update UI text

Kabiru Mwenjaa404e4176a55
diff --git a/modules/storages/app/components/storages/admin/sidebar/health_notifications_component.html.erb b/modules/storages/app/components/storages/admin/sidebar/health_notifications_component.html.erb
index 449f5c69ad4..14e630e7dd6 100644
--- a/modules/storages/app/components/storages/admin/sidebar/health_notifications_component.html.erb
+++ b/modules/storages/app/components/storages/admin/sidebar/health_notifications_component.html.erb
@@ -14,7 +14,7 @@
f.hidden_field :health_notifications_enabled, value: (storage.health_notifications_enabled? ? "0" : "1")
end
- notification_status_actions.with_row do
+ notification_status_actions.with_row(test_selector: "storage-health-notifications-button") do
render(Primer::Beta::Button.new(
scheme: :default,
block: :true,
@@ -28,7 +28,7 @@
end
end
- notifications_container.with_row(mt: 3, test_selector: "health-notifications-description") do
+ notifications_container.with_row(mt: 3, test_selector: "storage-health-notifications-description") do
render(Primer::Beta::Text.new(color: :subtle)) { notification_status[:description] }
end
end
diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml
index b03d842fb3d..3a2591701a5 100644
--- a/modules/storages/config/locales/en.yml
+++ b/modules/storages/config/locales/en.yml
@@ -105,7 +105,7 @@ en:
subtitle: Automatically managed project folders
title: Health status
health_email_notifications:
- description_subscribed: Email notifications for this storage have been turned on for all administrators.
+ description_subscribed: All administrators will receive health status email notifications for this storage.
description_unsubscribed: Health status email notifications for this storage have been turned off for all administrators.
error_could_not_be_saved: Email notification settings could not be saved. Please try again.
subscribe: Subscribe
diff --git a/modules/storages/spec/components/storages/admin/sidebar/health_notifications_component_spec.rb b/modules/storages/spec/components/storages/admin/sidebar/health_notifications_component_spec.rb
index 41034f3836b..f3038a77f15 100644
--- a/modules/storages/spec/components/storages/admin/sidebar/health_notifications_component_spec.rb
+++ b/modules/storages/spec/components/storages/admin/sidebar/health_notifications_component_spec.rb
@@ -40,8 +40,8 @@ RSpec.describe Storages::Admin::Sidebar::HealthNotificationsComponent, type: :co
it "renders an unsubscribe option with info" do
expect(page).to have_css("input[type=hidden][value='0']", visible: :hidden)
expect(page).to have_test_selector(
- "health-notifications-description",
- text: "Email notifications for this storage have been turned on for all administrators."
+ "storage-health-notifications-description",
+ text: "All administrators will receive health status email notifications for this storage."
)
expect(page).to have_button("Unsubscribe")
end
@@ -57,7 +57,7 @@ RSpec.describe Storages::Admin::Sidebar::HealthNotificationsComponent, type: :co
it "renders an unsubscribe option with info" do
expect(page).to have_css("input[type=hidden][value='1']", visible: :hidden)
expect(page).to have_test_selector(
- "health-notifications-description",
+ "storage-health-notifications-description",
text: "Health status email notifications for this storage have been turned off for all administrators."
)
expect(page).to have_button("Subscribe")
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 a1be6c617ed..bc564bec59b 100644
--- a/modules/storages/spec/features/storages/admin/edit_storage_spec.rb
+++ b/modules/storages/spec/features/storages/admin/edit_storage_spec.rb
@@ -220,10 +220,24 @@ RSpec.describe "Admin Edit File storage",
end
end
- it "renders health status information" do
+ it "renders a sidebar component" do
visit edit_admin_settings_storage_path(storage)
- expect(page).to have_test_selector("storage-health-status", text: "Pending")
+ aggregate_failures "Health status" do
+ expect(page).to have_test_selector("storage-health-status", text: "Pending")
+ end
+
+ aggregate_failures "Health notifications" do
+ expect(page).to have_test_selector("storage-health-notifications-button", text: "Unsubscribe")
+ expect(page).to have_test_selector("storage-storage-health-notifications-description",
+ text: "All administrators will receive health status email notifications for this storage.")
+
+ click_on "Unsubscribe"
+
+ expect(page).to have_test_selector("storage-health-notifications-button", text: "Subscribe")
+ expect(page).to have_test_selector("storage-storage-health-notifications-description",
+ text: "Health status email notifications for this storage have been turned off for all administrators.")
+ end
end
end
@@ -233,7 +247,8 @@ 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-status", text: "Pending")
+ expect(page).not_to have_test_selector("storage-health-status")
+ expect(page).not_to have_test_selector("storage-health-notifications-button")
end
end
@@ -327,10 +342,24 @@ RSpec.describe "Admin Edit File storage",
end
end
- it "renders health status information" do
+ it "renders a sidebar component" do
visit edit_admin_settings_storage_path(storage)
- expect(page).to have_test_selector("storage-health-status", text: "Pending")
+ aggregate_failures "Health status" do
+ expect(page).to have_test_selector("storage-health-status", text: "Pending")
+ end
+
+ aggregate_failures "Health notifications" do
+ expect(page).to have_test_selector("storage-health-notifications-button", text: "Unsubscribe")
+ expect(page).to have_test_selector("storage-storage-health-notifications-description",
+ text: "All administrators will receive health status email notifications for this storage.")
+
+ click_on "Unsubscribe"
+
+ expect(page).to have_test_selector("storage-health-notifications-button", text: "Subscribe")
+ expect(page).to have_test_selector("storage-storage-health-notifications-description",
+ text: "Health status email notifications for this storage have been turned off for all administrators.")
+ end
end
end
@@ -340,7 +369,8 @@ 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-status", text: "Pending")
+ expect(page).not_to have_test_selector("storage-health-status")
+ expect(page).not_to have_test_selector("storage-health-notifications-button")
end
end
end