@specter-automation/test 1.0.133 → 1.0.135
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.
|
@@ -195,6 +195,12 @@ export interface SpawnOptions {
|
|
|
195
195
|
properties?: Record<string, any>;
|
|
196
196
|
spawnController?: boolean;
|
|
197
197
|
name?: string;
|
|
198
|
+
/** If true, the actor will not be destroyed by ClearAllSpawned between tests. */
|
|
199
|
+
persistent?: boolean;
|
|
200
|
+
/** Alias for persistent: keeps the actor alive across tests within a worker. */
|
|
201
|
+
workerScope?: boolean;
|
|
202
|
+
/** Lifecycle scope for the spawned actor ('test' destroys after each test; 'worker' persists across tests). */
|
|
203
|
+
scope?: 'test' | 'worker';
|
|
198
204
|
}
|
|
199
205
|
export interface ClickOptions {
|
|
200
206
|
/**
|
|
@@ -375,7 +381,12 @@ export declare class SpecterWorld {
|
|
|
375
381
|
* @param seconds In-game simulation seconds to wait.
|
|
376
382
|
*/
|
|
377
383
|
waitForGameSeconds(seconds: number): Promise<void>;
|
|
378
|
-
|
|
384
|
+
/**
|
|
385
|
+
* Spawns an Actor in the active world by Blueprint name (e.g. `'BP_Hero_Steel'`),
|
|
386
|
+
* C++ class name (e.g. `'HotsHeroCharacter'`), or full asset path.
|
|
387
|
+
* Throws an error if multiple assets match the given short name.
|
|
388
|
+
*/
|
|
389
|
+
spawnActor<T extends RegisteredActorClasses | (string & {})>(classNameOrAssetPath: T, options?: SpawnOptions): Promise<ActorLocator<T>>;
|
|
379
390
|
actor<T extends RegisteredActorClasses | (string & {})>(selector: T): ActorLocator<T>;
|
|
380
391
|
actorByTag(tagName: string): ActorLocator;
|
|
381
392
|
/**
|
|
@@ -671,16 +671,25 @@ class SpecterWorld {
|
|
|
671
671
|
await new Promise(resolve => setTimeout(resolve, wallClockMs));
|
|
672
672
|
});
|
|
673
673
|
}
|
|
674
|
-
|
|
674
|
+
/**
|
|
675
|
+
* Spawns an Actor in the active world by Blueprint name (e.g. `'BP_Hero_Steel'`),
|
|
676
|
+
* C++ class name (e.g. `'HotsHeroCharacter'`), or full asset path.
|
|
677
|
+
* Throws an error if multiple assets match the given short name.
|
|
678
|
+
*/
|
|
679
|
+
async spawnActor(classNameOrAssetPath, options) {
|
|
675
680
|
// Generate a unique tag if the user didn't provide one
|
|
676
681
|
const uniqueId = crypto_1.default.randomBytes(4).toString('hex');
|
|
677
682
|
const tag = options?.tag || `Spawned_${uniqueId}`;
|
|
678
683
|
const location = options?.location || { x: 0, y: 0, z: 0 };
|
|
679
684
|
const rotation = options?.rotation || { pitch: 0, yaw: 0, roll: 0 };
|
|
685
|
+
const assetPath = String(classNameOrAssetPath);
|
|
680
686
|
const assetName = assetPath.split('/').pop()?.split('.')[0];
|
|
681
687
|
const properties = options?.properties;
|
|
682
688
|
const spawnController = options?.spawnController;
|
|
683
|
-
|
|
689
|
+
const persistent = options?.persistent;
|
|
690
|
+
const workerScope = options?.workerScope;
|
|
691
|
+
const scope = options?.scope;
|
|
692
|
+
await this.evaluate("SpawnActor", { assetPath, tag, location, rotation, properties, spawnController, persistent, workerScope, scope }, assetName, tag);
|
|
684
693
|
if (options?.name) {
|
|
685
694
|
return this.actorByTag(tag).named(options.name);
|
|
686
695
|
}
|