use testty::assertion;
use testty::region::Region;
use crate::common;
use crate::common::FeatureTest;
#[test]
fn stats_tab_shows_heatmap_and_tokens() {
FeatureTest::new("stats_content")
.zola(
"Stats tab",
"View activity heatmap and per-session token usage statistics.",
160,
)
.run(
|scenario| {
scenario
.compose(&common::wait_for_agentty_startup())
.viewing_pause_ms(1500)
.compose(&common::switch_to_tab("Sessions"))
.compose(&common::switch_to_tab("Review"))
.compose(&common::switch_to_tab("Stats"))
.viewing_pause_ms(3000)
.capture_labeled("stats_tab", "Stats tab with heatmap and token table")
},
|frame, _report| {
let full = Region::full(frame.cols(), frame.rows());
assertion::assert_text_in_region(frame, "Activity Heatmap", &full);
assertion::assert_text_in_region(frame, "Token Stats", &full);
},
)
.expect("feature test failed");
}
#[test]
fn stats_footer_shows_summary() {
FeatureTest::new("stats_footer")
.zola(
"Stats footer",
"Stats footer shows aggregate session and token counts.",
162,
)
.run(
|scenario| {
scenario
.compose(&common::wait_for_agentty_startup())
.compose(&common::switch_to_tab("Sessions"))
.compose(&common::switch_to_tab("Review"))
.compose(&common::switch_to_tab("Stats"))
.viewing_pause_ms(3000)
.capture_labeled("stats_footer", "Stats tab footer with counts")
},
|frame, _report| {
let full = Region::full(frame.cols(), frame.rows());
assertion::assert_text_in_region(
frame,
"Sessions: 0 | Input: 0 | Output: 0",
&full,
);
},
)
.expect("feature test failed");
}
#[test]
fn stats_help_shows_keybindings() {
FeatureTest::new("stats_help")
.zola(
"Stats help",
"Press ? on the Stats tab to see stats-specific keybindings.",
164,
)
.run(
|scenario| {
scenario
.compose(&common::wait_for_agentty_startup())
.compose(&common::switch_to_tab("Sessions"))
.compose(&common::switch_to_tab("Review"))
.compose(&common::switch_to_tab("Stats"))
.viewing_pause_ms(2000)
.compose(&common::open_help_overlay())
.viewing_pause_ms(3000)
.capture_labeled("stats_help", "Help overlay on Stats tab")
},
|frame, _report| {
let full = Region::full(frame.cols(), frame.rows());
assertion::assert_text_in_region(frame, "Keybindings", &full);
assertion::assert_text_in_region(frame, "quit", &full);
},
)
.expect("feature test failed");
}