@specter-automation/test 1.0.115 → 1.0.116

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.
@@ -1,6 +1,6 @@
1
1
  import { ComponentLocatorMap } from "../component-registry";
2
2
  import { SpecterLocator } from "../locators/specter-locator";
3
- import { Rotator, Transform, Vector3, RegisteredComponentClasses, RegisteredWidgetClasses, SpecterWorld } from "../specter-client";
3
+ import { Rotator, Transform, Vector3, RegisteredComponentClasses, RegisteredWidgetClasses, SpecterWorld, SpecterGrantedAbility, SpecterActiveEffect, RegisteredGameplayTags } from "../specter-client";
4
4
  import { WidgetLocator, WidgetRole, WidgetRoleOptions } from "./widget-locator";
5
5
  import { UnrealKey } from "../specter-keys";
6
6
  import { ActorEventMap, EventPredicate, WaitForEventOptions } from "../events";
@@ -154,11 +154,11 @@ export declare class ActorLocator<T = any> extends SpecterLocator<T> {
154
154
  */
155
155
  unpossess(): Promise<void>;
156
156
  getAttributeValue(attributeSet: string, attributeName: string): Promise<number>;
157
- hasGameplayTag(tag: string): Promise<boolean>;
157
+ hasGameplayTag(tag: RegisteredGameplayTags): Promise<boolean>;
158
158
  /**
159
159
  * Waits for a Gameplay Tag to be added or removed.
160
160
  */
161
- waitForGameplayTag(tag: string, expectedState: boolean, timeout?: number): Promise<boolean>;
161
+ waitForGameplayTag(tag: RegisteredGameplayTags, expectedState: boolean, timeout?: number): Promise<boolean>;
162
162
  /**
163
163
  * Waits for a Gameplay Attribute to reach a specific value, tracking its history.
164
164
  */
@@ -357,7 +357,7 @@ export declare class ActorLocator<T = any> extends SpecterLocator<T> {
357
357
  * @param delayMs Optional delay between keystrokes in milliseconds.
358
358
  */
359
359
  type(text: string, delayMs?: number): Promise<void>;
360
- triggerAbilityByTag(inputTag: string): Promise<void>;
360
+ triggerAbilityByTag(inputTag: RegisteredGameplayTags): Promise<void>;
361
361
  /**
362
362
  * Simulates an ability input press or release on this actor's ASC.
363
363
  * Use this to interact with active abilities that use WaitInputPress/WaitInputRelease
@@ -366,24 +366,32 @@ export declare class ActorLocator<T = any> extends SpecterLocator<T> {
366
366
  * @param abilityTag - The gameplay tag of the ability (e.g. "Ability.Slot.D")
367
367
  * @param pressed - true to simulate press, false to simulate release. Defaults to true.
368
368
  */
369
- pressAbilityInput(abilityTag: string, pressed?: boolean): Promise<void>;
370
- triggerAbilityWithTarget(abilityTag: string, target: SpecterLocator | Vector3, options?: {
369
+ pressAbilityInput(abilityTag: RegisteredGameplayTags, pressed?: boolean): Promise<void>;
370
+ triggerAbilityWithTarget(abilityTag: RegisteredGameplayTags, target: SpecterLocator | Vector3, options?: {
371
371
  singleShot?: boolean;
372
372
  magnitude?: number;
373
373
  }): Promise<void>;
374
374
  applyGameplayEffect(effectClassPath: string, level?: number): Promise<void>;
375
375
  hasActiveGameplayEffect(effectClassPath: string): Promise<boolean>;
376
376
  hasGameplayEffect(effectClassPath: string): Promise<boolean>;
377
+ /**
378
+ * Retrieves all granted abilities on this actor's Ability System Component.
379
+ */
380
+ getGrantedAbilities(): Promise<SpecterGrantedAbility[]>;
381
+ /**
382
+ * Retrieves all active gameplay effects currently applied to this actor's Ability System Component.
383
+ */
384
+ getActiveEffects(): Promise<SpecterActiveEffect[]>;
377
385
  hasGameplayAbility(abilityClassPath: string): Promise<boolean>;
378
386
  getAbilityCooldown(abilityClassPath: string): Promise<number>;
379
387
  getGameplayEffectStackCount(effectClassPath: string): Promise<number>;
380
388
  getGameplayEffectLevel(effectClassPath: string): Promise<number>;
381
389
  getAttributeBaseValue(attributeSet: string, attributeName: string): Promise<number>;
382
390
  isAbilityExecuting(abilityOrClassPath: string): Promise<boolean>;
383
- cancelAbility(abilityOrTagOrClassPath: string): Promise<void>;
384
- getGameplayTagCount(tag: string): Promise<number>;
385
- hasAnyGameplayTags(tags: string[]): Promise<boolean>;
386
- hasAllGameplayTags(tags: string[]): Promise<boolean>;
391
+ cancelAbility(abilityOrTagOrClassPath: RegisteredGameplayTags): Promise<void>;
392
+ getGameplayTagCount(tag: RegisteredGameplayTags): Promise<number>;
393
+ hasAnyGameplayTags(tags: RegisteredGameplayTags[]): Promise<boolean>;
394
+ hasAllGameplayTags(tags: RegisteredGameplayTags[]): Promise<boolean>;
387
395
  getVelocitySize(): Promise<number>;
388
396
  isFalling(): Promise<boolean>;
389
397
  isCrouching(): Promise<boolean>;
@@ -940,6 +940,20 @@ class ActorLocator extends specter_locator_1.SpecterLocator {
940
940
  async hasGameplayEffect(effectClassPath) {
941
941
  return this.hasActiveGameplayEffect(effectClassPath);
942
942
  }
943
+ /**
944
+ * Retrieves all granted abilities on this actor's Ability System Component.
945
+ */
946
+ async getGrantedAbilities() {
947
+ const response = await this.evaluate("GetGrantedAbilities", {});
948
+ return response.data?.abilities ?? [];
949
+ }
950
+ /**
951
+ * Retrieves all active gameplay effects currently applied to this actor's Ability System Component.
952
+ */
953
+ async getActiveEffects() {
954
+ const response = await this.evaluate("GetActiveEffects", {});
955
+ return response.data?.effects ?? [];
956
+ }
943
957
  async hasGameplayAbility(abilityClassPath) {
944
958
  const response = await this.evaluate("HasGameplayAbility", { abilityClassPath });
945
959
  return response.data.hasAbility;
@@ -18,6 +18,9 @@ export type RegisteredComponentClasses = SpecterRegistry extends {
18
18
  export type RegisteredWidgetClasses = SpecterRegistry extends {
19
19
  WidgetClasses: infer T;
20
20
  } ? T : string;
21
+ export type RegisteredGameplayTags = SpecterRegistry extends {
22
+ GameplayTags: infer T;
23
+ } ? (T | (string & {})) : string;
21
24
  export interface SpecterPayload {
22
25
  messageId?: string;
23
26
  command: string;
@@ -46,12 +49,34 @@ export interface SpecterTimelineEvent {
46
49
  ability?: string;
47
50
  target?: string;
48
51
  }
52
+ export interface SpecterGrantedAbility {
53
+ name: string;
54
+ className: string;
55
+ classPath: string;
56
+ handle: string;
57
+ level: number;
58
+ inputID: number;
59
+ isActive: boolean;
60
+ canActivate: boolean;
61
+ cooldownRemaining: number;
62
+ assetTags: string[];
63
+ sourceTags: string[];
64
+ allTags: string[];
65
+ failureTags: string[];
66
+ }
49
67
  export interface SpecterActiveEffect {
50
68
  name: string;
69
+ className?: string;
70
+ classPath?: string;
71
+ handle?: string;
51
72
  duration: number;
52
73
  remainingTime: number;
53
74
  stackCount: number;
75
+ level?: number;
76
+ period?: number;
54
77
  instigator?: string;
78
+ grantedTags?: string[];
79
+ assetTags?: string[];
55
80
  }
56
81
  export interface SpecterActorSnapshot {
57
82
  name: string;
@@ -67,6 +92,7 @@ export interface SpecterActorSnapshot {
67
92
  attributes?: Record<string, number>;
68
93
  gameplayTags?: string[];
69
94
  activeEffects?: SpecterActiveEffect[];
95
+ grantedAbilities?: SpecterGrantedAbility[];
70
96
  }
71
97
  export interface SpecterDiagnosticsReport {
72
98
  target?: SpecterActorSnapshot;
@@ -281,6 +281,16 @@ class SpecterReporter {
281
281
  .replace(/^(Error:\s*)+/i, '')
282
282
  .replace(/^(Specter C\+\+\s*Error:\s*)+/i, '')
283
283
  .trim();
284
+ // Strip extended diagnostics and causality timelines from the concise error message sent to Unreal UI
285
+ if (cleanMessage.includes('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')) {
286
+ cleanMessage = cleanMessage.split('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')[0].trim();
287
+ }
288
+ if (cleanMessage.includes('🧠 SPECTER AI DIAGNOSTICS')) {
289
+ cleanMessage = cleanMessage.split('🧠 SPECTER AI DIAGNOSTICS')[0].trim();
290
+ }
291
+ if (cleanMessage.includes('📜 GAS EVENT CAUSALITY TIMELINE')) {
292
+ cleanMessage = cleanMessage.split('📜 GAS EVENT CAUSALITY TIMELINE')[0].trim();
293
+ }
284
294
  let header = 'ERROR';
285
295
  let message = cleanMessage;
286
296
  let source = '';
@@ -359,7 +369,18 @@ class SpecterReporter {
359
369
  message = message.replace(rawSnippet, '').trim();
360
370
  }
361
371
  }
362
- return `${header}|||${message}|||${source}|||${codeSnippet}`;
372
+ // 5. Truncate message and ensure total length is well within Unreal Engine FName limit (1023 chars)
373
+ if (message.length > 300) {
374
+ message = message.substring(0, 297) + '...';
375
+ }
376
+ if (codeSnippet.length > 100) {
377
+ codeSnippet = codeSnippet.substring(0, 97) + '...';
378
+ }
379
+ const formatted = `${header}|||${message}|||${source}|||${codeSnippet}`;
380
+ if (formatted.length > 500) {
381
+ return formatted.substring(0, 497) + '...';
382
+ }
383
+ return formatted;
363
384
  }
364
385
  onStdOut(chunk, test, result) {
365
386
  this.send({
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { test, expect } from './core/test-wrapper';
2
2
  export { SpecterTransport, SpecterWorld, VectorUtils } from './core/specter-client';
3
- export type { SpecterPayload, SpawnOptions, Vector3, Rotator, LinearColor, Color, Vector2D, SpecterRegistry, SpecterFunctionRegistry, LoadMapOptions } from './core/specter-client';
3
+ export type { SpecterPayload, SpawnOptions, Vector3, Rotator, LinearColor, Color, Vector2D, SpecterRegistry, SpecterFunctionRegistry, LoadMapOptions, SpecterGrantedAbility, SpecterActiveEffect, SpecterActorSnapshot, RegisteredGameplayTags } from './core/specter-client';
4
4
  export { SpecterLocator, WidgetLocator, ActorLocator, AiControllerLocator, type WidgetGeometry } from './core/locators';
5
5
  export { default as SpecterReporter } from './core/specter-reporter';
6
6
  export type { UnrealKey } from './core/specter-keys';
@@ -1,5 +1,5 @@
1
1
  import { SpecterLocator, ActorLocator } from '../core/locators';
2
- import { SpecterTimelineEvent } from '../core/specter-client';
2
+ import { SpecterTimelineEvent, RegisteredGameplayTags } from '../core/specter-client';
3
3
  declare global {
4
4
  namespace PlaywrightTest {
5
5
  interface Matchers<R, T> {
@@ -14,7 +14,7 @@ declare global {
14
14
  gameplayEffect?: string;
15
15
  ability?: string;
16
16
  }, triggerAction?: () => Promise<void>): T extends SpecterLocator ? Promise<R> : never;
17
- toHaveGameplayTag(tag: string): T extends SpecterLocator ? Promise<R> : never;
17
+ toHaveGameplayTag(tag: RegisteredGameplayTags): T extends SpecterLocator ? Promise<R> : never;
18
18
  toHaveGameplayEffect(effectClassPath: string): T extends SpecterLocator ? Promise<R> : never;
19
19
  toHaveAppliedGameplayEffect(effectNameOrClass: string, options?: {
20
20
  count?: number;
@@ -33,13 +33,13 @@ declare global {
33
33
  toHaveGameplayEffectLevel(effectClassPath: string, expectedLevel: number): T extends SpecterLocator ? Promise<R> : never;
34
34
  toHaveAttributeBaseValue(attributeSet: string, attributeName: string, expectedValue: number): T extends SpecterLocator ? Promise<R> : never;
35
35
  toBeExecutingAbility(abilityClassPath: string): T extends SpecterLocator ? Promise<R> : never;
36
- toHaveActivatedAbility(ability: string, optionsOrTrigger?: {
36
+ toHaveActivatedAbility(ability: RegisteredGameplayTags, optionsOrTrigger?: {
37
37
  timeout?: number;
38
38
  times?: number;
39
39
  } | (() => Promise<void>), triggerAction?: () => Promise<void>): T extends SpecterLocator ? Promise<R> : never;
40
- toHaveGameplayTagCount(tag: string, expectedCount: number): T extends SpecterLocator ? Promise<R> : never;
41
- toHaveAnyGameplayTags(tags: string[]): T extends SpecterLocator ? Promise<R> : never;
42
- toHaveAllGameplayTags(tags: string[]): T extends SpecterLocator ? Promise<R> : never;
40
+ toHaveGameplayTagCount(tag: RegisteredGameplayTags, expectedCount: number): T extends SpecterLocator ? Promise<R> : never;
41
+ toHaveAnyGameplayTags(tags: RegisteredGameplayTags[]): T extends SpecterLocator ? Promise<R> : never;
42
+ toHaveAllGameplayTags(tags: RegisteredGameplayTags[]): T extends SpecterLocator ? Promise<R> : never;
43
43
  }
44
44
  }
45
45
  }
@@ -57,7 +57,7 @@ export interface GasMatchers {
57
57
  timeout?: number;
58
58
  tolerance?: number;
59
59
  }, triggerAction?: () => Promise<void>): Promise<void>;
60
- toHaveGameplayTag(tag: string): Promise<void>;
60
+ toHaveGameplayTag(tag: RegisteredGameplayTags): Promise<void>;
61
61
  toHaveGameplayEffect(effectClassPath: string): Promise<void>;
62
62
  toHaveAppliedGameplayEffect(effectNameOrClass: string, options?: {
63
63
  count?: number;
@@ -76,13 +76,13 @@ export interface GasMatchers {
76
76
  toHaveGameplayEffectLevel(effectClassPath: string, expectedLevel: number): Promise<void>;
77
77
  toHaveAttributeBaseValue(attributeSet: string, attributeName: string, expectedValue: number): Promise<void>;
78
78
  toBeExecutingAbility(abilityClassPath: string): Promise<void>;
79
- toHaveActivatedAbility(ability: string, optionsOrTrigger?: {
79
+ toHaveActivatedAbility(ability: RegisteredGameplayTags, optionsOrTrigger?: {
80
80
  timeout?: number;
81
81
  times?: number;
82
82
  } | (() => Promise<void>), triggerAction?: () => Promise<void>): Promise<void>;
83
- toHaveGameplayTagCount(tag: string, expectedCount: number): Promise<void>;
84
- toHaveAnyGameplayTags(tags: string[]): Promise<void>;
85
- toHaveAllGameplayTags(tags: string[]): Promise<void>;
83
+ toHaveGameplayTagCount(tag: RegisteredGameplayTags, expectedCount: number): Promise<void>;
84
+ toHaveAnyGameplayTags(tags: RegisteredGameplayTags[]): Promise<void>;
85
+ toHaveAllGameplayTags(tags: RegisteredGameplayTags[]): Promise<void>;
86
86
  }
87
87
  export declare function formatAiDiagnostics(diagnostics: any): string;
88
88
  export declare function formatCausalityTimeline(events: SpecterTimelineEvent[]): string;
@@ -118,7 +118,7 @@ export declare const gasExpect: import("playwright/test").Expect<{
118
118
  tolerance?: number;
119
119
  };
120
120
  }>;
121
- toHaveGameplayTag(this: import("playwright/test").ExpectMatcherState, locator: ActorLocator, tag: string): Promise<{
121
+ toHaveGameplayTag(this: import("playwright/test").ExpectMatcherState, locator: ActorLocator, tag: RegisteredGameplayTags): Promise<{
122
122
  pass: boolean;
123
123
  message: () => string;
124
124
  actual: boolean;
@@ -207,7 +207,7 @@ export declare const gasExpect: import("playwright/test").Expect<{
207
207
  actual: boolean;
208
208
  expected: boolean;
209
209
  }>;
210
- toHaveActivatedAbility(this: import("playwright/test").ExpectMatcherState, locator: ActorLocator, ability: string, optionsOrTrigger?: {
210
+ toHaveActivatedAbility(this: import("playwright/test").ExpectMatcherState, locator: ActorLocator, ability: RegisteredGameplayTags, optionsOrTrigger?: {
211
211
  timeout?: number;
212
212
  times?: number;
213
213
  } | (() => Promise<void>), triggerAction?: () => Promise<void>): Promise<{
@@ -216,7 +216,7 @@ export declare const gasExpect: import("playwright/test").Expect<{
216
216
  actual: number | boolean;
217
217
  expected: number | boolean;
218
218
  }>;
219
- toHaveGameplayTagCount(this: import("playwright/test").ExpectMatcherState, locator: ActorLocator, tag: string, expectedCount: number): Promise<{
219
+ toHaveGameplayTagCount(this: import("playwright/test").ExpectMatcherState, locator: ActorLocator, tag: RegisteredGameplayTags, expectedCount: number): Promise<{
220
220
  pass: boolean;
221
221
  message: () => string;
222
222
  actual?: undefined;
@@ -227,7 +227,7 @@ export declare const gasExpect: import("playwright/test").Expect<{
227
227
  actual: number;
228
228
  expected: number;
229
229
  }>;
230
- toHaveAnyGameplayTags(this: import("playwright/test").ExpectMatcherState, locator: ActorLocator, tags: string[]): Promise<{
230
+ toHaveAnyGameplayTags(this: import("playwright/test").ExpectMatcherState, locator: ActorLocator, tags: RegisteredGameplayTags[]): Promise<{
231
231
  pass: boolean;
232
232
  message: () => string;
233
233
  actual?: undefined;
@@ -238,7 +238,7 @@ export declare const gasExpect: import("playwright/test").Expect<{
238
238
  actual: boolean;
239
239
  expected: boolean;
240
240
  }>;
241
- toHaveAllGameplayTags(this: import("playwright/test").ExpectMatcherState, locator: ActorLocator, tags: string[]): Promise<{
241
+ toHaveAllGameplayTags(this: import("playwright/test").ExpectMatcherState, locator: ActorLocator, tags: RegisteredGameplayTags[]): Promise<{
242
242
  pass: boolean;
243
243
  message: () => string;
244
244
  actual?: undefined;
@@ -729,6 +729,31 @@ exports.gasExpect = test_1.expect.extend({
729
729
  const transport = locator.transport;
730
730
  const capturedEvents = [];
731
731
  const matchingApplications = [];
732
+ const seenCapturedKeys = new Set();
733
+ const seenEffectKeys = new Set();
734
+ const recordCapturedEvent = (ev) => {
735
+ if (!ev)
736
+ return;
737
+ const key = `${ev.timestamp}_${ev.eventName}_${ev.oldValue}_${ev.newValue}_${ev.description}_${ev.networkRole}`;
738
+ if (!seenCapturedKeys.has(key)) {
739
+ seenCapturedKeys.add(key);
740
+ capturedEvents.push(ev);
741
+ }
742
+ };
743
+ const recordEffectApplication = (ev) => {
744
+ const time = Number(ev.timestamp) || 0;
745
+ // Quantize timestamp to 100ms window to group client prediction + server confirmation and avoid duplicate receipt
746
+ const timeBucket = (Math.round(time * 10) / 10).toFixed(1);
747
+ const target = (ev.target || '').trim();
748
+ const inst = (ev.instigator || '').trim();
749
+ const key = `${timeBucket}_${effectNameOrClass}_${target}_${inst}`;
750
+ if (!seenEffectKeys.has(key)) {
751
+ seenEffectKeys.add(key);
752
+ matchingApplications.push(ev);
753
+ return true;
754
+ }
755
+ return false;
756
+ };
732
757
  // Resolve instigator and target names
733
758
  const [expectedInstigatorName, targetName] = await Promise.all([
734
759
  options?.instigator
@@ -773,9 +798,9 @@ exports.gasExpect = test_1.expect.extend({
773
798
  const recent = transport.getRecentEvents('GLOBAL_timeline-event', startTime - 3000);
774
799
  for (const item of recent) {
775
800
  if (item?.data) {
776
- capturedEvents.push(item.data);
801
+ recordCapturedEvent(item.data);
777
802
  if (isMatchingEffect(item.data)) {
778
- matchingApplications.push(item.data);
803
+ recordEffectApplication(item.data);
779
804
  }
780
805
  }
781
806
  }
@@ -852,10 +877,11 @@ exports.gasExpect = test_1.expect.extend({
852
877
  const listener = (event) => {
853
878
  if (isResolved)
854
879
  return;
855
- capturedEvents.push(event);
880
+ recordCapturedEvent(event);
856
881
  if (isMatchingEffect(event)) {
857
- matchingApplications.push(event);
858
- checkCondition();
882
+ if (recordEffectApplication(event)) {
883
+ checkCondition();
884
+ }
859
885
  }
860
886
  };
861
887
  if (transport && typeof transport.registerEventListener === 'function') {
@@ -1126,41 +1152,76 @@ exports.gasExpect = test_1.expect.extend({
1126
1152
  const transport = locator.transport;
1127
1153
  const capturedEvents = [];
1128
1154
  const activations = [];
1155
+ const seenCapturedKeys = new Set();
1156
+ const seenActivationKeys = new Set();
1157
+ const recordCapturedEvent = (ev) => {
1158
+ if (!ev)
1159
+ return;
1160
+ const key = `${ev.timestamp}_${ev.eventName}_${ev.oldValue}_${ev.newValue}_${ev.description}_${ev.networkRole}`;
1161
+ if (!seenCapturedKeys.has(key)) {
1162
+ seenCapturedKeys.add(key);
1163
+ capturedEvents.push(ev);
1164
+ }
1165
+ };
1166
+ const recordActivation = (ev) => {
1167
+ const time = Number(ev.timestamp) || 0;
1168
+ // Quantize timestamp to 100ms window to group client prediction + server confirmation and avoid duplicate receipt
1169
+ const timeBucket = (Math.round(time * 10) / 10).toFixed(1);
1170
+ const inst = (ev.instigator || ev.target || '').trim();
1171
+ const key = `${timeBucket}_${ability}_${inst}`;
1172
+ if (!seenActivationKeys.has(key)) {
1173
+ seenActivationKeys.add(key);
1174
+ activations.push(ev);
1175
+ return true;
1176
+ }
1177
+ return false;
1178
+ };
1129
1179
  const startTime = Date.now();
1130
1180
  const targetName = await locator.getObjectName().catch(() => undefined);
1131
1181
  const isMatchingAbility = (data) => {
1132
1182
  if (!data)
1133
1183
  return false;
1134
- if (data.ability === ability || data.abilityName === ability || data.abilityClass === ability) {
1184
+ const evAbility = (data.ability || data.abilityName || data.abilityClass || '').trim();
1185
+ if (evAbility === ability || (evAbility && ability.includes(evAbility)) || (ability && evAbility.includes(ability))) {
1135
1186
  return true;
1136
1187
  }
1137
1188
  if (data.tags && Array.isArray(data.tags)) {
1138
- if (data.tags.some((t) => t === ability || t.includes(ability))) {
1189
+ if (data.tags.some((t) => t === ability || t.includes(ability) || ability.includes(t))) {
1139
1190
  return true;
1140
1191
  }
1141
1192
  }
1142
- if (data.abilityClass && data.abilityClass.includes(ability)) {
1193
+ if (data.abilityClass && (data.abilityClass.includes(ability) || ability.includes(data.abilityClass))) {
1143
1194
  return true;
1144
1195
  }
1145
- if (data.abilityPath && data.abilityPath.includes(ability)) {
1196
+ if (data.abilityPath && (data.abilityPath.includes(ability) || ability.includes(data.abilityPath))) {
1146
1197
  return true;
1147
1198
  }
1148
- if (data.eventName && data.eventName.includes(ability)) {
1199
+ if (data.eventName && (data.eventName.includes(ability) || (evAbility && data.eventName.includes(evAbility)))) {
1149
1200
  return true;
1150
1201
  }
1151
- if (data.description && data.description.includes(ability)) {
1202
+ if (data.description && (data.description.includes(ability) || (evAbility && data.description.includes(evAbility)))) {
1152
1203
  return true;
1153
1204
  }
1154
1205
  return false;
1155
1206
  };
1207
+ const isMatchingActor = (data) => {
1208
+ if (!targetName)
1209
+ return true;
1210
+ const inst = (data.instigator || data.target || '').trim();
1211
+ if (!inst)
1212
+ return true;
1213
+ const cleanTarget = targetName.trim();
1214
+ return inst.includes(cleanTarget) || cleanTarget.includes(inst) ||
1215
+ (inst.includes('PlayerState') && cleanTarget.includes('Hero') && inst.slice(-2) === cleanTarget.slice(-2));
1216
+ };
1156
1217
  // Seed from recent transport events if trigger action ran just prior
1157
1218
  if (transport && typeof transport.getRecentEvents === 'function') {
1158
1219
  const recent = transport.getRecentEvents('GLOBAL_timeline-event', startTime - 3000);
1159
1220
  for (const item of recent) {
1160
1221
  if (item?.data) {
1161
- capturedEvents.push(item.data);
1162
- if (isMatchingAbility(item.data)) {
1163
- activations.push(item.data);
1222
+ recordCapturedEvent(item.data);
1223
+ if (isMatchingAbility(item.data) && isMatchingActor(item.data)) {
1224
+ recordActivation(item.data);
1164
1225
  }
1165
1226
  }
1166
1227
  }
@@ -1246,23 +1307,16 @@ exports.gasExpect = test_1.expect.extend({
1246
1307
  const listener = (event) => {
1247
1308
  if (isResolved)
1248
1309
  return;
1249
- capturedEvents.push(event);
1310
+ recordCapturedEvent(event);
1250
1311
  const isAbilityEv = (event.eventName && event.eventName.includes('Ability Activated')) ||
1251
1312
  (event.description && event.description.includes('activated ability')) ||
1252
1313
  event.ability;
1253
1314
  if (isAbilityEv && isMatchingAbility(event)) {
1254
- if (targetName && event.instigator) {
1255
- const cleanTarget = targetName.trim();
1256
- const cleanInst = event.instigator.trim();
1257
- if (cleanInst.includes(cleanTarget) || cleanTarget.includes(cleanInst)) {
1258
- activations.push(event);
1315
+ if (isMatchingActor(event)) {
1316
+ if (recordActivation(event)) {
1259
1317
  checkCondition();
1260
1318
  }
1261
1319
  }
1262
- else {
1263
- activations.push(event);
1264
- checkCondition();
1265
- }
1266
1320
  }
1267
1321
  };
1268
1322
  if (transport && typeof transport.registerEventListener === 'function') {
@@ -1318,7 +1372,7 @@ exports.gasExpect = test_1.expect.extend({
1318
1372
  diagStr = formatAiDiagnostics(diags);
1319
1373
  if (diags?.flightRecorder && Array.isArray(diags.flightRecorder)) {
1320
1374
  for (const ev of diags.flightRecorder) {
1321
- capturedEvents.push(ev);
1375
+ recordCapturedEvent(ev);
1322
1376
  }
1323
1377
  }
1324
1378
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specter-automation/test",
3
- "version": "1.0.115",
3
+ "version": "1.0.116",
4
4
  "description": "Playwright integration for Unreal Engine automation via Specter",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",