Files
wehub-resource-sync 542cfa195c
CI / Frontend build (push) Failing after 9m6s
CI / Plugin validate (push) Failing after 9m27s
CI / Python lint (push) Failing after 16m1s
CI / Tests (push) Successful in 18m0s
Deploy / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:33:27 +08:00

32 lines
998 B
Python

"""Render smoke test — the README's `pixelshot <page> --output ./tiles` path.
Renders a local HTML file through the default CDP backend (patched headless
Chrome, auto-downloaded and cached in CI) and asserts tile images are produced.
This is the one user-facing capability the README promises, so it is tested end
to end rather than mocked.
"""
from pathlib import Path
from pixelrag_render import render_file
def test_render_local_html_to_tiles(tmp_path):
html = tmp_path / "page.html"
html.write_text(
"<html><body><h1>PixelRAG render smoke</h1>"
+ "<p>lorem ipsum dolor sit amet. </p>" * 60
+ "</body></html>"
)
out = tmp_path / "tiles"
dirs = render_file(html, out)
assert dirs, "render_file returned no tile directories"
tile_dir = Path(dirs[0])
tiles = sorted(tile_dir.glob("tile_*.jpg"))
assert tiles, (
f"no tile images produced in {tile_dir} "
f"(contents: {[p.name for p in tile_dir.iterdir()]})"
)