@specter-automation/test 1.0.152 → 1.0.153

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.
@@ -10,6 +10,8 @@ export default class SpecterReporter implements Reporter {
10
10
  private runEnded;
11
11
  private testStepCounters;
12
12
  private stepIdMap;
13
+ /** Specter expect steps whose wrapper step has started */
14
+ private wrappedExpectSteps;
13
15
  /** Playwright's outer `Expect "<matcher>"` steps for Specter matchers. They are shown under their wrapper step's name. */
14
16
  private specterExpectSteps;
15
17
  /** Image paths already sent to the runner, per test, so step and test attachments aren't sent twice. */
@@ -49,8 +51,15 @@ export default class SpecterReporter implements Reporter {
49
51
  onBegin(config: FullConfig, suite: Suite): void;
50
52
  onTestBegin(test: TestCase): void;
51
53
  private isNestedExpect;
52
- /** The step opened by instrumentMatchers directly under a Specter expect step. */
54
+ /** The step opened by instrumentMatchers directly under a Specter expect step (the first one there). */
55
+ private specterWrapperSteps;
53
56
  private isSpecterWrapper;
57
+ /**
58
+ * Any other step directly under a Specter expect step, opened after the matcher's own step ended: the failure
59
+ * screenshot a failing matcher takes, for one. Not shown as rows (and never taken for the wrapper, which would
60
+ * rename the expect step and leave rows that never end); their images still go to the expect step's row.
61
+ */
62
+ private isExtraStepInMatcher;
54
63
  private readPerfCapture;
55
64
  private readMatcherReport;
56
65
  private getParentStepName;
@@ -141,6 +141,8 @@ class SpecterReporter {
141
141
  runEnded = false;
142
142
  testStepCounters = new Map();
143
143
  stepIdMap = new WeakMap();
144
+ /** Specter expect steps whose wrapper step has started */
145
+ wrappedExpectSteps = new WeakSet();
144
146
  /** Playwright's outer `Expect "<matcher>"` steps for Specter matchers. They are shown under their wrapper step's name. */
145
147
  specterExpectSteps = new WeakSet();
146
148
  /** Image paths already sent to the runner, per test, so step and test attachments aren't sent twice. */
@@ -322,9 +324,19 @@ class SpecterReporter {
322
324
  }
323
325
  return false;
324
326
  }
325
- /** The step opened by instrumentMatchers directly under a Specter expect step. */
327
+ /** The step opened by instrumentMatchers directly under a Specter expect step (the first one there). */
328
+ specterWrapperSteps = new WeakSet();
326
329
  isSpecterWrapper(step) {
327
- return step.category === 'test.step' && !!step.parent && this.specterExpectSteps.has(step.parent);
330
+ return this.specterWrapperSteps.has(step);
331
+ }
332
+ /**
333
+ * Any other step directly under a Specter expect step, opened after the matcher's own step ended: the failure
334
+ * screenshot a failing matcher takes, for one. Not shown as rows (and never taken for the wrapper, which would
335
+ * rename the expect step and leave rows that never end); their images still go to the expect step's row.
336
+ */
337
+ isExtraStepInMatcher(step) {
338
+ return step.category === 'test.step' && !!step.parent && this.specterExpectSteps.has(step.parent)
339
+ && !this.specterWrapperSteps.has(step);
328
340
  }
329
341
  readPerfCapture(step) {
330
342
  const attachment = step.attachments?.find(a => a.name === specter_perf_1.SPECTER_PERF_ATTACHMENT && a.body);
@@ -376,6 +388,14 @@ class SpecterReporter {
376
388
  this.specterExpectSteps.add(step);
377
389
  return;
378
390
  }
391
+ // The first test.step under a Specter expect step is the matcher's wrapper; later ones are extras
392
+ if (step.category === 'test.step' && step.parent && this.specterExpectSteps.has(step.parent)) {
393
+ if (this.wrappedExpectSteps.has(step.parent)) {
394
+ return;
395
+ }
396
+ this.wrappedExpectSteps.add(step.parent);
397
+ this.specterWrapperSteps.add(step);
398
+ }
379
399
  const isCustomWrapper = this.isSpecterWrapper(step);
380
400
  // 2. Ignore other expect wrapper steps (e.g. from helpers that title steps "expect(...)")
381
401
  if (step.category === 'test.step' && step.title.startsWith('expect(') && !isCustomWrapper) {
@@ -429,8 +449,8 @@ class SpecterReporter {
429
449
  }
430
450
  return;
431
451
  }
432
- // 2. Ignore inner expect steps nested under matchers
433
- if (this.isNestedExpect(step)) {
452
+ // 2. Ignore inner expect steps nested under matchers, and other steps a matcher opened after its own
453
+ if (this.isNestedExpect(step) || this.isExtraStepInMatcher(step)) {
434
454
  return;
435
455
  }
436
456
  const isSpecterExpect = this.specterExpectSteps.has(step);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specter-automation/test",
3
- "version": "1.0.152",
3
+ "version": "1.0.153",
4
4
  "description": "Playwright integration for Unreal Engine automation via Specter",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",