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).
This commit is contained in:
Guillem Arias
2026-05-29 12:45:21 +02:00
parent 53b2a05749
commit 8768b54a91

View File

@@ -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