@threenative/playtest 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capture.d.ts +7 -0
- package/dist/{diagnostics-Bpy15z5f.d.ts → diagnostics-BXhYI2sc.d.ts} +389 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +206 -41
- package/dist/protocol.d.ts +7 -0
- package/dist/runner/cli.d.ts +2 -2
- package/dist/runner/cli.js +1192 -298
- package/dist/runner/index.d.ts +71 -240
- package/dist/runner/index.js +1651 -971
- package/dist/{shared-eFOF5bZO.d.ts → shared-CHIDDJpp.d.ts} +38 -5
- package/dist/three/index.d.ts +10 -1
- package/dist/three/index.js +11 -6
- package/package.json +1 -1
package/dist/capture.d.ts
CHANGED
|
@@ -43,6 +43,13 @@ declare function inspectFrame(png: Buffer): ICaptureFrameStats;
|
|
|
43
43
|
* @example assertCaptureNotBlank(png, "first frame");
|
|
44
44
|
*/
|
|
45
45
|
declare function assertCaptureNotBlank(png: Buffer, label: string): ICaptureFrameStats;
|
|
46
|
+
/**
|
|
47
|
+
* Fail closed when a screenshot is blank or uniform.
|
|
48
|
+
* @situation guard a visual playtest against a blank frame
|
|
49
|
+
* @situation prove a screenshot contains more than a loading surface
|
|
50
|
+
* @constraint the assertion throws instead of returning a false pass
|
|
51
|
+
* @example assertFrameShowsSomething(png, "first frame");
|
|
52
|
+
*/
|
|
46
53
|
declare const assertFrameShowsSomething: typeof assertCaptureNotBlank;
|
|
47
54
|
|
|
48
55
|
export { CAPTURE_GUARD_LIMITS, CaptureGuardError, type ICaptureFrameStats, assertCaptureNotBlank, assertFrameShowsSomething, inspectFrame };
|
|
@@ -36,13 +36,18 @@ type IPlaytestResourceWait = {
|
|
|
36
36
|
path: string;
|
|
37
37
|
};
|
|
38
38
|
interface IPlaytestStep {
|
|
39
|
-
kind?: "aimAt" | "click" | "input" | "wait";
|
|
39
|
+
kind?: "aimAt" | "click" | "input" | "lifecycle" | "wait";
|
|
40
40
|
/** @deprecated Use holdTicks. Fixed-step bridges treat this as a tick alias. */
|
|
41
41
|
holdFrames?: number;
|
|
42
42
|
holdTicks?: number;
|
|
43
43
|
/** A viewport-pixel click target, resolved directly or from a registered entity's bounds. */
|
|
44
44
|
at?: IPlaytestClickTarget;
|
|
45
45
|
label?: string;
|
|
46
|
+
/**
|
|
47
|
+
* One device-lifecycle operation the runner drives through the platform driver, so the phases it
|
|
48
|
+
* then reports are read off the device rather than asserted by the game about itself.
|
|
49
|
+
*/
|
|
50
|
+
lifecycle?: IPlaytestLifecycleStep;
|
|
46
51
|
overlayMessage?: {
|
|
47
52
|
overlayId: string;
|
|
48
53
|
payload: unknown;
|
|
@@ -82,6 +87,23 @@ type IPlaytestAimTarget = {
|
|
|
82
87
|
x: number;
|
|
83
88
|
z: number;
|
|
84
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* The device operations a `lifecycle` step names.
|
|
92
|
+
*
|
|
93
|
+
* `rotate` is the only one that carries an argument, and the `?: never` arms are what stop a
|
|
94
|
+
* scenario from writing `{ operation: "background", rotation: 1 }` and having the rotation
|
|
95
|
+
* silently dropped.
|
|
96
|
+
*/
|
|
97
|
+
type IPlaytestLifecycleStep = {
|
|
98
|
+
operation: "background";
|
|
99
|
+
rotation?: never;
|
|
100
|
+
} | {
|
|
101
|
+
operation: "foreground";
|
|
102
|
+
rotation?: never;
|
|
103
|
+
} | {
|
|
104
|
+
operation: "rotate";
|
|
105
|
+
rotation: number;
|
|
106
|
+
};
|
|
85
107
|
type IPlaytestClickTarget = {
|
|
86
108
|
entity: string;
|
|
87
109
|
} | {
|
|
@@ -383,7 +405,8 @@ interface IPlaytestPerformanceAssertion {
|
|
|
383
405
|
/** Per-pass triangle ceilings, keyed by pass kind: main, shadow, reflection, nested. */
|
|
384
406
|
maxPassTriangles?: Readonly<Partial<Record<PlaytestFramePassKind, number>>>;
|
|
385
407
|
}
|
|
386
|
-
|
|
408
|
+
/** The stage expectations a render-chain assertion can hold, without its own per-adapter branches. */
|
|
409
|
+
interface IPlaytestRenderChainExpectation {
|
|
387
410
|
contributions?: {
|
|
388
411
|
graphOutputChanged: string[];
|
|
389
412
|
};
|
|
@@ -398,6 +421,17 @@ interface IPlaytestRenderChainAssertion {
|
|
|
398
421
|
maxRejectionFraction: number;
|
|
399
422
|
};
|
|
400
423
|
}
|
|
424
|
+
interface IPlaytestRenderChainAssertion extends IPlaytestRenderChainExpectation {
|
|
425
|
+
/**
|
|
426
|
+
* What the chain must look like on each adapter the run's own `adapter.info` classified, chosen
|
|
427
|
+
* by the harness's software-adapter detector rather than by anything the game reported. A lane
|
|
428
|
+
* whose adapter cannot be classified is a failed observation, not a hardware one: a missing
|
|
429
|
+
* branch is not a licence to pass.
|
|
430
|
+
*/
|
|
431
|
+
perAdapter?: Partial<Record<PlaytestAdapterClass, IPlaytestRenderChainExpectation>>;
|
|
432
|
+
}
|
|
433
|
+
/** What the harness read out of `adapter.info` for this run, before any game code answered. */
|
|
434
|
+
type PlaytestAdapterClass = "hardware" | "software";
|
|
401
435
|
/** Ceilings on the application's startup milestones, in milliseconds since navigation. */
|
|
402
436
|
interface IPlaytestStartupAssertion {
|
|
403
437
|
/** The start scene's `enter()` returned: a controllable world exists. */
|
|
@@ -711,6 +745,347 @@ interface IPlaytestScenarioDiagnostic {
|
|
|
711
745
|
suggestion?: string;
|
|
712
746
|
}
|
|
713
747
|
|
|
748
|
+
interface IAndroidDriverOptions {
|
|
749
|
+
activity: string;
|
|
750
|
+
adbPath?: string;
|
|
751
|
+
packageName: string;
|
|
752
|
+
serial?: string;
|
|
753
|
+
/** Android user id to target; when omitted, the device's current foreground user is detected. */
|
|
754
|
+
user?: string;
|
|
755
|
+
/**
|
|
756
|
+
* The rotation between the touchscreen's raw axes and the frame the app draws in, when the
|
|
757
|
+
* device cannot be asked.
|
|
758
|
+
*
|
|
759
|
+
* Normally this is read from the window — `dumpsys window`'s `mRotation`, inverted, and then
|
|
760
|
+
* `dumpsys input`'s `SurfaceOrientation` and the `user_rotation` setting behind it. Those two
|
|
761
|
+
* older sources are why this option exists: an orientation-locked game on a device whose
|
|
762
|
+
* display never rotated reads 0 from both while its window is turned 90° from the panel, so an
|
|
763
|
+
* injected touch lands somewhere else entirely and every input assertion fails for a reason
|
|
764
|
+
* that has nothing to do with the game.
|
|
765
|
+
*
|
|
766
|
+
* Set explicitly to make such a run reproducible, and say so in the evidence. Fails closed on
|
|
767
|
+
* anything but 0, 1, 2 or 3.
|
|
768
|
+
*/
|
|
769
|
+
touchRotation?: number;
|
|
770
|
+
}
|
|
771
|
+
interface IAndroidDriver {
|
|
772
|
+
/** Send the app behind HOME and wait until the device reports it unfocused. */
|
|
773
|
+
background?(): Promise<void>;
|
|
774
|
+
captureConsole(): Promise<Array<{
|
|
775
|
+
text: string;
|
|
776
|
+
type: string;
|
|
777
|
+
}>>;
|
|
778
|
+
/** The device this driver is bound to, when it knows; reported next to its metric samples. */
|
|
779
|
+
deviceSerial?(): string | undefined;
|
|
780
|
+
/** Bring the launched app back to the foreground without force-stopping it. */
|
|
781
|
+
foreground?(): Promise<void>;
|
|
782
|
+
isAlive(): Promise<boolean>;
|
|
783
|
+
/** What the device says about the app right now; the lifecycle phases are read from this. */
|
|
784
|
+
lifecycleState?(): Promise<IAndroidAppState>;
|
|
785
|
+
prepare(endpoint: string, mailboxRoot?: string, viewport?: {
|
|
786
|
+
height: number;
|
|
787
|
+
width: number;
|
|
788
|
+
}): Promise<void>;
|
|
789
|
+
readFile?(path: string): Promise<string | undefined>;
|
|
790
|
+
removeFile?(path: string): Promise<void>;
|
|
791
|
+
/** Lock the display to one rotation and wait until the device's own window reports it. */
|
|
792
|
+
rotate?(rotation: number): Promise<void>;
|
|
793
|
+
/** Raw adb passthrough, so the host can measure the device itself. Read-only probes only. */
|
|
794
|
+
runAdb?(args: readonly string[]): Promise<string>;
|
|
795
|
+
screenshot(path: string): Promise<void>;
|
|
796
|
+
setPointers?(pointers: readonly IAndroidPointer[]): Promise<IAndroidPointerInjection>;
|
|
797
|
+
startScreenRecording?(): Promise<void>;
|
|
798
|
+
/** One OS tap in viewport pixels. Works on emulators and physical devices alike. */
|
|
799
|
+
tap?(x: number, y: number): Promise<void>;
|
|
800
|
+
/** Put the soft keyboard away, and report whether one was up. */
|
|
801
|
+
hideKeyboard?(): Promise<boolean>;
|
|
802
|
+
stop(): Promise<void>;
|
|
803
|
+
stopScreenRecording?(path: string): Promise<void>;
|
|
804
|
+
writeFile?(path: string, contents: string): Promise<void>;
|
|
805
|
+
}
|
|
806
|
+
/** The device operations a scenario's `lifecycle` step can name. */
|
|
807
|
+
type IAndroidLifecycleOperation = "background" | "foreground" | "rotate";
|
|
808
|
+
/**
|
|
809
|
+
* One reading of the app, taken off the device and never off the game.
|
|
810
|
+
*
|
|
811
|
+
* `frames` is the platform's own count of frames drawn for this process (`dumpsys gfxinfo`), which
|
|
812
|
+
* is what makes "the surface stopped while backgrounded and started again after resume" a
|
|
813
|
+
* measurement rather than a claim. It is absent when the device declined to report one, and the
|
|
814
|
+
* runner treats that absence as a failure — a zero here would be indistinguishable from a game
|
|
815
|
+
* that genuinely drew nothing.
|
|
816
|
+
*/
|
|
817
|
+
interface IAndroidAppState {
|
|
818
|
+
focused: boolean;
|
|
819
|
+
frames?: number;
|
|
820
|
+
pid?: number;
|
|
821
|
+
/** `mRotation` for the app's window: how far its content is turned from the panel's frame. */
|
|
822
|
+
windowRotation?: number;
|
|
823
|
+
}
|
|
824
|
+
/** One device-observed lifecycle phase, in the order the scenario drove them. */
|
|
825
|
+
interface IPlaytestDeviceLifecyclePhase {
|
|
826
|
+
at: number;
|
|
827
|
+
focused: boolean;
|
|
828
|
+
frames: number;
|
|
829
|
+
/** Only on a `background` phase: the platform's frame count stopped before this reading. */
|
|
830
|
+
framesPaused?: boolean;
|
|
831
|
+
phase: IAndroidLifecycleOperation;
|
|
832
|
+
pid: number;
|
|
833
|
+
requestedRotation?: number;
|
|
834
|
+
windowRotation?: number;
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* The simulation-step count at each read around a driven lifecycle.
|
|
838
|
+
*
|
|
839
|
+
* A read the scenario never reached is `null` rather than a count this run did not take.
|
|
840
|
+
*/
|
|
841
|
+
interface IPlaytestDeviceLifecycleSteps {
|
|
842
|
+
afterAdvance: number | null;
|
|
843
|
+
afterForeground: number | null;
|
|
844
|
+
beforeBackground: number | null;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* The simulation-step count read around a driven lifecycle, and what it says about continuity.
|
|
848
|
+
*
|
|
849
|
+
* The counter is runtime-owned, not device-observed: the platform counts drawn frames, and
|
|
850
|
+
* `dumpsys gfxinfo` has no physics counter, so only the plugin that performed the step can say
|
|
851
|
+
* whether the simulation moved. Neither the device nor a game-authored `GameState` can restate it.
|
|
852
|
+
*/
|
|
853
|
+
type IPlaytestDeviceLifecyclePhysics = {
|
|
854
|
+
available: false;
|
|
855
|
+
reason: string;
|
|
856
|
+
} | {
|
|
857
|
+
available: true;
|
|
858
|
+
/** Read immediately before the app went away, on its return before the advance, and after. */
|
|
859
|
+
steps: IPlaytestDeviceLifecycleSteps;
|
|
860
|
+
/** The count moved across the runner's advance after the app came back, or `null`. */
|
|
861
|
+
stepsAdvanced: boolean | null;
|
|
862
|
+
/** The count stood still while the app was away, or `null` for a scenario that never left. */
|
|
863
|
+
stepsPaused: boolean | null;
|
|
864
|
+
};
|
|
865
|
+
/**
|
|
866
|
+
* The runner's own account of a driven lifecycle, for a collector to bind to a scenario and an
|
|
867
|
+
* installed artifact. Nothing here was authored by the game.
|
|
868
|
+
*/
|
|
869
|
+
interface IPlaytestDeviceLifecycleObservation {
|
|
870
|
+
phases: readonly IPlaytestDeviceLifecyclePhase[];
|
|
871
|
+
/** Absent rather than zero on a build that installs no physics plugin, and a failed run rather
|
|
872
|
+
* than a value when the plugin advertised one and reported nothing readable. */
|
|
873
|
+
physics: IPlaytestDeviceLifecyclePhysics;
|
|
874
|
+
render: {
|
|
875
|
+
/** Frames advanced after the background phase, or `null` when there was nothing to compare. */
|
|
876
|
+
framesAdvanced: boolean | null;
|
|
877
|
+
/** Whether the device's own frame count stopped while the app was unfocused, or `null`. */
|
|
878
|
+
framesPaused: boolean | null;
|
|
879
|
+
};
|
|
880
|
+
/** The process every phase reported; a different pid anywhere is a failed run, not a row. */
|
|
881
|
+
session: {
|
|
882
|
+
pid: number;
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
interface IAndroidPointer {
|
|
886
|
+
buttons?: number;
|
|
887
|
+
id: number;
|
|
888
|
+
x: number;
|
|
889
|
+
y: number;
|
|
890
|
+
}
|
|
891
|
+
interface IAndroidPointerInjection {
|
|
892
|
+
activeIds: number[];
|
|
893
|
+
injection: "adb-emu-event-protocol-b";
|
|
894
|
+
rotation: number;
|
|
895
|
+
trackingIds: number[];
|
|
896
|
+
}
|
|
897
|
+
interface IAndroidTouchViewport {
|
|
898
|
+
device: {
|
|
899
|
+
height: number;
|
|
900
|
+
width: number;
|
|
901
|
+
};
|
|
902
|
+
logical: {
|
|
903
|
+
bottom: number;
|
|
904
|
+
left: number;
|
|
905
|
+
right: number;
|
|
906
|
+
top: number;
|
|
907
|
+
};
|
|
908
|
+
orientation: number | undefined;
|
|
909
|
+
physical: {
|
|
910
|
+
bottom: number;
|
|
911
|
+
left: number;
|
|
912
|
+
right: number;
|
|
913
|
+
top: number;
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
declare class AdbAndroidDriver implements IAndroidDriver {
|
|
917
|
+
private readonly options;
|
|
918
|
+
private static readonly COVERAGE_VIDEO_PATH;
|
|
919
|
+
/** Bounded polls for a lifecycle operation to become visible to the device's own readings. */
|
|
920
|
+
private static readonly LIFECYCLE_ATTEMPTS;
|
|
921
|
+
private readonly adbPath;
|
|
922
|
+
private screenrecord?;
|
|
923
|
+
private screenrecordError?;
|
|
924
|
+
private readonly touchSlots;
|
|
925
|
+
private nextTrackingId;
|
|
926
|
+
private rotation?;
|
|
927
|
+
private touchViewport?;
|
|
928
|
+
private readonly user?;
|
|
929
|
+
private activeUser?;
|
|
930
|
+
/** Set by a lifecycle `rotate`, whose display lock `stop()` has to free on its own account. */
|
|
931
|
+
private lifecycleRotationLocked;
|
|
932
|
+
private viewportPresented;
|
|
933
|
+
constructor(options: IAndroidDriverOptions);
|
|
934
|
+
prepare(endpoint: string, mailboxRoot?: string, viewport?: {
|
|
935
|
+
height: number;
|
|
936
|
+
width: number;
|
|
937
|
+
}): Promise<void>;
|
|
938
|
+
private resolveUser;
|
|
939
|
+
/**
|
|
940
|
+
* Put the device into the scenario's viewport, and fail closed if it did not take.
|
|
941
|
+
*
|
|
942
|
+
* A silent failure here is the expensive one: the run continues, the touches arrive, the
|
|
943
|
+
* assertions go red, and the report blames the game for a device that was never showing the
|
|
944
|
+
* viewport the scenario asked for.
|
|
945
|
+
*/
|
|
946
|
+
private presentViewport;
|
|
947
|
+
tap(x: number, y: number): Promise<void>;
|
|
948
|
+
/**
|
|
949
|
+
* The three device operations a `lifecycle` step names, each waiting for the device to *report*
|
|
950
|
+
* the effect rather than for the command to return.
|
|
951
|
+
*
|
|
952
|
+
* `input keyevent 3` and `am start` both answer `OK` whether or not anything moved, and `wm
|
|
953
|
+
* user-rotation lock` answers the same way on a device whose rotation is pinned. A step that
|
|
954
|
+
* recorded a phase on the strength of the exit code alone would certify a device that never went
|
|
955
|
+
* away — which is the exact value the gate exists to read off the phone, so each op polls the
|
|
956
|
+
* reading it is about to claim and throws when the claim is false.
|
|
957
|
+
*/
|
|
958
|
+
background(): Promise<void>;
|
|
959
|
+
foreground(): Promise<void>;
|
|
960
|
+
rotate(rotation: number): Promise<void>;
|
|
961
|
+
lifecycleState(): Promise<IAndroidAppState>;
|
|
962
|
+
private waitForFocus;
|
|
963
|
+
/**
|
|
964
|
+
* Dismiss the soft keyboard and wait for it to actually be gone.
|
|
965
|
+
*
|
|
966
|
+
* Measured on the physical Pixel 8: focusing a text field opens the IME, the WebView reflows
|
|
967
|
+
* into the space left above it, and the page's centred menu rides up — so a coordinate computed
|
|
968
|
+
* against the scenario's viewport now points at the keyboard. A tap there does not merely miss
|
|
969
|
+
* the control; it types a character into the field it meant to submit.
|
|
970
|
+
*
|
|
971
|
+
* BACK is the dismissal the platform guarantees. The wait is the point: the reflow happens on
|
|
972
|
+
* the next layout pass, and a click sent into the middle of it lands wherever the menu was
|
|
973
|
+
* halfway through moving.
|
|
974
|
+
*/
|
|
975
|
+
hideKeyboard(): Promise<boolean>;
|
|
976
|
+
captureConsole(): Promise<Array<{
|
|
977
|
+
text: string;
|
|
978
|
+
type: string;
|
|
979
|
+
}>>;
|
|
980
|
+
screenshot(path: string): Promise<void>;
|
|
981
|
+
startScreenRecording(): Promise<void>;
|
|
982
|
+
stopScreenRecording(path: string): Promise<void>;
|
|
983
|
+
isAlive(): Promise<boolean>;
|
|
984
|
+
setPointers(pointers: readonly IAndroidPointer[]): Promise<IAndroidPointerInjection>;
|
|
985
|
+
readFile(path: string): Promise<string | undefined>;
|
|
986
|
+
removeFile(path: string): Promise<void>;
|
|
987
|
+
stop(): Promise<void>;
|
|
988
|
+
private readRotation;
|
|
989
|
+
writeFile(path: string, contents: string): Promise<void>;
|
|
990
|
+
deviceSerial(): string | undefined;
|
|
991
|
+
/**
|
|
992
|
+
* The device-metrics probes read `dumpsys`, `logcat` and sysfs through here. Deliberately a
|
|
993
|
+
* thin passthrough rather than a metrics API: the parsing belongs to deviceMetrics.ts, which
|
|
994
|
+
* is unit-tested against real captured device output.
|
|
995
|
+
*/
|
|
996
|
+
runAdb(args: readonly string[]): Promise<string>;
|
|
997
|
+
private adb;
|
|
998
|
+
private waitForScreenRecorder;
|
|
999
|
+
private abortScreenRecording;
|
|
1000
|
+
private serialArgs;
|
|
1001
|
+
}
|
|
1002
|
+
declare function parseAndroidConsole(output: string): Array<{
|
|
1003
|
+
text: string;
|
|
1004
|
+
type: string;
|
|
1005
|
+
}>;
|
|
1006
|
+
declare function parseAndroidTouchViewport(output: string): IAndroidTouchViewport;
|
|
1007
|
+
/** Map a normalized logical-display point to the raw touchscreen axes. */
|
|
1008
|
+
declare function touchPositionForViewport(x: number, y: number, viewport: IAndroidTouchViewport, rotationOverride?: number): [number, number];
|
|
1009
|
+
/**
|
|
1010
|
+
* Splits slot identity from coordinates into separate synced `adb emu event send` batches.
|
|
1011
|
+
*
|
|
1012
|
+
* The emulator console drops ABS_MT_POSITION_X/Y from any batch that also carries an
|
|
1013
|
+
* ABS_MT_TRACKING_ID: the command reports `OK` and the coordinates never reach the device, so
|
|
1014
|
+
* every contact lands at (0, 0) and a two-finger gesture reads as two touches in the same
|
|
1015
|
+
* screen half — the exact failure that made the simultaneous-touch proof unprovable.
|
|
1016
|
+
* Confirmed against `getevent -lt /dev/input/event2` on emulator 36.6.11 with the android-35
|
|
1017
|
+
* google_apis image. Identity goes first so a slot exists before it is positioned.
|
|
1018
|
+
*/
|
|
1019
|
+
declare function androidTouchBatches(identity: readonly string[], positions: readonly string[]): string[][];
|
|
1020
|
+
/**
|
|
1021
|
+
* Confirm that Android reported the requested viewport, including the physical-size omission.
|
|
1022
|
+
*
|
|
1023
|
+
* @situation verify that an Android device presented the requested viewport
|
|
1024
|
+
* @situation accept the physical panel size when `wm size` omits its override line
|
|
1025
|
+
* @example viewportPresentationObserved(undefined, "1080x2400", { width: 1080, height: 2400 });
|
|
1026
|
+
*/
|
|
1027
|
+
declare function viewportPresentationObserved(override: string | undefined, expected: string | undefined, physical: {
|
|
1028
|
+
height: number;
|
|
1029
|
+
width: number;
|
|
1030
|
+
}): boolean;
|
|
1031
|
+
/**
|
|
1032
|
+
* The touch rotation for the window `dumpsys window` just described, or `undefined`.
|
|
1033
|
+
*
|
|
1034
|
+
* `mRotation` says how far the window's content is turned from the panel's natural frame.
|
|
1035
|
+
* {@link rotatedTouchPosition} converts the other way — a point in that content back to the
|
|
1036
|
+
* panel's raw axes — so the value it needs is the inverse, and handing it `mRotation` directly
|
|
1037
|
+
* is a 180-degree error on either odd rotation.
|
|
1038
|
+
*
|
|
1039
|
+
* This is the source of truth because it describes the *window*. `dumpsys input`'s
|
|
1040
|
+
* `SurfaceOrientation` is absent on the emulator, and `user_rotation` is the user's preference:
|
|
1041
|
+
* an orientation-locked game on a device the user never turned reads 0 there while its window
|
|
1042
|
+
* is turned 90 degrees off the panel, so every injected touch lands somewhere else.
|
|
1043
|
+
*/
|
|
1044
|
+
declare function touchRotationFromWindowDump(dump: string): number | undefined;
|
|
1045
|
+
/**
|
|
1046
|
+
* Make the device present a scenario's declared viewport, one device pixel per CSS pixel.
|
|
1047
|
+
*
|
|
1048
|
+
* A scenario's `viewport` is a declared test condition, and the browser target honours it by
|
|
1049
|
+
* sizing the window. Without the same courtesy here, a UI page lays out at whatever CSS viewport
|
|
1050
|
+
* the device's density happens to give — 914x411 on a 2400x1080 panel at 420dpi — and a step
|
|
1051
|
+
* that names a point in viewport pixels lands on whatever the device's own layout put there.
|
|
1052
|
+
* Nothing about that failure looks like a coordinate problem: the touch arrives, the host
|
|
1053
|
+
* hit-tests it honestly, and the control simply is not where the scenario said.
|
|
1054
|
+
*
|
|
1055
|
+
* Density 160 is the whole mechanism: it makes `devicePixelRatio` 1, so a viewport pixel, a CSS
|
|
1056
|
+
* pixel and a device pixel are the same pixel and the page lays out exactly as it does on web.
|
|
1057
|
+
* The size is written in the panel's natural frame, which is why it is transposed for the
|
|
1058
|
+
* portrait-natural devices every phone and emulator here happens to be.
|
|
1059
|
+
*/
|
|
1060
|
+
declare function viewportPresentationCommands(viewport: {
|
|
1061
|
+
height: number;
|
|
1062
|
+
width: number;
|
|
1063
|
+
}, physical: {
|
|
1064
|
+
height: number;
|
|
1065
|
+
width: number;
|
|
1066
|
+
}): string[][];
|
|
1067
|
+
/**
|
|
1068
|
+
* One OS-level tap, in the display's current orientation.
|
|
1069
|
+
*
|
|
1070
|
+
* With the viewport presented, that orientation *is* the scenario's viewport and the coordinate
|
|
1071
|
+
* needs no rotation — which is the second reason to prefer this over the emulator's pointer
|
|
1072
|
+
* protocol. The first is that `adb emu event send` exists only on emulators, and a click step
|
|
1073
|
+
* that only works on an emulator is a click step that does not work.
|
|
1074
|
+
*/
|
|
1075
|
+
declare function tapCommand(x: number, y: number): string[];
|
|
1076
|
+
/** Whether an input method window is on screen, from `dumpsys input_method`. */
|
|
1077
|
+
declare function keyboardIsShown(dump: string): boolean;
|
|
1078
|
+
/**
|
|
1079
|
+
* Undo the presentation.
|
|
1080
|
+
*
|
|
1081
|
+
* `reset` and never the numbers read beforehand: a run that crashed between reading and writing
|
|
1082
|
+
* would restore a size it had already replaced, and leave the device quietly wrong for whoever
|
|
1083
|
+
* measures on it next.
|
|
1084
|
+
*/
|
|
1085
|
+
declare function viewportRestoreCommands(): string[][];
|
|
1086
|
+
declare function rotatedTouchPosition(x: number, y: number, rotation: number): [number, number];
|
|
1087
|
+
declare function discoverAdb(environment?: NodeJS.ProcessEnv): string;
|
|
1088
|
+
|
|
714
1089
|
/**
|
|
715
1090
|
* Device thermal, power and battery state as a first-class measured observation.
|
|
716
1091
|
*
|
|
@@ -911,7 +1286,11 @@ interface IPlaytestDiagnosticsPolicy {
|
|
|
911
1286
|
interface IPlaytestCaptureProvenance {
|
|
912
1287
|
adapter: Record<string, string>;
|
|
913
1288
|
browserArgs: readonly string[];
|
|
914
|
-
|
|
1289
|
+
/**
|
|
1290
|
+
* How this run's pixels were captured. `page.screenshot` is a browser capture session;
|
|
1291
|
+
* `device.screenshot` is a native host asked for its framebuffer directly.
|
|
1292
|
+
*/
|
|
1293
|
+
captureMethod: "device.screenshot" | "page.screenshot";
|
|
915
1294
|
rendererKind: "webgl" | "webgpu";
|
|
916
1295
|
target: string;
|
|
917
1296
|
viewport: IPlaytestViewport;
|
|
@@ -1000,6 +1379,11 @@ interface IPlaytestObservations {
|
|
|
1000
1379
|
}>;
|
|
1001
1380
|
contacts?: unknown;
|
|
1002
1381
|
debugColliderCount?: number;
|
|
1382
|
+
/**
|
|
1383
|
+
* Host-measured device lifecycle: the phases a `lifecycle` step drove and what the device said
|
|
1384
|
+
* about the app at each one. Produced by the android target, never by the game.
|
|
1385
|
+
*/
|
|
1386
|
+
deviceLifecycle?: IPlaytestDeviceLifecycleObservation;
|
|
1003
1387
|
/** Host-measured device thermal, power and battery state; produced by the android target. */
|
|
1004
1388
|
deviceMetrics?: IPlaytestDeviceMetricsObservation;
|
|
1005
1389
|
effectLog?: unknown;
|
|
@@ -1128,7 +1512,7 @@ interface IPlaytestFramebufferCoverageObservation {
|
|
|
1128
1512
|
windowStarted: boolean;
|
|
1129
1513
|
}
|
|
1130
1514
|
|
|
1131
|
-
type PlaytestDiagnosticCode = "TN_PLAYTEST_BRIDGE_INCOMPATIBLE" | "TN_PLAYTEST_BRIDGE_CAPABILITY_UNKNOWN" | "TN_PLAYTEST_BRIDGE_MISSING" | "TN_PLAYTEST_BRIDGE_NOT_READY" | "TN_PLAYTEST_CAPTURE_PROVENANCE_MISSING" | "TN_PLAYTEST_CAPABILITY_MISSING" | "TN_PLAYTEST_DEVICE_FAILED" | "TN_PLAYTEST_HOST_EXITED" | "TN_PLAYTEST_MAILBOX_POLL_STALLED" | "TN_PLAYTEST_OBSERVATION_UNAVAILABLE" | "TN_PLAYTEST_OPERATION_TIMEOUT" | "TN_PLAYTEST_PAGE_CRASHED" | "TN_PLAYTEST_PAGE_NAVIGATED" | "TN_PLAYTEST_PAYLOAD_TOO_LARGE" | "TN_PLAYTEST_SERVER_FAILED" | "TN_PLAYTEST_SETUP_UNAPPLIED" | "TN_PLAYTEST_STARTUP_ABORTED" | "TN_PLAYTEST_STARTUP_HOST_EXITED" | "TN_PLAYTEST_STARTUP_NOT_READY" | "TN_PLAYTEST_UNSUPPORTED_ON_TARGET";
|
|
1515
|
+
type PlaytestDiagnosticCode = "TN_PLAYTEST_ANDROID_LIFECYCLE_NOT_APPLIED" | "TN_PLAYTEST_ANDROID_LIFECYCLE_PHYSICS_UNOBSERVED" | "TN_PLAYTEST_ANDROID_LIFECYCLE_SESSION_CHANGED" | "TN_PLAYTEST_ANDROID_LIFECYCLE_UNOBSERVED" | "TN_PLAYTEST_BRIDGE_INCOMPATIBLE" | "TN_PLAYTEST_BRIDGE_CAPABILITY_UNKNOWN" | "TN_PLAYTEST_BRIDGE_MISSING" | "TN_PLAYTEST_BRIDGE_NOT_READY" | "TN_PLAYTEST_CAPTURE_PROVENANCE_MISSING" | "TN_PLAYTEST_CAPABILITY_MISSING" | "TN_PLAYTEST_DEVICE_FAILED" | "TN_PLAYTEST_HOST_EXITED" | "TN_PLAYTEST_MAILBOX_POLL_STALLED" | "TN_PLAYTEST_OBSERVATION_UNAVAILABLE" | "TN_PLAYTEST_OPERATION_TIMEOUT" | "TN_PLAYTEST_PAGE_CLOSED" | "TN_PLAYTEST_PAGE_CRASHED" | "TN_PLAYTEST_PAGE_NAVIGATED" | "TN_PLAYTEST_PAYLOAD_TOO_LARGE" | "TN_PLAYTEST_SERVER_FAILED" | "TN_PLAYTEST_SETUP_UNAPPLIED" | "TN_PLAYTEST_STARTUP_ABORTED" | "TN_PLAYTEST_STARTUP_HOST_EXITED" | "TN_PLAYTEST_STARTUP_NOT_READY" | "TN_PLAYTEST_UNSUPPORTED_ON_TARGET";
|
|
1132
1516
|
interface IPlaytestProtocolDiagnostic {
|
|
1133
1517
|
capability?: string;
|
|
1134
1518
|
code: PlaytestDiagnosticCode;
|
|
@@ -1144,4 +1528,4 @@ declare function playtestDiagnostic(code: PlaytestDiagnosticCode, message: strin
|
|
|
1144
1528
|
nextCommand?: string;
|
|
1145
1529
|
}): IPlaytestProtocolDiagnostic;
|
|
1146
1530
|
|
|
1147
|
-
export { type IPlaytestSetupRecord as A, type IPlaytestSignalAssertion as B, type IPlaytestStartupAssertion as C, DEVICE_METRICS_CADENCE_MS as D, type IPlaytestTrivialityOptOut as E, type IPlaytestVisualAssertion as F, type IPlaytestVisualElementRegion as G, HOT_START_TEMPERATURE_C as H, type IPlaytestStep as I, type IPlaytestVisualElementRegionObservation as J, type IPlaytestVisualRegion as K, type IPlaytestVisualRegionBounds as L, type IPlaytestVisualRegionTarget as M, type IPlaytestWheel as N, type IPlaytestWorldRuntimeAssertion as O, type PlaytestTarget as P, type PlaytestDeviceMeasurement as Q, type PlaytestDevicePowerRails as R, type PlaytestVec3 as S, parseDeviceBattery as T, parseDeviceCurrent as U, parseDevicePowerRails as V, parseDeviceThermal as W, playtestDiagnostic as X, resolveDiagnosticsPolicy as Y, summarizeDeviceMetrics as Z, type IPlaytestScenarioDiagnostic as a, type IPlaytestScenario as b, type IPlaytestReport as c, type IPlaytestAssertionResult as d, type IPlaytestDiagnostic as e, DEVICE_METRICS_MAX_SAMPLES as f, DeviceMetricsError as g, DeviceMetricsRecorder as h, type IPlaytestArtifactRequest as i, type IPlaytestCaptureProvenance as j, type IPlaytestDeviceBattery as k, type IPlaytestDeviceMetricsObservation as l, type IPlaytestDeviceMetricsSample as m, type IPlaytestDeviceMetricsVerdict as n, type IPlaytestDeviceThermal as o, type IPlaytestDiagnosticsPolicy as p, type IPlaytestFramebufferCoverageAssertion as q, type IPlaytestFramebufferCoverageObservation as r, type IPlaytestObservations as s, type IPlaytestPathAssertion as t, type IPlaytestPerformanceAssertion as u, type IPlaytestPointer as v, type IPlaytestProtocolDiagnostic as w, type IPlaytestRenderChainAssertion as x, type IPlaytestResourceWait as y, type IPlaytestSetupApplication as z };
|
|
1531
|
+
export { type IAndroidPointer as $, type IPlaytestSetupRecord as A, type IPlaytestSignalAssertion as B, type IPlaytestStartupAssertion as C, DEVICE_METRICS_CADENCE_MS as D, type IPlaytestTrivialityOptOut as E, type IPlaytestVisualAssertion as F, type IPlaytestVisualElementRegion as G, HOT_START_TEMPERATURE_C as H, type IPlaytestStep as I, type IPlaytestVisualElementRegionObservation as J, type IPlaytestVisualRegion as K, type IPlaytestVisualRegionBounds as L, type IPlaytestVisualRegionTarget as M, type IPlaytestWheel as N, type IPlaytestWorldRuntimeAssertion as O, type PlaytestTarget as P, type PlaytestDeviceMeasurement as Q, type PlaytestDevicePowerRails as R, type PlaytestVec3 as S, parseDeviceBattery as T, parseDeviceCurrent as U, parseDevicePowerRails as V, parseDeviceThermal as W, playtestDiagnostic as X, resolveDiagnosticsPolicy as Y, summarizeDeviceMetrics as Z, type IAndroidAppState as _, type IPlaytestScenarioDiagnostic as a, type IAndroidPointerInjection as a0, type IAndroidDriver as a1, AdbAndroidDriver as a2, type IAndroidDriverOptions as a3, type IAndroidLifecycleOperation as a4, type IAndroidTouchViewport as a5, type IPlaytestDeviceLifecycleObservation as a6, type IPlaytestDeviceLifecyclePhase as a7, type IPlaytestDeviceLifecyclePhysics as a8, type IPlaytestDeviceLifecycleSteps as a9, androidTouchBatches as aa, discoverAdb as ab, keyboardIsShown as ac, parseAndroidConsole as ad, parseAndroidTouchViewport as ae, rotatedTouchPosition as af, tapCommand as ag, touchPositionForViewport as ah, touchRotationFromWindowDump as ai, viewportPresentationCommands as aj, viewportPresentationObserved as ak, viewportRestoreCommands as al, type IPlaytestScenario as b, type IPlaytestReport as c, type IPlaytestAssertionResult as d, type IPlaytestDiagnostic as e, DEVICE_METRICS_MAX_SAMPLES as f, DeviceMetricsError as g, DeviceMetricsRecorder as h, type IPlaytestArtifactRequest as i, type IPlaytestCaptureProvenance as j, type IPlaytestDeviceBattery as k, type IPlaytestDeviceMetricsObservation as l, type IPlaytestDeviceMetricsSample as m, type IPlaytestDeviceMetricsVerdict as n, type IPlaytestDeviceThermal as o, type IPlaytestDiagnosticsPolicy as p, type IPlaytestFramebufferCoverageAssertion as q, type IPlaytestFramebufferCoverageObservation as r, type IPlaytestObservations as s, type IPlaytestPathAssertion as t, type IPlaytestPerformanceAssertion as u, type IPlaytestPointer as v, type IPlaytestProtocolDiagnostic as w, type IPlaytestRenderChainAssertion as x, type IPlaytestResourceWait as y, type IPlaytestSetupApplication as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as IPlaytestStep, a as IPlaytestScenarioDiagnostic, b as IPlaytestScenario, P as PlaytestTarget, c as IPlaytestReport, d as IPlaytestAssertionResult, e as IPlaytestDiagnostic } from './diagnostics-
|
|
2
|
-
export { D as DEVICE_METRICS_CADENCE_MS, f as DEVICE_METRICS_MAX_SAMPLES, g as DeviceMetricsError, h as DeviceMetricsRecorder, H as HOT_START_TEMPERATURE_C, i as IPlaytestArtifactRequest, j as IPlaytestCaptureProvenance, k as IPlaytestDeviceBattery, l as IPlaytestDeviceMetricsObservation, m as IPlaytestDeviceMetricsSample, n as IPlaytestDeviceMetricsVerdict, o as IPlaytestDeviceThermal, p as IPlaytestDiagnosticsPolicy, q as IPlaytestFramebufferCoverageAssertion, r as IPlaytestFramebufferCoverageObservation, s as IPlaytestObservations, t as IPlaytestPathAssertion, u as IPlaytestPerformanceAssertion, v as IPlaytestPointer, w as IPlaytestProtocolDiagnostic, x as IPlaytestRenderChainAssertion, y as IPlaytestResourceWait, z as IPlaytestSetupApplication, A as IPlaytestSetupRecord, B as IPlaytestSignalAssertion, C as IPlaytestStartupAssertion, E as IPlaytestTrivialityOptOut, F as IPlaytestVisualAssertion, G as IPlaytestVisualElementRegion, J as IPlaytestVisualElementRegionObservation, K as IPlaytestVisualRegion, L as IPlaytestVisualRegionBounds, M as IPlaytestVisualRegionTarget, N as IPlaytestWheel, O as IPlaytestWorldRuntimeAssertion, Q as PlaytestDeviceMeasurement, R as PlaytestDevicePowerRails, S as PlaytestVec3, T as parseDeviceBattery, U as parseDeviceCurrent, V as parseDevicePowerRails, W as parseDeviceThermal, X as playtestDiagnostic, Y as resolveDiagnosticsPolicy, Z as summarizeDeviceMetrics } from './diagnostics-
|
|
1
|
+
import { I as IPlaytestStep, a as IPlaytestScenarioDiagnostic, b as IPlaytestScenario, P as PlaytestTarget, c as IPlaytestReport, d as IPlaytestAssertionResult, e as IPlaytestDiagnostic } from './diagnostics-BXhYI2sc.js';
|
|
2
|
+
export { D as DEVICE_METRICS_CADENCE_MS, f as DEVICE_METRICS_MAX_SAMPLES, g as DeviceMetricsError, h as DeviceMetricsRecorder, H as HOT_START_TEMPERATURE_C, i as IPlaytestArtifactRequest, j as IPlaytestCaptureProvenance, k as IPlaytestDeviceBattery, l as IPlaytestDeviceMetricsObservation, m as IPlaytestDeviceMetricsSample, n as IPlaytestDeviceMetricsVerdict, o as IPlaytestDeviceThermal, p as IPlaytestDiagnosticsPolicy, q as IPlaytestFramebufferCoverageAssertion, r as IPlaytestFramebufferCoverageObservation, s as IPlaytestObservations, t as IPlaytestPathAssertion, u as IPlaytestPerformanceAssertion, v as IPlaytestPointer, w as IPlaytestProtocolDiagnostic, x as IPlaytestRenderChainAssertion, y as IPlaytestResourceWait, z as IPlaytestSetupApplication, A as IPlaytestSetupRecord, B as IPlaytestSignalAssertion, C as IPlaytestStartupAssertion, E as IPlaytestTrivialityOptOut, F as IPlaytestVisualAssertion, G as IPlaytestVisualElementRegion, J as IPlaytestVisualElementRegionObservation, K as IPlaytestVisualRegion, L as IPlaytestVisualRegionBounds, M as IPlaytestVisualRegionTarget, N as IPlaytestWheel, O as IPlaytestWorldRuntimeAssertion, Q as PlaytestDeviceMeasurement, R as PlaytestDevicePowerRails, S as PlaytestVec3, T as parseDeviceBattery, U as parseDeviceCurrent, V as parseDevicePowerRails, W as parseDeviceThermal, X as playtestDiagnostic, Y as resolveDiagnosticsPolicy, Z as summarizeDeviceMetrics } from './diagnostics-BXhYI2sc.js';
|
|
3
3
|
export { IPlaytestBridgeDescription, IPlaytestBridgeReady, IPlaytestBridgeV1, IPlaytestCameraObservation, IPlaytestContactObservation, IPlaytestDeviceRequest, IPlaytestDeviceResponse, IPlaytestFogObservation, IPlaytestFramePassSample, IPlaytestGameplayObservation, IPlaytestLightObservation, IPlaytestObservationSnapshot, IPlaytestPerformanceObservation, IPlaytestRenderChainObservation, IPlaytestRuntimeDiagnosticsSample, IPlaytestSampleRequest, IPlaytestSceneObservation, IPlaytestSetupConfirmation, IPlaytestSetupRequest, IPlaytestStartupObservation, IPlaytestStartupTimeline, IPlaytestStrideObservation, IPlaytestWorldObservation, IPlaytestWorldRuntimeObservation, JsonValue, PLAYTEST_ADVANCE_TICK_BUDGET_MS, PLAYTEST_BRIDGE_GLOBAL, PLAYTEST_FRAME_PASS_KINDS, PLAYTEST_FROZEN_MARKER, PLAYTEST_PROTOCOL_LIMITS, PLAYTEST_PROTOCOL_VERSION, PLAYTEST_STARTUP_COMPILE_BUDGET_MS, PLAYTEST_STARTUP_READY_TIMEOUT_MS, PlaytestFramePassKind, assertJsonSafe, jsonByteLength } from './protocol.js';
|
|
4
4
|
|
|
5
5
|
type PlaytestCapability = "browser.canvas" | "browser.console" | "browser.dom" | "browser.input" | "browser.network" | "browser.screenshot" | "browser.trace" | "camera.observe" | "device.metrics" | "entity.bounds" | "entity.observe" | "entity.setup" | "runtime.animation" | "runtime.audio" | "runtime.components" | "runtime.contacts" | "runtime.diagnostics" | "runtime.events" | "runtime.fixedStep" | "runtime.geometry" | "runtime.physics" | "runtime.performance" | "runtime.pipelineCensus" | "runtime.renderChain" | "runtime.resources" | "runtime.startup" | "runtime.state" | "runtime.tags" | "runtime.transitions" | "runtime.ui" | "runtime.world" | "scene.nodes" | "scene.observe";
|