@specter-automation/test 1.0.146 → 1.0.147

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.
@@ -403,7 +403,7 @@ exports.gasExpect = test_1.expect.extend((0, instrument_1.instrumentMatchers)({
403
403
  const matched = (actual) => ({
404
404
  pass: true,
405
405
  message: () => `${this.utils.matcherHint(assertionName, locator.toString(), expectedParts.join(', '), { isNot })}\n\n` +
406
- `Expected no change matching { ${expectedParts.join(', ')} }, but got:\n${JSON.stringify(actual, null, 2)}`,
406
+ `Expected no change matching { ${expectedParts.join(', ')} }, but got: ${describeAttributeChange(actual)}`,
407
407
  actual,
408
408
  expected: expectedChange
409
409
  });
@@ -426,7 +426,7 @@ exports.gasExpect = test_1.expect.extend((0, instrument_1.instrumentMatchers)({
426
426
  }
427
427
  try {
428
428
  // In parallel: resolve initial value and locator names
429
- const [resolvedInitialVal, expectedInstigatorName, expectedEffectCauserName] = await Promise.all([
429
+ const [resolvedInitialVal, expectedInstigatorName, expectedEffectCauserName, targetName] = await Promise.all([
430
430
  locator.getAttributeValue(attributeSet, attributeName).catch(() => undefined),
431
431
  expectedChange.instigator
432
432
  ? (typeof expectedChange.instigator === 'string' ? Promise.resolve(expectedChange.instigator) : expectedChange.instigator.getObjectName().catch(() => undefined))
@@ -434,6 +434,8 @@ exports.gasExpect = test_1.expect.extend((0, instrument_1.instrumentMatchers)({
434
434
  expectedChange.effectCauser
435
435
  ? (typeof expectedChange.effectCauser === 'string' ? Promise.resolve(expectedChange.effectCauser) : expectedChange.effectCauser.getObjectName().catch(() => undefined))
436
436
  : Promise.resolve(undefined),
437
+ // The actor this checks: events come from every actor in the game
438
+ locator.getObjectName().catch(() => undefined),
437
439
  ]);
438
440
  initialValue = resolvedInitialVal;
439
441
  // Evaluates whether an event matches all expected criteria
@@ -444,6 +446,10 @@ exports.gasExpect = test_1.expect.extend((0, instrument_1.instrumentMatchers)({
444
446
  if (event.eventName !== attributeName && !event.eventName?.includes(attributeName)) {
445
447
  return false;
446
448
  }
449
+ // Only changes to this actor's attributes count (the event's target is the avatar, a hero rather than its PlayerState)
450
+ if (targetName && (event.target || '').trim() !== targetName.trim()) {
451
+ return false;
452
+ }
447
453
  lastEvent = event;
448
454
  lastFailedReasons = [];
449
455
  let isMatch = true;
@@ -526,6 +532,7 @@ exports.gasExpect = test_1.expect.extend((0, instrument_1.instrumentMatchers)({
526
532
  // Verify whether any conflicting attribute change events arrived
527
533
  const conflictingEvent = capturedEvents.find(ev => (ev.eventType === specter_client_1.SpecterEventType.GameplayAttribute || ev.eventType === 'GameplayAttribute') &&
528
534
  (ev.eventName === attributeName || ev.eventName?.includes(attributeName)) &&
535
+ (!targetName || (ev.target || '').trim() === targetName.trim()) &&
529
536
  parseFloat(ev.oldValue) !== parseFloat(ev.newValue));
530
537
  if (!conflictingEvent) {
531
538
  const currentVal = await locator.getAttributeValue(attributeSet, attributeName).catch(() => initialValue);
@@ -1618,3 +1625,24 @@ exports.gasExpect = test_1.expect.extend((0, instrument_1.instrumentMatchers)({
1618
1625
  })();
1619
1626
  },
1620
1627
  }));
1628
+ /** One line for an attribute change event: what changed, on whom, and from what (the raw event was cut short in reports) */
1629
+ function describeAttributeChange(event) {
1630
+ if (!event || event.oldValue === undefined) {
1631
+ return JSON.stringify(event);
1632
+ }
1633
+ const oldValue = parseFloat(event.oldValue);
1634
+ const newValue = parseFloat(event.newValue);
1635
+ const delta = newValue - oldValue;
1636
+ const parts = [`${event.eventName} ${oldValue} -> ${newValue} (${delta >= 0 ? '+' : ''}${delta})`];
1637
+ if (event.target)
1638
+ parts.push(`on ${event.target}`);
1639
+ if (typeof event.timestamp === 'number')
1640
+ parts.push(`at ${event.timestamp.toFixed(2)}s`);
1641
+ if (event.gameplayEffect)
1642
+ parts.push(`effect ${event.gameplayEffect}`);
1643
+ if (event.instigator)
1644
+ parts.push(`instigator ${event.instigator}`);
1645
+ if (event.ability)
1646
+ parts.push(`ability ${event.ability}`);
1647
+ return parts.join(', ');
1648
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specter-automation/test",
3
- "version": "1.0.146",
3
+ "version": "1.0.147",
4
4
  "description": "Playwright integration for Unreal Engine automation via Specter",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",