From 8768b54a91765ed097acdafb099ff68e4820640d Mon Sep 17 00:00:00 2001 From: Guillem Arias Date: Fri, 29 May 2026 12:45:21 +0200 Subject: [PATCH] feat(retirement): PR4g happy-path system test One system test: a preview-enabled user visits /retirement (sees the "add your birth year" prompt), fills the birth-year + retire-age levers, saves, and the KPI cards + D3 glide chart render. Asserts the rendered SVG + KPI container (labels are CSS-uppercased, so we match structure, not the case-folded text). --- test/system/retirement_test.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/system/retirement_test.rb diff --git a/test/system/retirement_test.rb b/test/system/retirement_test.rb new file mode 100644 index 000000000..89fcd4028 --- /dev/null +++ b/test/system/retirement_test.rb @@ -0,0 +1,27 @@ +require "application_system_test_case" + +class RetirementTest < ApplicationSystemTestCase + setup do + @user = users(:family_admin) + @user.update!(preferences: (@user.preferences || {}).merge("preview_features_enabled" => true)) + @user.family.update!(retirement_disabled: false) + sign_in @user + end + + test "set up a plan and see the projection render" do + visit retirement_path + + assert_selector "h1", text: I18n.t("retirement.show.title") + assert_text I18n.t("retirement.kpis.set_birth_year_heading") + + fill_in "retirement[birth_year]", with: (Date.current.year - 40).to_s + fill_in "retirement[retire_age]", with: "55" + click_button I18n.t("retirement.what_if.save") + + # After persisting, the forecast is projectable: the KPI cards + the D3 + # glide chart render. (The KPI label is CSS-uppercased, so match the + # rendered SVG + the KPI container rather than the case-folded label.) + assert_selector "#retirement_kpis", wait: 5 + assert_selector "[data-controller='retirement-glide-chart'] svg", wait: 5 + end +end