testing.FakeSession ​Contract 2.0.0 · package sha256
a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e· generated fromtesting.d.tsbyservices/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:
tick: loads, decodes, timeouts, tweens, clips and autoRotate run on
fake-clock ms. A commit to show, an event to dispatch, a camera move or a clip arms a frame
16 fake ms ahead, which tick draws once it passes it; frame() draws one at once.frame() with no tick
between steps nothing. A test pumps tick(16) and awaits between ticks, so promise
continuations run: a write's Promise settles at its commit point, its events a frame later.hotspots.set, anchors.set and dimensions apply at the next drawn frame, and
'anchors:moved' fires at drawn frames, the anchors projected through the fake's camera and
viewport, as on the runtime. hotspot clicks, hovers and leaves a badge ('hotspot:click',
'hotspot:hover'), and rulers reads the rulers shown; no read returns the badges or anchors.pointer press no drag claims is the shopper's camera gesture
('camera:control-start' and '-end'), and one pointer's path turns the camera as the
runtime's orbit controls do, so 'camera:changed' and 'camera:rest' fire. resize resizes
the element ('resize'). The in-page AR events ('xr:start', 'xr:end', 'xr:cta') never fire:
the fake opens no AR session; try-on answers from profile.tryOn.capture() resolves image as a 1-byte placeholder Blob of the asked type ('image/png'
unless format says 'jpeg'), not a picture; snapshot holds what it drew. export()
resolves a 1-byte blob likewise, once profile.permits lists 'export'.supports() answers false for its id.| 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.
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[];
}
| 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) |