Charts 2.0 (build 49): sidebar nativa, filtros en toolbar, title menu en iPhone

El bug de Allocation/Contributions que no respondían en iPad persistía tras dos
fixes de lógica — la causa estaba en la capa de interacción (Buttons custom en
LazyVGrid dentro de ScrollView dentro de NavigationSplitView). Rediseño completo
alineado con el HIG:

- iPad: List(selection:) nativa con estilo .sidebar y secciones agrupadas
  (Overview/Analyze/Risk/Forecast) — hit-testing del sistema, navegación por
  teclado, pointer effects y VoiceOver gratis. El gating premium sigue en
  selectChart vía el binding de selección.
- Filtros (Group/Category/Sources) → Menu nativo en la toolbar con checkmarks
  e icono con badge cuando hay filtros activos. Desaparecen las pills apiladas.
- iPhone: toolbarTitleMenu — el título es el selector de chart (patrón
  Files/Freeform); fuera el carrusel de 14 chips. Periodo como segmented picker
  estilo Stocks encima de la gráfica.
- Slider de Performance integrado en el toolbar del chart (iPad) y como card
  compacta (iPhone).
- Eliminadas ~300 líneas de selectores custom (tiles, pills, chips).

Verificado con UITest nuevo (testChartSidebarSelection) en simulador iPad Pro:
tap en Allocation/Contributions/Rolling 12M carga cada chart, y el filtro de
periodo de Rolling reacciona. ScreenshotMode ahora activa debugPremiumOverride
para poder testear charts premium.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WoScpmHdVj1aUf4rAp6hbe
This commit is contained in:
alexandrev-tibco
2026-07-08 22:45:31 +02:00
parent 0e0aec6bb9
commit 7b8dec196d
4 changed files with 272 additions and 424 deletions
@@ -189,6 +189,74 @@ final class PortfolioJournalUITests: XCTestCase {
}
}
/// Regression (1.4.2): selecting Allocation / Contributions / Rolling 12M in the
/// Charts sidebar must actually switch the chart taps on the old custom tiles
/// were unreliable on iPad. Also verifies the Rolling 12M period filter reacts.
func testChartSidebarSelection() throws {
let capture = XCUIApplication()
capture.launchArguments = ["--screenshots"]
capture.launch()
Thread.sleep(forTimeInterval: 4.0)
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let denyButton = springboard.alerts.buttons["Don't Allow"]
if denyButton.waitForExistence(timeout: 3) {
denyButton.tap()
Thread.sleep(forTimeInterval: 1.0)
}
let tabBar = capture.tabBars.firstMatch
if tabBar.exists && tabBar.buttons["Charts"].exists {
tabBar.buttons["Charts"].tap()
} else {
// iPad main sidebar rows are cells with a static text label
capture.staticTexts["Charts"].firstMatch.tap()
}
Thread.sleep(forTimeInterval: 2.0)
func snap(_ name: String) {
let shot = XCTAttachment(screenshot: capture.screenshot())
shot.name = name
shot.lifetime = .keepAlways
add(shot)
}
// Allocation
let allocationRow = capture.staticTexts["Allocation"].firstMatch
XCTAssertTrue(allocationRow.waitForExistence(timeout: 5), "Allocation row not found in sidebar")
allocationRow.tap()
Thread.sleep(forTimeInterval: 2.0)
snap("charts_allocation")
XCTAssertTrue(
capture.staticTexts["Asset Allocation"].firstMatch.waitForExistence(timeout: 5),
"Allocation chart did not load after tapping its sidebar row"
)
// Contributions
let contributionsRow = capture.staticTexts["Contributions"].firstMatch
XCTAssertTrue(contributionsRow.waitForExistence(timeout: 5), "Contributions row not found")
contributionsRow.tap()
Thread.sleep(forTimeInterval: 2.0)
snap("charts_contributions")
XCTAssertTrue(
capture.staticTexts["Monthly avg"].firstMatch.waitForExistence(timeout: 5),
"Contributions chart did not load after tapping its sidebar row"
)
// Rolling 12M + period filter
let rollingRow = capture.staticTexts["Rolling 12M"].firstMatch
XCTAssertTrue(rollingRow.waitForExistence(timeout: 5), "Rolling 12M row not found")
rollingRow.tap()
Thread.sleep(forTimeInterval: 2.0)
snap("charts_rolling_all")
let threeMonths = capture.buttons["3M"].firstMatch
if threeMonths.waitForExistence(timeout: 3) {
threeMonths.tap()
Thread.sleep(forTimeInterval: 1.5)
snap("charts_rolling_3m")
}
}
/// Captures full-screen screenshots of the main tabs with demo data for App Store
/// marketing. Launches the app in `--screenshots` mode (onboarding/lock skipped,
/// SampleDataService seeded). Language can be driven via the SCREENSHOT_LANG env var