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

DEMO-019 Freight: wait for a truck on the live map

Edit Load test Duplicate

Opens the live fleet map (a page that redraws every two seconds), picks the truck due at its next stop soonest, and waits for that exact arrival. The hard case for recording a run: nothing is ever idle.

demofreightlivewaits version: 1.0 DEMO-019__freight_live_fleet.py group: Freight platform

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

Last 7 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 7 runs — slowest steps first, one line each

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

fastest 18s · slowest 1m 01s

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()
  2. site.open("ops/fleet/?region=california")
  3. Wait until #fleet-table tbody tr appears
  4. Take a screenshot (“fleet”)
  5. rows = page.eval_on_selector_all(
  6. "#fleet-table tbody tr[data-status='driving']",
  7. "rows => rows.map(r => ({truck: r.dataset.truck, stop: r.dataset.next,"
  8. " arrival: r.dataset.nextArrival, eta: parseInt(r.dataset.eta, 10)}))")
  9. assert rows, "no truck on the road -- the fleet should always be moving"
  10. later = [r for r in rows if r["eta"] >= 15]
  11. truck = min(later, key=lambda r: r["eta"]) if later else max(rows, key=lambda r: r["eta"])
  12. ctx.log(f"{truck['truck']} is due at {truck['stop']} in {truck['eta']}s "
  13. f"(arrival {truck['arrival']})")
  14. ⏱ Timed phase: wait for the truck to arrive
  15. page.wait_for_selector(f"#fleet-events li[data-arrival='{truck['arrival']}']",
  16. timeout=(truck["eta"] + 60) * 1000)
  17. Take a screenshot (“arrived”)
  18. event = page.inner_text(f"#fleet-events li[data-arrival='{truck['arrival']}']")
  19. assert truck["stop"] in event, f"the arrival names the wrong place: {event!r}"
  20. ctx.log(f"feed: {event}")
Show the code
"""Wait for something that HAPPENS, on a page that never stops moving.

The live fleet map redraws every truck every two seconds, so the page is
never idle -- the hardest case for recording: a naive "save a frame when the
screen changes" would keep saving for as long as the test waits. The hub
samples a busy page sparsely while the test only waits, and its video is off
(see the test's settings), so the run stays small however long the wait
(measured: ~27 frames, under 2 MB, for a 28 s wait and for a 48 s one).

The test picks the first truck due at least 15 seconds from now -- long
enough for the hub's idle sampling (it starts after 10 s without a page
action) to show in the reel, short enough to keep the run quick --
remembers that exact arrival (the feed also lists the SAME stop from the
truck's previous lap, so "any arrival at Fresno" would pass too early), and
waits for it.
"""
from _lib.freight import Freight


def run(page, ctx):
    site = Freight(page, ctx).sign_in()
    site.open("ops/fleet/?region=california")
    page.wait_for_selector("#fleet-table tbody tr")
    ctx.screenshot("fleet")

    rows = page.eval_on_selector_all(
        "#fleet-table tbody tr[data-status='driving']",
        "rows => rows.map(r => ({truck: r.dataset.truck, stop: r.dataset.next,"
        " arrival: r.dataset.nextArrival, eta: parseInt(r.dataset.eta, 10)}))")
    assert rows, "no truck on the road -- the fleet should always be moving"
    later = [r for r in rows if r["eta"] >= 15]
    truck = min(later, key=lambda r: r["eta"]) if later else max(rows, key=lambda r: r["eta"])
    ctx.log(f"{truck['truck']} is due at {truck['stop']} in {truck['eta']}s "
            f"(arrival {truck['arrival']})")

    with ctx.timed("wait for the truck to arrive"):
        page.wait_for_selector(f"#fleet-events li[data-arrival='{truck['arrival']}']",
                               timeout=(truck["eta"] + 60) * 1000)
    ctx.screenshot("arrived")
    event = page.inner_text(f"#fleet-events li[data-arrival='{truck['arrival']}']")
    assert truck["stop"] in event, f"the arrival names the wrong place: {event!r}"
    ctx.log(f"feed: {event}")

All runs

RunStatusQueuedDuration VersionTriggerBatch
#396 passed 2026-09-24 23:34:49 31s 3.0.0 group group: Freight platform
#359 passed 2026-09-24 22:04:44 18s 3.0.0 group group: Freight platform
#328 passed 2026-09-24 19:47:27 41s 3.0.0 cli-adopted 3 tests (terminal)
#325 passed 2026-09-24 19:46:19 1m 01s 2.1.0 cli-adopted 3 tests (terminal)
#322 passed 2026-09-24 19:45:49 25s 2.0.0 cli-adopted 3 tests (terminal)
#319 passed 2026-09-24 19:45:20 23s 1.1.0 cli-adopted 3 tests (terminal)
#316 passed 2026-09-24 19:44:24 49s 1.0.0 cli-adopted 3 tests (terminal)