Enhance job logging and UI updates
- Implement job logging functionality to track progress and events for each job. - Add a new section in the job card to display session logs with detailed entries. - Update job statistics to include pages fetched, pages found, and assets processed. - Modify the UI theme and text for better clarity and aesthetics. - Adjust tests to validate new logging features and ensure proper event handling.
This commit is contained in:
@@ -63,7 +63,7 @@ def test_crawler_captures_and_rewrites_static_fixture(tmp_path) -> None:
|
||||
respect_robots=True,
|
||||
fetch_concurrency=3,
|
||||
)
|
||||
events: list[tuple[str, str]] = []
|
||||
events: list[tuple[str, str, dict[str, object] | None]] = []
|
||||
crawler = SiteCrawler(
|
||||
settings=test_settings,
|
||||
options=CaptureOptions(
|
||||
@@ -75,7 +75,9 @@ def test_crawler_captures_and_rewrites_static_fixture(tmp_path) -> None:
|
||||
max_duration_seconds=30,
|
||||
),
|
||||
cancelled=lambda: False,
|
||||
on_progress=lambda phase, message, stats, warnings: events.append((phase, message)),
|
||||
on_progress=lambda phase, message, stats, warnings, detail: events.append(
|
||||
(phase, message, detail)
|
||||
),
|
||||
)
|
||||
|
||||
try:
|
||||
@@ -99,3 +101,8 @@ def test_crawler_captures_and_rewrites_static_fixture(tmp_path) -> None:
|
||||
assert (host_dir / "assets" / "chunk.js").is_file()
|
||||
assert (result.site_dir / "siteharbor-manifest.json").is_file()
|
||||
assert events
|
||||
page_events = [detail for _, _, detail in events if detail and detail["kind"] == "page"]
|
||||
assert len(page_events) == 4
|
||||
assert {str(detail["action"]) for detail in page_events} == {"fetching", "captured"}
|
||||
assert all(isinstance(detail["url"], str) for detail in page_events)
|
||||
assert all(isinstance(detail["pages_remaining"], int) for detail in page_events)
|
||||
|
||||
Reference in New Issue
Block a user