Files
sure/test/system/settings/providers_test.rb
Claude 391364dc4b feat(settings/providers): surface connection status in section headers
Lifts the per-panel status indicator up to each collapsed accordion
header so admins can see at a glance which providers are connected
without expanding every section. Connected providers sort first.

- Add optional status: and meta: locals to settings/_section partial;
  pill hides via group-open:hidden when the section is expanded
- New settings/providers/_status_pill partial (ok/warn/err/off states)
- Add SettingsHelper#provider_summary to centralise the connected-vs-not
  logic already scattered across panel partials
- Refactor show.html.erb to pass status to every section and sort
  family_panels by connection state
- Add settings.providers.status.* i18n keys
- Add system tests asserting pill renders and sort order

https://claude.ai/code/session_01KW2HCN9rP1fiyQuw7Cju9D
2026-05-08 18:30:29 +02:00

52 lines
1.6 KiB
Ruby

require "application_system_test_case"
class Settings::ProvidersTest < ApplicationSystemTestCase
setup do
@user = users(:family_admin)
@family = families(:dylan_family)
login_as @user
end
test "shows status pill on section header for a configured provider" do
SimplefinItem.create!(family: @family, name: "Test SimpleFIN", access_url: "https://bridge.simplefin.org/simplefin/access")
visit settings_providers_path
within("details", text: "SimpleFIN") do
assert_text "Connected"
end
end
test "shows not configured pill for an unconfigured provider" do
visit settings_providers_path
within("details", text: "SimpleFIN") do
assert_text "Not configured"
end
end
test "connected providers render before unconfigured ones" do
SimplefinItem.create!(family: @family, name: "Test SimpleFIN", access_url: "https://bridge.simplefin.org/simplefin/access")
visit settings_providers_path
sections = all("details summary").map(&:text)
simplefin_index = sections.index { |t| t.include?("SimpleFIN") }
binance_index = sections.index { |t| t.include?("Binance") }
assert simplefin_index < binance_index, "Connected SimpleFIN should appear before unconfigured Binance"
end
test "expanding a section still works as expected" do
visit settings_providers_path
details = find("details", text: "SimpleFIN")
assert_nil details[:open], "Section should start collapsed"
details.find("summary").click
assert details[:open], "Section should open when clicked"
details.assert_text "Setup Token"
end
end