quake2ts 0.0.582 → 0.0.585
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/package.json +6 -4
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/render/__mocks__/frame.d.ts +31 -0
- package/packages/engine/dist/types/render/__mocks__/frame.d.ts.map +1 -0
- package/packages/test-utils/dist/index.cjs +404 -555
- package/packages/test-utils/dist/index.cjs.map +1 -1
- package/packages/test-utils/dist/index.d.cts +174 -109
- package/packages/test-utils/dist/index.d.ts +174 -109
- package/packages/test-utils/dist/index.js +389 -548
- package/packages/test-utils/dist/index.js.map +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as vitest from 'vitest';
|
|
2
2
|
import { Mock, vi } from 'vitest';
|
|
3
|
-
import { Vec3, CollisionPlane, CollisionBrush, CollisionNode, CollisionLeaf, CollisionModel, PlayerState, EntityState, createRandomGenerator, NetDriver, TraceResult, UserCommand } from '@quake2ts/shared';
|
|
3
|
+
import { Vec3, CollisionPlane, CollisionBrush, CollisionNode, CollisionLeaf, CollisionModel, PlayerState, EntityState, createRandomGenerator, NetDriver, TraceResult as TraceResult$1, UserCommand } from '@quake2ts/shared';
|
|
4
4
|
export { intersects, ladderTrace, stairTrace } from '@quake2ts/shared';
|
|
5
|
+
import { Vec3 as Vec3$1, Bounds3 } from '@quake2ts/shared/math/vec3';
|
|
5
6
|
import { GameStateSnapshot, Entity, ScriptHookRegistry, SpawnContext, EntitySystem, SpawnRegistry, MonsterMove, DamageMod, PlayerInventory, BaseItem, WeaponId, WeaponItem, HealthItem, ArmorItem, AmmoItemId, PowerupItem, GameExports } from '@quake2ts/game';
|
|
6
7
|
import { NetworkTransport, Server, ServerStatic, Client, ClientState, ClientFrame } from '@quake2ts/server';
|
|
7
8
|
import { ImageData } from '@napi-rs/canvas';
|
|
8
9
|
import { vec3 } from 'gl-matrix';
|
|
9
10
|
import { Camera } from '@quake2ts/engine';
|
|
10
|
-
import {
|
|
11
|
-
import { Server as Server$1 } from 'http';
|
|
11
|
+
import { TraceResult, CollisionPlane as CollisionPlane$1 } from '@quake2ts/shared/bsp/collision';
|
|
12
12
|
|
|
13
13
|
interface BinaryWriterMock {
|
|
14
14
|
writeByte: Mock<[number], void>;
|
|
@@ -26,6 +26,8 @@ interface BinaryWriterMock {
|
|
|
26
26
|
writeUint32: Mock<[number], void>;
|
|
27
27
|
writeFloat: Mock<[number], void>;
|
|
28
28
|
getData: Mock<[], Uint8Array>;
|
|
29
|
+
writePos: Mock<[any], void>;
|
|
30
|
+
writeDir: Mock<[any], void>;
|
|
29
31
|
}
|
|
30
32
|
declare const createBinaryWriterMock: () => BinaryWriterMock;
|
|
31
33
|
declare const createNetChanMock: () => {
|
|
@@ -87,6 +89,24 @@ interface BinaryStreamMock {
|
|
|
87
89
|
readDir: Mock<[], any>;
|
|
88
90
|
}
|
|
89
91
|
declare const createBinaryStreamMock: () => BinaryStreamMock;
|
|
92
|
+
interface MessageWriterMock extends BinaryWriterMock {
|
|
93
|
+
writeInt: Mock<[number], void>;
|
|
94
|
+
writeVector: Mock<[any], void>;
|
|
95
|
+
}
|
|
96
|
+
declare const createMessageWriterMock: (overrides?: Partial<MessageWriterMock>) => MessageWriterMock;
|
|
97
|
+
interface MessageReaderMock extends BinaryStreamMock {
|
|
98
|
+
readInt: Mock<[], number>;
|
|
99
|
+
readVector: Mock<[], any>;
|
|
100
|
+
}
|
|
101
|
+
declare const createMessageReaderMock: (data?: Uint8Array) => MessageReaderMock;
|
|
102
|
+
interface PacketMock {
|
|
103
|
+
type: 'connection' | 'data' | 'ack' | 'disconnect';
|
|
104
|
+
sequence: number;
|
|
105
|
+
ack: number;
|
|
106
|
+
qport: number;
|
|
107
|
+
data: Uint8Array;
|
|
108
|
+
}
|
|
109
|
+
declare const createPacketMock: (overrides?: Partial<PacketMock>) => PacketMock;
|
|
90
110
|
|
|
91
111
|
declare function makePlane(normal: Vec3, dist: number): CollisionPlane;
|
|
92
112
|
declare function makeAxisBrush(size: number, contents?: number): CollisionBrush;
|
|
@@ -96,6 +116,16 @@ declare function makeLeaf(contents: number, firstLeafBrush: number, numLeafBrush
|
|
|
96
116
|
declare function makeLeafModel(brushes: CollisionBrush[]): CollisionModel;
|
|
97
117
|
declare function makeBrushFromMinsMaxs(mins: Vec3, maxs: Vec3, contents?: number): CollisionBrush;
|
|
98
118
|
|
|
119
|
+
declare const createVector3: (x?: number, y?: number, z?: number) => Vec3$1;
|
|
120
|
+
declare const createBounds: (mins?: Vec3$1, maxs?: Vec3$1) => Bounds3;
|
|
121
|
+
interface Transform {
|
|
122
|
+
position: Vec3$1;
|
|
123
|
+
rotation: Vec3$1;
|
|
124
|
+
scale: Vec3$1;
|
|
125
|
+
}
|
|
126
|
+
declare const createTransform: (overrides?: Partial<Transform>) => Transform;
|
|
127
|
+
declare const randomVector3: (min?: number, max?: number) => Vec3$1;
|
|
128
|
+
|
|
99
129
|
declare const createPlayerStateFactory: (overrides?: Partial<PlayerState>) => PlayerState;
|
|
100
130
|
declare const createEntityStateFactory: (overrides?: Partial<EntityState>) => EntityState;
|
|
101
131
|
declare const createGameStateSnapshotFactory: (overrides?: Partial<GameStateSnapshot>) => GameStateSnapshot;
|
|
@@ -106,6 +136,28 @@ declare function createItemEntityFactory(classname: string, overrides?: Partial<
|
|
|
106
136
|
declare function createProjectileEntityFactory(classname: string, overrides?: Partial<Entity>): Entity;
|
|
107
137
|
declare function createTriggerEntityFactory(classname: string, overrides?: Partial<Entity>): Entity;
|
|
108
138
|
|
|
139
|
+
interface TraceMock extends Partial<TraceResult> {
|
|
140
|
+
fraction: number;
|
|
141
|
+
endpos: Vec3$1;
|
|
142
|
+
plane: CollisionPlane$1;
|
|
143
|
+
surface: {
|
|
144
|
+
flags: number;
|
|
145
|
+
name?: string;
|
|
146
|
+
value?: number;
|
|
147
|
+
};
|
|
148
|
+
contents: number;
|
|
149
|
+
ent: any;
|
|
150
|
+
allsolid: boolean;
|
|
151
|
+
startsolid: boolean;
|
|
152
|
+
}
|
|
153
|
+
declare const createTraceMock: (overrides?: Partial<TraceMock>) => TraceMock;
|
|
154
|
+
interface SurfaceMock {
|
|
155
|
+
flags: number;
|
|
156
|
+
name: string;
|
|
157
|
+
value: number;
|
|
158
|
+
}
|
|
159
|
+
declare const createSurfaceMock: (overrides?: Partial<SurfaceMock>) => SurfaceMock;
|
|
160
|
+
|
|
109
161
|
interface MockEngine {
|
|
110
162
|
sound: Mock<[Entity, number, string, number, number, number], void>;
|
|
111
163
|
soundIndex: Mock<[string], number>;
|
|
@@ -529,7 +581,7 @@ declare function simulateServerRegistration(server: any, master: MasterServer):
|
|
|
529
581
|
* Mock interface for CollisionEntityIndex.
|
|
530
582
|
*/
|
|
531
583
|
interface MockCollisionEntityIndex {
|
|
532
|
-
trace: (start: any, mins: any, maxs: any, end: any, passEntity: any, contentMask: number) => TraceResult;
|
|
584
|
+
trace: (start: any, mins: any, maxs: any, end: any, passEntity: any, contentMask: number) => TraceResult$1;
|
|
533
585
|
link: (entity: any) => void;
|
|
534
586
|
unlink: (entity: any) => void;
|
|
535
587
|
gatherTriggerTouches: (entity: any) => any[];
|
|
@@ -678,21 +730,24 @@ declare function setupBrowserEnvironment(options?: BrowserSetupOptions): void;
|
|
|
678
730
|
*/
|
|
679
731
|
declare function teardownBrowserEnvironment(): void;
|
|
680
732
|
|
|
681
|
-
interface DrawCall {
|
|
682
|
-
method: string;
|
|
683
|
-
args: any[];
|
|
684
|
-
}
|
|
685
733
|
/**
|
|
686
|
-
* Creates a mock
|
|
734
|
+
* Creates a mock HTMLCanvasElement backed by napi-rs/canvas,
|
|
735
|
+
* with support for both 2D and WebGL2 contexts.
|
|
687
736
|
*/
|
|
688
737
|
declare function createMockCanvas(width?: number, height?: number): HTMLCanvasElement;
|
|
689
738
|
/**
|
|
690
|
-
* Creates a mock
|
|
739
|
+
* Creates a mock CanvasRenderingContext2D.
|
|
691
740
|
*/
|
|
692
741
|
declare function createMockCanvasContext2D(canvas?: HTMLCanvasElement): CanvasRenderingContext2D;
|
|
693
742
|
/**
|
|
694
|
-
*
|
|
695
|
-
|
|
743
|
+
* Information about a captured draw call.
|
|
744
|
+
*/
|
|
745
|
+
interface DrawCall {
|
|
746
|
+
method: string;
|
|
747
|
+
args: any[];
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Wraps a CanvasRenderingContext2D to capture all method calls.
|
|
696
751
|
*/
|
|
697
752
|
declare function captureCanvasDrawCalls(context: CanvasRenderingContext2D): DrawCall[];
|
|
698
753
|
/**
|
|
@@ -700,7 +755,7 @@ declare function captureCanvasDrawCalls(context: CanvasRenderingContext2D): Draw
|
|
|
700
755
|
*/
|
|
701
756
|
declare function createMockImageData(width: number, height: number, fillColor?: [number, number, number, number]): ImageData;
|
|
702
757
|
/**
|
|
703
|
-
* Creates a mock
|
|
758
|
+
* Creates a mock HTMLImageElement.
|
|
704
759
|
*/
|
|
705
760
|
declare function createMockImage(width?: number, height?: number, src?: string): HTMLImageElement;
|
|
706
761
|
|
|
@@ -709,54 +764,76 @@ declare function createMockGPUDevice(): Partial<GPUDevice>;
|
|
|
709
764
|
declare function createMockGPUCanvasContext(): Partial<GPUCanvasContext>;
|
|
710
765
|
declare function setupWebGPUMocks(): void;
|
|
711
766
|
|
|
767
|
+
/**
|
|
768
|
+
* Interface for the mock RequestAnimationFrame implementation.
|
|
769
|
+
*/
|
|
712
770
|
interface MockRAF {
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
771
|
+
/**
|
|
772
|
+
* Advances time by one tick (simulating one frame).
|
|
773
|
+
* @param time Timestamp to pass to callbacks (default: calls Date.now())
|
|
774
|
+
*/
|
|
775
|
+
tick(time?: number): void;
|
|
776
|
+
/**
|
|
777
|
+
* Advances time by a specific amount, triggering multiple frames if necessary.
|
|
778
|
+
* Not fully implemented in simple version, acts as alias to tick() with specific time.
|
|
779
|
+
*/
|
|
780
|
+
advance(ms: number): void;
|
|
781
|
+
/**
|
|
782
|
+
* Returns current pending callbacks.
|
|
783
|
+
*/
|
|
784
|
+
getCallbacks(): Array<{
|
|
785
|
+
id: number;
|
|
786
|
+
callback: FrameRequestCallback;
|
|
787
|
+
}>;
|
|
719
788
|
}
|
|
720
789
|
/**
|
|
721
|
-
* Creates a mock implementation
|
|
722
|
-
*
|
|
790
|
+
* Creates a mock RequestAnimationFrame implementation.
|
|
791
|
+
* Replaces global.requestAnimationFrame and cancelAnimationFrame.
|
|
723
792
|
*/
|
|
724
793
|
declare function createMockRAF(): MockRAF;
|
|
725
794
|
/**
|
|
726
|
-
* Creates a mock Performance object
|
|
795
|
+
* Creates a mock Performance object.
|
|
727
796
|
*/
|
|
728
797
|
declare function createMockPerformance(startTime?: number): Performance;
|
|
729
798
|
interface ControlledTimer {
|
|
730
|
-
|
|
799
|
+
/**
|
|
800
|
+
* Advances virtual time by ms.
|
|
801
|
+
*/
|
|
731
802
|
advanceBy(ms: number): void;
|
|
803
|
+
/**
|
|
804
|
+
* Runs all pending timers.
|
|
805
|
+
*/
|
|
806
|
+
runAll(): void;
|
|
807
|
+
/**
|
|
808
|
+
* Restores original timer functions.
|
|
809
|
+
*/
|
|
732
810
|
clear(): void;
|
|
733
|
-
restore(): void;
|
|
734
811
|
}
|
|
735
812
|
/**
|
|
736
|
-
* Creates
|
|
737
|
-
*
|
|
813
|
+
* Creates controlled timers (setTimeout/setInterval).
|
|
814
|
+
* Note: Use verify's useFakeTimers() for better integration with test runner.
|
|
815
|
+
* This is a lightweight alternative or specific helper.
|
|
738
816
|
*/
|
|
739
817
|
declare function createControlledTimer(): ControlledTimer;
|
|
740
818
|
/**
|
|
741
|
-
*
|
|
742
|
-
* @param count Number of frames to simulate
|
|
743
|
-
* @param frameTimeMs Time per frame in milliseconds
|
|
744
|
-
* @param callback Optional callback to run inside the loop (e.g. triggering inputs)
|
|
819
|
+
* Simulates multiple RAF frames.
|
|
745
820
|
*/
|
|
746
|
-
declare function simulateFrames(count: number,
|
|
821
|
+
declare function simulateFrames(count: number, frameTime?: number, callback?: (frameIndex: number) => void): void;
|
|
822
|
+
|
|
747
823
|
/**
|
|
748
|
-
*
|
|
824
|
+
* Setup helpers for Node.js environments.
|
|
749
825
|
*/
|
|
750
|
-
declare function simulateFramesWithMock(mock: MockRAF, count: number, frameTimeMs?: number, callback?: (frameIndex: number) => void): void;
|
|
751
|
-
|
|
752
826
|
interface NodeSetupOptions {
|
|
753
|
-
polyfillFetch?: boolean;
|
|
754
827
|
}
|
|
755
828
|
/**
|
|
756
829
|
* Sets up a Node.js environment for testing.
|
|
757
|
-
*
|
|
830
|
+
* Currently a placeholder for future Node-specific setup.
|
|
758
831
|
*/
|
|
759
832
|
declare function setupNodeEnvironment(options?: NodeSetupOptions): void;
|
|
833
|
+
/**
|
|
834
|
+
* Teardown for Node.js environment.
|
|
835
|
+
*/
|
|
836
|
+
declare function teardownNodeEnvironment(): void;
|
|
760
837
|
|
|
761
838
|
interface ShaderRecord {
|
|
762
839
|
readonly id: number;
|
|
@@ -939,46 +1016,47 @@ interface MockRenderingContext {
|
|
|
939
1016
|
declare function createMockRenderingContext(): MockRenderingContext;
|
|
940
1017
|
|
|
941
1018
|
/**
|
|
942
|
-
* Creates a mock
|
|
1019
|
+
* Creates a mock LocalStorage instance.
|
|
943
1020
|
*/
|
|
944
1021
|
declare function createMockLocalStorage(initialData?: Record<string, string>): Storage;
|
|
945
1022
|
/**
|
|
946
|
-
* Creates a mock SessionStorage
|
|
947
|
-
* Functionally identical to LocalStorage mock but distinct for testing isolation.
|
|
1023
|
+
* Creates a mock SessionStorage instance.
|
|
948
1024
|
*/
|
|
949
1025
|
declare function createMockSessionStorage(initialData?: Record<string, string>): Storage;
|
|
950
1026
|
/**
|
|
951
1027
|
* Creates a mock IndexedDB factory.
|
|
952
|
-
*
|
|
953
|
-
* This helper ensures the global is available or resets it.
|
|
1028
|
+
* Wraps fake-indexeddb.
|
|
954
1029
|
*/
|
|
955
|
-
declare function createMockIndexedDB(): IDBFactory;
|
|
1030
|
+
declare function createMockIndexedDB(databases?: IDBDatabase[]): IDBFactory;
|
|
956
1031
|
interface StorageScenario {
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1032
|
+
localStorage: Storage;
|
|
1033
|
+
sessionStorage: Storage;
|
|
1034
|
+
indexedDB: IDBFactory;
|
|
960
1035
|
}
|
|
961
1036
|
/**
|
|
962
|
-
*
|
|
1037
|
+
* Creates a complete storage test scenario.
|
|
963
1038
|
*/
|
|
964
1039
|
declare function createStorageTestScenario(storageType?: 'local' | 'session' | 'indexed'): StorageScenario;
|
|
965
1040
|
|
|
966
|
-
declare function createMockAudioContext(): AudioContext;
|
|
967
1041
|
/**
|
|
968
|
-
*
|
|
1042
|
+
* Mocks for Web Audio API.
|
|
1043
|
+
*/
|
|
1044
|
+
/**
|
|
1045
|
+
* Sets up a mock AudioContext globally.
|
|
969
1046
|
*/
|
|
970
1047
|
declare function setupMockAudioContext(): void;
|
|
971
1048
|
/**
|
|
972
|
-
* Restores
|
|
1049
|
+
* Restores original AudioContext.
|
|
973
1050
|
*/
|
|
974
1051
|
declare function teardownMockAudioContext(): void;
|
|
975
1052
|
interface AudioEvent {
|
|
976
1053
|
type: string;
|
|
977
|
-
|
|
1054
|
+
data?: any;
|
|
978
1055
|
}
|
|
979
1056
|
/**
|
|
980
|
-
* Captures audio
|
|
981
|
-
*
|
|
1057
|
+
* Captures audio events from a context.
|
|
1058
|
+
* Requires the context to be instrumented or mocked to emit events.
|
|
1059
|
+
* This helper currently works with the `setupMockAudioContext` mock if extended.
|
|
982
1060
|
*/
|
|
983
1061
|
declare function captureAudioEvents(context: AudioContext): AudioEvent[];
|
|
984
1062
|
|
|
@@ -1102,93 +1180,80 @@ declare function createViewTestScenario(scenarioType: 'firstPerson' | 'thirdPers
|
|
|
1102
1180
|
*/
|
|
1103
1181
|
declare function simulateCameraMovement(camera: Camera, input: CameraInput, deltaTime: number): Camera;
|
|
1104
1182
|
|
|
1105
|
-
/**
|
|
1106
|
-
* Interface for Test Client options
|
|
1107
|
-
*/
|
|
1108
1183
|
interface PlaywrightOptions {
|
|
1109
1184
|
headless?: boolean;
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
rootPath?: string;
|
|
1115
|
-
launchOptions?: LaunchOptions;
|
|
1116
|
-
contextOptions?: BrowserContextOptions;
|
|
1185
|
+
viewport?: {
|
|
1186
|
+
width: number;
|
|
1187
|
+
height: number;
|
|
1188
|
+
};
|
|
1117
1189
|
}
|
|
1118
1190
|
interface PlaywrightTestClient {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
injectInput: (type: string, data: any) => Promise<void>;
|
|
1191
|
+
page: any;
|
|
1192
|
+
browser: any;
|
|
1193
|
+
navigate(url: string): Promise<void>;
|
|
1194
|
+
waitForGame(): Promise<void>;
|
|
1195
|
+
injectInput(type: string, data: any): Promise<void>;
|
|
1196
|
+
screenshot(name: string): Promise<Buffer>;
|
|
1197
|
+
close(): Promise<void>;
|
|
1127
1198
|
}
|
|
1128
1199
|
/**
|
|
1129
|
-
* Creates a Playwright
|
|
1130
|
-
*
|
|
1200
|
+
* Creates a Playwright test client.
|
|
1201
|
+
* Note: Requires playwright to be installed in the project.
|
|
1131
1202
|
*/
|
|
1132
1203
|
declare function createPlaywrightTestClient(options?: PlaywrightOptions): Promise<PlaywrightTestClient>;
|
|
1133
|
-
|
|
1204
|
+
/**
|
|
1205
|
+
* Waits for the game to be ready.
|
|
1206
|
+
*/
|
|
1207
|
+
declare function waitForGameReady(page: any, timeout?: number): Promise<void>;
|
|
1134
1208
|
interface GameStateCapture {
|
|
1135
|
-
|
|
1209
|
+
time: number;
|
|
1210
|
+
entities: number;
|
|
1136
1211
|
}
|
|
1137
|
-
|
|
1212
|
+
/**
|
|
1213
|
+
* Captures current game state from the browser.
|
|
1214
|
+
*/
|
|
1215
|
+
declare function captureGameState(page: any): Promise<GameStateCapture>;
|
|
1138
1216
|
|
|
1217
|
+
type NetworkCondition = 'good' | 'slow' | 'unstable' | 'offline' | 'custom';
|
|
1139
1218
|
interface NetworkSimulator {
|
|
1140
|
-
apply(page: any): Promise<void>;
|
|
1141
|
-
clear(page: any): Promise<void>;
|
|
1142
|
-
}
|
|
1143
|
-
type NetworkCondition = 'good' | 'slow' | 'unstable' | 'offline';
|
|
1144
|
-
interface NetworkConfig {
|
|
1145
|
-
offline: boolean;
|
|
1146
|
-
downloadThroughput: number;
|
|
1147
|
-
uploadThroughput: number;
|
|
1148
1219
|
latency: number;
|
|
1220
|
+
jitter: number;
|
|
1221
|
+
packetLoss: number;
|
|
1222
|
+
bandwidth: number;
|
|
1149
1223
|
}
|
|
1150
1224
|
/**
|
|
1151
|
-
* Simulates network conditions
|
|
1225
|
+
* Simulates network conditions.
|
|
1152
1226
|
*/
|
|
1153
1227
|
declare function simulateNetworkCondition(condition: NetworkCondition): NetworkSimulator;
|
|
1154
1228
|
/**
|
|
1155
|
-
* Creates a custom network condition
|
|
1156
|
-
*
|
|
1157
|
-
* @param latency Latency in milliseconds
|
|
1158
|
-
* @param jitter Approximate jitter (variation in latency) - Note: CDP doesn't support jitter natively.
|
|
1159
|
-
* @param packetLoss Packet loss percentage (0-100) - Ignored for basic CDP emulation.
|
|
1229
|
+
* Creates a custom network condition.
|
|
1160
1230
|
*/
|
|
1161
|
-
declare function createCustomNetworkCondition(latency: number, jitter
|
|
1231
|
+
declare function createCustomNetworkCondition(latency: number, jitter: number, packetLoss: number): NetworkSimulator;
|
|
1162
1232
|
/**
|
|
1163
|
-
*
|
|
1233
|
+
* Helper to throttle bandwidth (e.g. for Playwright).
|
|
1164
1234
|
*/
|
|
1165
|
-
declare function throttleBandwidth(
|
|
1235
|
+
declare function throttleBandwidth(bytesPerSecond: number): void;
|
|
1166
1236
|
|
|
1167
1237
|
interface VisualDiff {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
matched: boolean;
|
|
1238
|
+
diffPercentage: number;
|
|
1239
|
+
diffImage?: Buffer;
|
|
1171
1240
|
}
|
|
1172
1241
|
/**
|
|
1173
|
-
* Captures a screenshot of the
|
|
1242
|
+
* Captures a screenshot of the game.
|
|
1174
1243
|
*/
|
|
1175
|
-
declare function captureGameScreenshot(page:
|
|
1176
|
-
dir?: string;
|
|
1177
|
-
fullPage?: boolean;
|
|
1178
|
-
}): Promise<Buffer>;
|
|
1244
|
+
declare function captureGameScreenshot(page: any, name: string): Promise<Buffer>;
|
|
1179
1245
|
/**
|
|
1180
|
-
* Compares two
|
|
1181
|
-
*
|
|
1182
|
-
* For now, we provide a basic placeholder or rely on simple buffer comparison.
|
|
1246
|
+
* Compares two screenshots (Buffers).
|
|
1247
|
+
* Uses a pixel comparison library if available, or simple buffer check.
|
|
1183
1248
|
*/
|
|
1184
|
-
declare function compareScreenshots(baseline: Buffer, current: Buffer, threshold?: number):
|
|
1249
|
+
declare function compareScreenshots(baseline: Buffer, current: Buffer, threshold?: number): VisualDiff;
|
|
1185
1250
|
interface VisualScenario {
|
|
1186
|
-
|
|
1187
|
-
|
|
1251
|
+
sceneName: string;
|
|
1252
|
+
setup: () => Promise<void>;
|
|
1188
1253
|
}
|
|
1189
1254
|
/**
|
|
1190
|
-
* Creates a
|
|
1255
|
+
* Creates a visual test scenario.
|
|
1191
1256
|
*/
|
|
1192
|
-
declare function createVisualTestScenario(
|
|
1257
|
+
declare function createVisualTestScenario(sceneName: string): VisualScenario;
|
|
1193
1258
|
|
|
1194
|
-
export { type AudioEvent, type BandwidthScenario, type BinaryStreamMock, type BinaryWriterMock, type BrowserSetupOptions, type CameraInput, type Connection, type ConsistencyReport, type ControlledTimer, type DeltaSnapshot, type DrawCall, type GameState, type GameStateCapture, type Handshake, HandshakeStage, InputInjector, type KeyModifiers, type MasterServer, type Message, type MockAI, type MockCollisionEntityIndex, type MockDamageInfo, type MockEngine, type MockGame, type MockMonsterAI, MockPointerLock, type MockRAF, type MockRConClient, type MockRenderingContext, type MockServer, type MockServerConsole, type MockServerContext, MockTransport, type MockUDPSocket, MockWebGL2RenderingContext, type MultiplayerScenario, type NetworkAddress, type NetworkCondition, type
|
|
1259
|
+
export { type AudioEvent, type BandwidthScenario, type BinaryStreamMock, type BinaryWriterMock, type BrowserSetupOptions, type CameraInput, type Connection, type ConsistencyReport, type ControlledTimer, type DeltaSnapshot, type DrawCall, type GameState, type GameStateCapture, type Handshake, HandshakeStage, InputInjector, type KeyModifiers, type MasterServer, type Message, type MessageReaderMock, type MessageWriterMock, type MockAI, type MockCollisionEntityIndex, type MockDamageInfo, type MockEngine, type MockGame, type MockMonsterAI, MockPointerLock, type MockRAF, type MockRConClient, type MockRenderingContext, type MockServer, type MockServerConsole, type MockServerContext, MockTransport, type MockUDPSocket, MockWebGL2RenderingContext, type MultiplayerScenario, type NetworkAddress, type NetworkCondition, type NetworkSimulator, type NodeSetupOptions, type PacketMock, type PlaywrightOptions, type PlaywrightTestClient, type RateLimiter, type RefDef, type ServerInfo, type ServerListFilter, type Snapshot, type StorageScenario, type TestContext, type Transform, type UserInfo, type ViewScenario, type ViewState, type VisualDiff, type VisualScenario, captureAudioEvents, captureCanvasDrawCalls, captureGameScreenshot, captureGameState, compareScreenshots, createBandwidthTestScenario, createBinaryStreamMock, createBinaryWriterMock, createBounds, createCombatTestContext, createControlledTimer, createCustomNetworkCondition, createDeltaSnapshot, createEntity, createEntityFactory, createEntityStateFactory, createGameStateSnapshotFactory, createInputInjector, createItemEntityFactory, createMessageReaderMock, createMessageWriterMock, createMockAI, createMockAmmoItem, createMockArmorItem, createMockCamera, createMockCanvas, createMockCanvasContext2D, createMockCollisionEntityIndex, createMockConnection, createMockDamageInfo, createMockEngine, createMockGPUAdapter, createMockGPUCanvasContext, createMockGPUDevice, createMockGame, createMockGameExports, createMockGameState, createMockHandshake, createMockHealthItem, createMockImage, createMockImageData, createMockIndexedDB, createMockInventory, createMockItem, createMockKeyboardEvent, createMockLocalStorage, createMockMasterServer, createMockMonsterAI, createMockMonsterMove, createMockMouseEvent, createMockNetDriver, createMockNetworkAddress, createMockPerformance, createMockPointerLock, createMockPowerupItem, createMockRAF, createMockRConClient, createMockRateLimiter, createMockRefDef, createMockRenderingContext, createMockServer, createMockServerClient, createMockServerConsole, createMockServerInfo, createMockServerState, createMockServerStatic, createMockSessionStorage, createMockTransport, createMockUDPSocket, createMockUserInfo, createMockViewState, createMockWeapon, createMockWeaponItem, createMockWebGL2Context, createMockWheelEvent, createMonsterEntityFactory, createMultiplayerTestScenario, createNetChanMock, createPacketMock, createPhysicsTestContext, createPlayerEntityFactory, createPlayerStateFactory, createPlaywrightTestClient, createProjectileEntityFactory, createServerSnapshot, createSpawnTestContext, createStorageTestScenario, createSurfaceMock, createTestContext, createTraceMock, createTransform, createTriggerEntityFactory, createVector3, createViewTestScenario, createVisualTestScenario, makeAxisBrush, makeBrushFromMinsMaxs, makeBspModel, makeLeaf, makeLeafModel, makeNode, makePlane, measureSnapshotSize, mockMonsterAttacks, randomVector3, serializeUserInfo, setupBrowserEnvironment, setupMockAudioContext, setupNodeEnvironment, setupWebGPUMocks, simulateBandwidthLimit, simulateCameraMovement, simulateFrames, simulateHandshake, simulateNetworkCondition, simulatePlayerInput, simulatePlayerJoin, simulatePlayerLeave, simulateServerCommand, simulateServerRegistration, simulateServerTick, simulateSnapshotDelivery, teardownBrowserEnvironment, teardownMockAudioContext, teardownNodeEnvironment, throttleBandwidth, verifySnapshotConsistency, waitForGameReady };
|