Medlar/docs/tests/S025-video-sites.md

6.6 KiB

S025 — Video sites through yt-dlp: test file

Written by the worker that built it, run by the test phase. Nothing here has been tested until its Result says so.

Built

  • crates/core/src/ytdlp.rs · Ytdlp::find/at (finder, version check), probe (JSON, Cache, cancel by dropping), start -> Running (progress, stop, end), Choice, Run, Progress::read, Reason::of (error kinds), private cookie Jar.
  • crates/app/src/views/video.rs · Page, Video (quality radios with sizes, audio only, subtitles, playlist picker); not yet shown by the Add dialog.
  • Strings video.*, error.video.* in crates/core/lang/en.json.

Checks

# Risk Do this Expect How Result
1 MED Ytdlp::find with no yt-dlp on PATH or beside the test Problem::Missing, words say to install it unit pass (missing_has_words)
2 MED Stub --version prints 2022.01.01 Problem::TooOld("2022.01.01"); 2024.08.06, 2025.01.01.1 and 2024.08.06-nightly pass unit (stub) pass (versions)
3 MED Stub that exits 1 or prints junk for --version Problem::Broken unit (stub) pass (broken_ones)
4 HIGH Stub replays a recorded -J of one video; call probe formats, sizes, subtitles, automatic captions, chapters read; qualities() lists Best then heights descending with video plus best-audio sizes unit (stub) pass (probe_reads_a_video)
5 MED Probe a recorded playlist is_playlist, entries have titles and urls; live_chat is not a subtitle unit (stub) pass
6 MED Probe the same link twice the stub ran once (cache); after the keep time it runs again unit (stub) pass (cache age moved back)
7 HIGH Stub sleeps; end the cancel future during probe Error::Stopped at once and the stub process is gone unit (stub) pass (cancel_kills_the_program)
8 HIGH Probe a recorded answer whose formats are all has_drm error of kind Drm, nothing cached unit (stub) pass
9 HIGH Stub prints recorded progress lines; read Running::progress done, total (or estimate), speed, eta, fragment and playlist item match; NA parts are None unit (stub) pass
10 HIGH start, then stop, then start again with the same folder stub sees the same arguments; first process is gone after stop; second goes on unit (stub) pass
11 HIGH Stub echoes its arguments starts with --ignore-config; link is last and right after --; a link beginning with - stays an argument; limit gives --limit-rate N; no proxy variables in its environment unit (stub) pass (proxy vars set in test, absent in stub)
12 HIGH Run with cookies; stub reports the cookie file's mode and content mode 600, content equal; file removed after end and after drop unit (stub) pass (also after drop)
13 HIGH Recorded failures: private, removed, region, sign-in, unsupported URL, HTTP 429, DRM, unknown Reason is Private, Removed, Region, Login, Unsupported, TooManyRequests, Drm, Other; each error has its own plain text unit fixed: yt-dlp text "has not made this video available in your country" gave Other; added Region pattern; then pass
14 MED Choice with height 720, audio only, subtitles en,de, items format selector with height<=720; -x; --write-subs --sub-langs en,de; odd characters in languages or items dropped unit pass
15 MED Video page: pick items 1, 3, 4, 5 of 6 choice().items == "1,3-5"; all picked gives None; none picked gives empty() unit pass (picked_items_become_ranges)
16 LOW Show the page with a playlist, subtitles and sizes, light and dark readable, no overlap, list scrolls screen pass (S044: shots scene add-video, 1080x720, 480x360 and 1000x1500, light and dark; the dialog scrolls, the playlist list scrolls inside it)
17 MED #[ignore] test: real yt-dlp against the test server's generic page (never a real site) file arrives in the folder, end returns its path integration pass (--ignored, real yt-dlp + testserver; probe and download of 200 KiB)
18 HIGH Manager task with video set, stub yt-dlp writes Clip [x].mp4 (1000 bytes) task done, named by the file, size 1000, choice kept after a restart, stub got -- and the link integration (stub) pass (S044 core/tests/video.rs)
19 HIGH Pause a video task while the stub hangs, then resume stub process gone after pause; second run with --continue; task done integration (stub) pass (S044)
20 HIGH Stub says private / removed; yt-dlp path that does not exist task failed with kind Login / NotFound / Tool integration (stub) pass (S044)
21 HIGH probe_video of a link, and of an unsupported one title read, nothing added; unsupported gives Link BadLink integration (stub) pass (S044)
22 HIGH Add dialog with a web page that yt-dlp knows: pick Audio only, Download Quality, Audio only, Subtitles shown; no web page warning; task has video with audio only kittest pass (S044 app/tests/add.rs)
23 MED Playlist in the Add dialog: None, then one video Download disabled with none; task gets items 2 kittest pass (S044)
24 MED Web page that is no video warning shown, plain task without video kittest pass (S044)

Needs

A stub yt-dlp script (shell) that replays recorded outputs chosen by an environment variable and records its arguments; the test server for check 17; a throwaway XDG_RUNTIME_DIR. Never a real video site.

Doubts

  • The progress template and --print after_move: were written from reading yt-dlp --help, not run; check with the real program (check 17).
  • --flat-playlist for probing gives playlist entries without sizes; a single video link is fully probed.
  • Region, login and private are matched by English text in yt-dlp's messages, which may change between releases.
  • Reason::of matches in list order, not line order; "sign in" may hide other causes.
  • Wired in S044, but only the task's own speed limit reaches yt-dlp; the global limit and the limiter's shares do not.
  • Cookies are not passed to yt-dlp tasks: the Add dialog's cookie field is a header, and nothing converts it to a Netscape cookie file.
  • A playlist task is named after its last file; the others land in the same folder but are not tasks of their own.
  • yt-dlp .part files may stay in the folder after a video task is removed.
  • No yt-dlp, or a link it does not support, hides the video page without a word; the link is then a plain download of the web page.
  • No real yt-dlp ran a manager task; only the stub (check 17 covers the real program outside the manager).