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

DEMO-T14 TS Freight: dock drag-and-drop in TypeScript

Edit Load test Duplicate

DEMO-021's yard rules in TypeScript with locator.dragTo(): allowed drops land, a hazardous load at a normal door is refused with the reason, and the schedule survives a reload.

demodrag-and-dropfreighttypescript DEMO-T14__freight_docks_typescript.spec.ts group: Freight in TypeScriptgroup: Python and TypeScript, side by side

Runs
7
Pass rate
100%
7 passed / 0 failed
Avg duration
5s
p95 6s
Estimate
5s
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 5s · slowest 6s

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

    No steps found.
Show the code
import { test, expect } from '@playwright/test';
import { open, signIn } from './_lib/freight';

// Drag-and-drop with rules, in TypeScript -- DEMO-021's checks with
// locator.dragTo(): allowed drops land, hazardous goods at a normal door are
// refused with the reason, and the board survives a reload (it is stored on
// the server, not just drawn).
test('trucks are scheduled by drag-and-drop, within the yard rules', async ({ page }) => {
  await signIn(page);
  await open(page, 'ops/docks/');

  const arrival = async (selector: string) =>
    (await page.locator(selector).first().getAttribute('data-arrival')) as string;
  const hazmat = await arrival("#arrivals .dock-card[data-hazardous='1']");
  const heavy = await arrival("#arrivals .dock-card[data-heavy='1'][data-hazardous='0']");
  const normal = await arrival("#arrivals .dock-card[data-heavy='0'][data-hazardous='0']");
  console.log(`hazmat ${hazmat}, heavy ${heavy}, normal ${normal}`);

  const card = (id: string) => page.locator(`.dock-card[data-arrival='${id}']`);
  const cell = (at: string) => page.locator(`td[data-cell='${at}']`);
  const placed = (id: string, at: string) => cell(at).locator(`.dock-card[data-arrival='${id}']`);

  await test.step('a normal load to Door 3, 09:00', async () => {
    await card(normal).dragTo(cell('D3|09:00'));
    await expect(placed(normal, 'D3|09:00')).toBeVisible();
  });

  await test.step('hazardous goods at Door 1 are refused', async () => {
    await card(hazmat).dragTo(cell('D1|10:00'));
    await expect(page.locator('#dock-error')).toBeVisible();
    await expect(page.locator('#dock-error')).toContainText(/hazardous/i);
    await expect(placed(hazmat, 'D1|10:00')).toHaveCount(0);
  });

  await test.step('hazardous goods at Door 4 (hazmat)', async () => {
    await card(hazmat).dragTo(cell('D4|10:00'));
    await expect(placed(hazmat, 'D4|10:00')).toBeVisible();
  });

  await test.step('a heavy load to a forklift door', async () => {
    await card(heavy).dragTo(cell('D1|11:00'));
    await expect(placed(heavy, 'D1|11:00')).toBeVisible();
  });

  await test.step('the board survives a reload', async () => {
    await page.reload();
    await expect(placed(normal, 'D3|09:00')).toBeVisible();
    await expect(placed(hazmat, 'D4|10:00')).toBeVisible();
    await expect(placed(heavy, 'D1|11:00')).toBeVisible();
  });
});

All runs

RunStatusQueuedDuration VersionTriggerBatch
#478 passed 2026-09-25 00:30:11 5s 3.0.0 group group: Python and TypeScript,…
#466 passed 2026-09-25 00:29:44 6s 3.0.0 group group: Freight in TypeScript
#432 passed 2026-09-25 00:23:39 5s 3.0.0 cli-adopted 7 tests (terminal)
#425 passed 2026-09-25 00:23:08 5s 2.1.0 cli-adopted 7 tests (terminal)
#418 passed 2026-09-25 00:22:38 5s 2.0.0 cli-adopted 7 tests (terminal)
#411 passed 2026-09-25 00:22:11 5s 1.1.0 cli-adopted 7 tests (terminal)
#404 passed 2026-09-25 00:21:43 6s 1.0.0 cli-adopted 7 tests (terminal)