testing.FakeSession ​

Contract 2.0.0 · package sha256 a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e · generated from testing.d.ts by services/onsite-scripter/scripts/build-contract-docs.mjs; edit the source, not this file.

Interface · import type { FakeSession } from '@holostep-configurators/runtime-client/testing'; · stable · since 2.0.0 · section 24. /testing

A Session that runs in Node with fake timers, plus controls for tests. How the fake runs:

Members ​

Member Kind Summary
tick method Advances fake time by dtMs, running every timer due on the way in due order, synchronously, the armed frame included (see above).
now method The fake's timeline, ms: the Frame.timeMs a frame drawn at this moment reads, that is performance.now() when the session was made plus the fake time ticked since.
frame method Draws count frames now: presents, dispatches events, runs frame hooks.
pointer method Simulates canvas input on the fake clock: a press at at, then the path, then the release.
hotspot? method · labs The shopper's pointer on a hotspot badge, by its HotspotBadge.id.
rulers? method · labs The rulers overlays.dimensions shows now, as the shopper reads them, so a planner's test asserts its labels, its per-module split and that they follow its writes: one entry per ruler, in set order (one set for …
resize? method · labs Resizes the element to width × height CSS px, as the page's layout would: the viewport createFakeSession took changes at once (camera.state.aspect, camera.project, picks, info()), 'resize' fires at the next…
script method Forces a member's next outcome, e.g. a load failure.
setArModes method The AR probe's answer: sets info().ar.modes and turns info().ar.pending false at once; 'ar:modes' dispatches at the next drawn frame (frame() or tick(16)), as the fake's other events do, so call one of them…
detach method Simulates el leaving the document after boot, as spec section 6.5's disconnect row says.
record method Records problem as the runtime would, with at and docs filled: in problems() and info().problems, and to 'problem' handlers at once, as the runtime dispatches a recorded Problem (spec section 6.11, step 10).
trace method Every state change so far, in order: each operation's states (spec section 6.2), each drawn frame that presents commits (member 'frame') and each commit's dispatch (member 'events').
problems method Every Problem recorded so far.

Inherited from Session: revision, seq, history, input, overlays, document, transaction, beforeCommit, undo, redo, on, onFrame, idle, capture, export, activateAR, canTryOn, tryOn, endAR, describe, supports, permits, applyDocument, info, destroy.

Inherited from Writer: node, find, collection, apply, applyPatch, setSceneModel, select, stage, materials, assembly, camera, animations, labs, state, getSceneModel.

Declaration ​

ts
export interface FakeSession extends Session {
  tick(dtMs: number): void;
  now(): number;
  frame(count?: number): void;
  pointer(input: {
    kind: 'click' | 'drag' | 'longPress' | 'move';
    at: {
      x: number;
      y: number;
    };
    to?: {
      x: number;
      y: number;
    };
    pointerType?: 'mouse' | 'pen' | 'touch';
    durationMs?: number;
    pointerId?: number;
  }): void;
  hotspot?(id: string, action?: 'click' | 'hover' | 'leave'): boolean;
  rulers?(): ReadonlyArray<{
    readonly axis: 'width' | 'height' | 'depth';
    readonly metres: number;
    readonly label: string;
    readonly part: Part | null;
  }>;
  resize?(width: number, height: number): void;
  script(member: string, result: {
    fail?: boolean;
    delayMs?: number;
    problem?: ProblemCode;
    collection?: string;
    cancel?: boolean;
  }): void;
  setArModes(modes: InfoReport['ar']['modes']): void;
  detach(): void;
  record(problem: Omit<Problem, 'at' | 'docs'>): void;
  trace(): readonly TraceEntry[];
  problems(): readonly Problem[];
}

Generic-API test (spec 3.1) ​

Rule Result
1. Neutral name pass: FakeSession names no product
2. A precedent not recorded: no ledger row (coverage.json) names this member or its owner
3. Two apps, or labs not recorded: no ledger row names this member or its owner
4. The cheaper fix first not recorded per member (Appendix B decides it per need)