The personal finance app for everyone (by everyone)
Ruby
Test Sankey account grouping independently of label visibility (#4670)
Sure Admin (bot)114bbe05ef64
diff --git a/test/system/cash_flow_group_by_test.rb b/test/system/cash_flow_group_by_test.rbindex ac0e9de955..294509f75f 100644--- a/test/system/cash_flow_group_by_test.rb+++ b/test/system/cash_flow_group_by_test.rb@@ -17,17 +17,19 @@ class CashFlowGroupByTest < ApplicationSystemTestCasevisit root_path(start_date: @month.iso8601, end_date: Date.current.iso8601)chart = find("#cashflow-preview [data-preview-sankey-chart-target='chart']", match: :first)assert_selector "#cashflow-preview svg .sankey-link"- assert_no_selector "#cashflow-preview svg text", text: "Group By Checking"+ # Labels may be hidden to avoid collisions; the rendered account bar is+ # the grouping contract, regardless of the chart's available width.+ chart.assert_no_selector "svg g[aria-label^='Group By Checking,'] path"within("#cashflow-preview") { click_button "Account" }- chart.assert_selector "svg text", text: "Group By Checking"+ chart.assert_selector "svg g[aria-label^='Group By Checking,'] path"assert_selector "#cashflow-preview button[aria-pressed='true']", text: "Account"assert_nil find("#cashflow-preview")["data-sankey-comparison"].presence, "only the category view is compared with the legacy chart"visit root_path(start_date: @month.iso8601, end_date: Date.current.iso8601)find("#cashflow-preview [data-preview-sankey-chart-target='chart']", match: :first)- .assert_selector "svg text", text: "Group By Checking"+ .assert_selector "svg g[aria-label^='Group By Checking,'] path"assert_equal "account", @user.reload.cashflow_sankey_group_byend@@ -45,7 +47,7 @@ class CashFlowGroupByTest < ApplicationSystemTestCasevisit root_path(start_date: @month.iso8601, end_date: Date.current.iso8601)chart = find("#cashflow-preview [data-preview-sankey-chart-target='chart']", match: :first)- chart.assert_selector "svg text", text: "Group By Card"+ chart.assert_selector "svg g[aria-label^='Group By Card,'] path"flows = page.evaluate_script(<<~JS)Array.from(document.querySelectorAll("#cashflow-preview svg .sankey-link")).map((path) => path.__data__)