test: Wrote snapshot tests for all Sonarr UI

This commit is contained in:
2025-12-16 14:12:10 -07:00
parent e0fcbc71e1
commit 0532d59746
257 changed files with 8089 additions and 1029 deletions
@@ -58,7 +58,12 @@ mod tests {
CollectionsUi::draw(f, app, f.area());
});
insta::assert_snapshot!(output);
insta::assert_snapshot!(
format!(
"is_loading_{is_loading}_empty_movies_{empty_movies}_empty_profile_{empty_profile_map}"
),
output
);
}
#[rstest]
@@ -81,7 +86,7 @@ mod tests {
CollectionsUi::draw(f, app, f.area());
});
insta::assert_snapshot!(active_radarr_block.to_string(), output);
insta::assert_snapshot!(format!("collections_tab_{active_radarr_block}"), output);
}
#[test]
@@ -141,7 +146,7 @@ mod tests {
insta::assert_snapshot!(
format!(
"{}_{}",
"edit_collection_modal_{}_{}",
active_radarr_block.to_string(),
context_block.to_string()
),
+2 -2
View File
@@ -82,7 +82,7 @@ mod tests {
LibraryUi::draw(f, app, f.area());
});
insta::assert_snapshot!(active_radarr_block.to_string(), output);
insta::assert_snapshot!(format!("library_tab_{active_radarr_block}"), output);
}
#[rstest]
@@ -109,7 +109,7 @@ mod tests {
LibraryUi::draw(f, app, f.area());
});
insta::assert_snapshot!(active_radarr_block.to_string(), output);
insta::assert_snapshot!(format!("add_movie_ui_{active_radarr_block}"), output);
}
#[test]
@@ -0,0 +1,54 @@
---
source: src/ui/radarr_ui/system/system_ui_tests.rs
expression: output
---
╭ Tasks ────────────────────────────────────────────────────────────────────────╮╭ Queued Events ───────────────────────────────────────────────────────────────╮
│Name Interval Last Execution Last Duration Next Execution ││Trigger Status Name Queued Started Duration │
│Backup 1 hour now 00:00:17 59 minutes ││manual completed Refresh Monitored D 4 minutes ago 4 minutes a 00:03:03 │
│ ││ │
│ ││ │
│ ││ │
│ ╭ Log Details ───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │2025-12-15 16:14:45 UTC|INFO|DownloadDecisionMaker|Processing 545 releases │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
╰───────────────────│ │────────────────────╯
╭ Logs ───────────│ │────────────────────╮
│2025-12-15 16:14:45│ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ │
│ │
│ │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -0,0 +1,54 @@
---
source: src/ui/radarr_ui/system/system_ui_tests.rs
expression: output
---
╭ Tasks ────────────────────────────────────────────────────────────────────────╮╭ Queued Events ───────────────────────────────────────────────────────────────╮
│Name Interval Last Execution Last Duration Next Execution ││Trigger Status Name Queued Started Duration │
│Backup 1 hour now 00:00:17 59 minutes ││manual completed Refresh Monitored D 4 minutes ago 4 minutes a 00:03:03 │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ╭ Queued Events ────────────────────────────────────────────────────────────────────────────────╮ │
│ │Trigger Status Name Queued Started Duration │ │
│ │manual completed Refresh Monitored Downlo 4 minutes ago 4 minutes ago 00:03:03 │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
╰────────────────────────────────│ │────────────────────────────────╯
╭ Logs ────────────────────────│ │────────────────────────────────╮
│2025-12-15 16:14:45 UTC|INFO|Dow│ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -0,0 +1,54 @@
---
source: src/ui/radarr_ui/system/system_ui_tests.rs
expression: output
---
╭ Tasks ────────────────────────────────────────────────────────────────────────╮╭ Queued Events ───────────────────────────────────────────────────────────────╮
│Name Interval Last Execution Last Duration Next Execution ││Trigger Status Name Queued Started Duration │
│Backup 1 hour now 00:00:17 59 minutes ││manual completed Refresh Monitored D 4 minutes ago 4 minutes a 00:03:03 │
│ ││ │
│ ││ │
│ ││ │
│ ╭ Tasks ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Name Interval Last Execution Last Duration Next Execution │ │
│ │=> Backup 1 hour now 00:00:17 59 minutes │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ ╭────────────────────── Start Task ───────────────────────╮ │ │
│ │ │ Do you want to manually start this task: Backup? │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
╰───────────────────│ │ │ │────────────────────╯
╭ Logs ───────────│ │ │ │────────────────────╮
│2025-12-15 16:14:45│ │ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │╭────────────────────────────╮╭───────────────────────────╮│ │ │
│ │ ││ Yes ││ No ││ │ │
│ │ │╰────────────────────────────╯╰───────────────────────────╯│ │ │
│ │ ╰───────────────────────────────────────────────────────────╯ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ │
│ │
│ │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -0,0 +1,54 @@
---
source: src/ui/radarr_ui/system/system_ui_tests.rs
expression: output
---
╭ Tasks ────────────────────────────────────────────────────────────────────────╮╭ Queued Events ───────────────────────────────────────────────────────────────╮
│Name Interval Last Execution Last Duration Next Execution ││Trigger Status Name Queued Started Duration │
│Backup 1 hour now 00:00:17 59 minutes ││manual completed Refresh Monitored D 4 minutes ago 4 minutes a 00:03:03 │
│ ││ │
│ ││ │
│ ││ │
│ ╭ Tasks ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Name Interval Last Execution Last Duration Next Execution │ │
│ │=> Backup 1 hour now 00:00:17 59 minutes │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
╰───────────────────│ │────────────────────╯
╭ Logs ───────────│ │────────────────────╮
│2025-12-15 16:14:45│ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ │
│ │
│ │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -0,0 +1,54 @@
---
source: src/ui/radarr_ui/system/system_ui_tests.rs
expression: output
---
╭ Tasks ────────────────────────────────────────────────────────────────────────╮╭ Queued Events ───────────────────────────────────────────────────────────────╮
│Name Interval Last Execution Last Duration Next Execution ││Trigger Status Name Queued Started Duration │
│Backup 1 hour now 00:00:17 59 minutes ││manual completed Refresh Monitored D 4 minutes ago 4 minutes a 00:03:03 │
│ ││ │
│ ││ │
│ ││ │
│ ╭ Updates ───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │The latest version of Radarr is already installed │ │
│ │ │ │
│ │4.3.2.1 - 2023-04-15 02:02:53 UTC (Currently Installed) │ │
│ │--------------------------------------------------------------------------------------------------------------------------│ │
│ │New: │ │
│ │ * Cool new thing │ │
│ │Fixed: │ │
│ │ * Some bugs killed │ │
│ │ │ │
│ │ │ │
│ │3.2.1.0 - 2023-04-15 02:02:53 UTC (Previously Installed) │ │
│ │--------------------------------------------------------------------------------------------------------------------------│ │
│ │New: │ │
│ │ * Cool new thing (old) │ │
│ │ * Other cool new thing (old) │ │
│ │ │ │
│ │ │ │
╰───────────────────│2.1.0 - 2023-04-15 02:02:53 UTC │────────────────────╯
╭ Logs ───────────│--------------------------------------------------------------------------------------------------------------------------│────────────────────╮
│2025-12-15 16:14:45│Fixed: │ │
│ │ * Killed bug 1 │ │
│ │ * Fixed bug 2 │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ │
│ │
│ │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -27,7 +27,7 @@ mod tests {
use rstest::rstest;
#[rstest]
fn test_system_details_ui_renders_tasks(
fn test_system_details_ui_renders_popups(
#[values(
ActiveRadarrBlock::SystemLogs,
ActiveRadarrBlock::SystemQueuedEvents,
@@ -29,6 +29,7 @@ mod tests {
use super::*;
use crate::models::stateful_list::StatefulList;
use crate::models::stateful_table::StatefulTable;
use rstest::rstest;
#[test]
fn test_radarr_ui_renders_system_tab_loading() {
@@ -98,5 +99,29 @@ mod tests {
insta::assert_snapshot!(output);
}
#[rstest]
fn test_system_details_ui_renders_popups_over_system_tab(
#[values(
ActiveRadarrBlock::SystemLogs,
ActiveRadarrBlock::SystemQueuedEvents,
ActiveRadarrBlock::SystemTasks,
ActiveRadarrBlock::SystemTaskStartConfirmPrompt,
ActiveRadarrBlock::SystemUpdates
)]
active_radarr_block: ActiveRadarrBlock,
) {
let mut app = App::test_default_fully_populated();
app.push_navigation_stack(active_radarr_block.into());
let output = render_to_string_with_app(TerminalSize::Large, &mut app, |f, app| {
SystemUi::draw(f, app, f.area());
});
insta::assert_snapshot!(
format!("system_details_over_system_tab_{active_radarr_block}"),
output
);
}
}
}