@appliqation/automation-sdk 2.8.0 → 2.8.1
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appliqation/automation-sdk",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"description": "Appliqation Automation SDK for Playwright — API-key auth, scope-validated result reporting, portable storageState (setupAuth), and customer-defined login flows (defineLogin) for gated apps",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
package/src/index.d.ts
CHANGED
|
@@ -178,6 +178,16 @@ class AppliqationReporter {
|
|
|
178
178
|
this.executionEndTime = null;
|
|
179
179
|
this.playwrightOutputDir = null;
|
|
180
180
|
|
|
181
|
+
// Playwright does not reliably await a reporter's onTestEnd() return
|
|
182
|
+
// value before calling onEnd() — only onEnd()'s own promise is
|
|
183
|
+
// guaranteed to be awaited. onTestEnd() can itself wait (via
|
|
184
|
+
// waitForRunMatrix) for a still-in-flight run creation, so without
|
|
185
|
+
// this tracking, onEnd() can start reading resultsByRun/orphansByRun
|
|
186
|
+
// before onTestEnd has finished populating them, silently submitting
|
|
187
|
+
// nothing. Every onTestEnd() invocation pushes its own promise here;
|
|
188
|
+
// onEnd() awaits them all first.
|
|
189
|
+
this.pendingTestEndPromises = [];
|
|
190
|
+
|
|
181
191
|
// C5 — scope validation state
|
|
182
192
|
this.scopeFilterEnabled = false; // true when strategy === 'filter'
|
|
183
193
|
this.inScopeUuids = null; // Set<string>, null = no filter
|
|
@@ -405,11 +415,23 @@ class AppliqationReporter {
|
|
|
405
415
|
}
|
|
406
416
|
|
|
407
417
|
/**
|
|
408
|
-
* Called after a test completes
|
|
418
|
+
* Called after a test completes.
|
|
419
|
+
*
|
|
420
|
+
* Playwright does not reliably await this method's returned promise
|
|
421
|
+
* before calling onEnd() — so the actual work (which can wait on a
|
|
422
|
+
* still-in-flight run creation via waitForRunMatrix) runs in
|
|
423
|
+
* _processTestEnd(), and this wrapper only tracks that promise in
|
|
424
|
+
* pendingTestEndPromises so onEnd() can await it explicitly.
|
|
409
425
|
*/
|
|
410
|
-
|
|
426
|
+
onTestEnd(test, result) {
|
|
411
427
|
if (!this.appqEnabled) return;
|
|
428
|
+
const promise = this._processTestEnd(test, result);
|
|
429
|
+
this.pendingTestEndPromises.push(promise);
|
|
430
|
+
return promise;
|
|
431
|
+
}
|
|
412
432
|
|
|
433
|
+
/** @private */
|
|
434
|
+
async _processTestEnd(test, result) {
|
|
413
435
|
try {
|
|
414
436
|
const uuid = UuidExtractor.extractFromAnnotations(result.annotations || []) || UuidExtractor.extractFromTest(test);
|
|
415
437
|
|
|
@@ -624,6 +646,14 @@ class AppliqationReporter {
|
|
|
624
646
|
logger.info('Test run complete.');
|
|
625
647
|
|
|
626
648
|
try {
|
|
649
|
+
// See onTestEnd()'s doc comment — Playwright doesn't reliably await
|
|
650
|
+
// per-test reporter hooks, so results/orphans tracked by still-
|
|
651
|
+
// pending onTestEnd() calls (e.g. waiting on a slow run creation)
|
|
652
|
+
// would otherwise be silently missing from what we're about to read.
|
|
653
|
+
if (this.pendingTestEndPromises.length > 0) {
|
|
654
|
+
await Promise.allSettled(this.pendingTestEndPromises);
|
|
655
|
+
}
|
|
656
|
+
|
|
627
657
|
const orphanDeletedRuns = await this.handleOrphanOnlyRuns();
|
|
628
658
|
|
|
629
659
|
if (this.appqEnabled) {
|