🧪 Test Hub
testing: Demo target v3.0.0 · built-in demo site

DEMO-016 Freight: monthly report (long wait)

Edit Load test Duplicate

Checks that dispatchers cannot open reports, then as a manager generates the full monthly report and waits about two minutes for it. Video is off: the activity reel records only the busy moments of a long wait.

authdemofreightjobsslow version: 1.0 DEMO-016__freight_monthly_report.py group: Freight regression

Runs
8
Pass rate
100%
8 passed / 0 failed
Avg duration
1m 45s
p95 1m 56s
Estimate
1m 45s
avg of last 10 judged runs
Flakiness
0.00
0 stable · 1 alternates
Current streak
8
passed

Last 8 results newest on the right — click a square to open that run

Duration per run point color = outcome; dashed = 7-run average; click a point to open the run

Step timing trends the same step compared across the last 8 runs — slowest steps first, one line each

How long it takes distribution of 8 runs — two humps mean two different behaviours hiding behind one average

fastest 1m 33s · slowest 1m 56s

Why this test failed grouped by message, last 90 days

No failures recorded. 👍

Outcomes by target version

What this test does plain language, derived from the code

  1. site = Freight(page, ctx).sign_in("tester")
  2. page.goto(site.url("ops/reports/"))
  3. assert page.is_visible("#forbidden"), "a dispatcher must not see monthly reports"
  4. Note in the log: “dispatcher correctly refused; switching to a manager”
  5. site.sign_out()
  6. site.sign_in("manager")
  7. page.goto(site.url("ops/reports/"))
  8. Tick the checkbox input[name=detail][value=full]
  9. Click #generate-report
  10. Wait until #job-progress appears
  11. Take a screenshot (“report-started”)
  12. ⏱ Timed phase: monthly report (full)
  13. state = site.wait_for_job(timeout_s=330)
  14. assert state == "done", f"the report ended '{state}'"
  15. shipments = int(page.inner_text("#report-shipments"))
  16. revenue = money(page.inner_text("#report-revenue"))
  17. ctx.log(f"{shipments} shipments, revenue ${revenue:,.2f}")
  18. Take a screenshot (“report”)
  19. assert shipments > 0 and revenue > 0, "an empty report for the current month"
  20. report = site.download("#download-result", ctx.artifacts_dir / "report.csv")
  21. with open(report, newline="") as fh:
  22. kpis = {row["key"]: row for row in csv.DictReader(fh) if row["section"] == "kpi"}
  23. assert int(kpis["shipments"]["shipments"]) == shipments, "the CSV disagrees with the page"
Show the code
"""Role check, then a LONG wait: the full monthly report takes minutes.

First the access rule: a dispatcher asking for reports gets a polite 403;
reports are for managers. Then, as a manager, the test generates the full
report and waits for it -- about two minutes. That is the case the hub's
activity reel is built for: only the busy moments are kept, the long quiet
middle is sampled sparsely, and video is off for this test (see its
settings), so a long wait stays cheap to record.
"""
import csv

from _lib.freight import Freight, money


def run(page, ctx):
    site = Freight(page, ctx).sign_in("tester")
    page.goto(site.url("ops/reports/"))
    assert page.is_visible("#forbidden"), "a dispatcher must not see monthly reports"
    ctx.log("dispatcher correctly refused; switching to a manager")
    site.sign_out()

    site.sign_in("manager")
    page.goto(site.url("ops/reports/"))
    page.check("input[name=detail][value=full]")
    page.click("#generate-report")
    page.wait_for_selector("#job-progress")
    ctx.screenshot("report-started")

    with ctx.timed("monthly report (full)"):
        state = site.wait_for_job(timeout_s=330)
    assert state == "done", f"the report ended '{state}'"

    shipments = int(page.inner_text("#report-shipments"))
    revenue = money(page.inner_text("#report-revenue"))
    ctx.log(f"{shipments} shipments, revenue ${revenue:,.2f}")
    ctx.screenshot("report")
    assert shipments > 0 and revenue > 0, "an empty report for the current month"

    report = site.download("#download-result", ctx.artifacts_dir / "report.csv")
    with open(report, newline="") as fh:
        kpis = {row["key"]: row for row in csv.DictReader(fh) if row["section"] == "kpi"}
    assert int(kpis["shipments"]["shipments"]) == shipments, "the CSV disagrees with the page"

All runs

RunStatusQueuedDuration VersionTriggerBatch
#491 passed 2026-09-25 07:00:10 1m 34s 3.0.0 schedule schedule: Freight regression …
#379 passed 2026-09-24 23:07:41 1m 34s 3.0.0 manual DEMO-016
#371 passed 2026-09-24 22:05:21 1m 34s 3.0.0 group group: Freight regression
#313 passed 2026-09-24 18:59:58 1m 33s 3.0.0 cli-adopted 8 tests (terminal)
#305 passed 2026-09-24 18:57:59 1m 56s 2.1.0 cli-adopted 8 tests (terminal)
#293 passed 2026-09-24 18:55:40 1m 55s 2.0.0 cli-adopted 8 tests (terminal)
#154 passed 2026-09-24 18:52:00 1m 56s 1.1.0 cli-adopted 8 tests (terminal)
#16 passed 2026-09-24 18:48:19 1m 56s 1.0.0 cli-adopted 8 tests (terminal)