@threenative/playtest 0.3.5 → 0.3.6
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/dist/runner/cli.js +46 -19
- package/dist/runner/index.js +42 -18
- package/package.json +1 -1
package/dist/runner/cli.js
CHANGED
|
@@ -9608,12 +9608,13 @@ function managedServerError(message, url, timeoutMs, output) {
|
|
|
9608
9608
|
"Run the server command directly, fix its first error, then rerun the same playtest command."
|
|
9609
9609
|
));
|
|
9610
9610
|
}
|
|
9611
|
-
var UNHANDLED_REJECTION_PREFIX, SCREENSHOT_TIMEOUT_MS, MAX_FIXED_STEP_STARTUP_RETRIES, STOPPED_LOOP_ERROR, ManagedServerError;
|
|
9611
|
+
var UNHANDLED_REJECTION_PREFIX, SCREENSHOT_TIMEOUT_MS, PRESENTATION_BOUND_MS, MAX_FIXED_STEP_STARTUP_RETRIES, STOPPED_LOOP_ERROR, ManagedServerError;
|
|
9612
9612
|
var init_shared = __esm({
|
|
9613
9613
|
"src/runner/shared.ts"() {
|
|
9614
9614
|
init_index();
|
|
9615
9615
|
UNHANDLED_REJECTION_PREFIX = "__THREENATIVE_PLAYTEST_UNHANDLED_REJECTION__:";
|
|
9616
9616
|
SCREENSHOT_TIMEOUT_MS = 12e4;
|
|
9617
|
+
PRESENTATION_BOUND_MS = 1e4;
|
|
9617
9618
|
MAX_FIXED_STEP_STARTUP_RETRIES = 120;
|
|
9618
9619
|
STOPPED_LOOP_ERROR = "Cannot advance a stopped loop.";
|
|
9619
9620
|
ManagedServerError = class extends Error {
|
|
@@ -16468,6 +16469,22 @@ init_shared();
|
|
|
16468
16469
|
init_shared();
|
|
16469
16470
|
init_index();
|
|
16470
16471
|
init_capture();
|
|
16472
|
+
|
|
16473
|
+
// src/runner/capture-retry.ts
|
|
16474
|
+
init_capture();
|
|
16475
|
+
async function retakeWhileBlank(retake, grace, boundMs, now = Date.now) {
|
|
16476
|
+
const deadline = now() + boundMs;
|
|
16477
|
+
for (; ; ) {
|
|
16478
|
+
await grace();
|
|
16479
|
+
try {
|
|
16480
|
+
return await retake();
|
|
16481
|
+
} catch (error) {
|
|
16482
|
+
if (!(error instanceof CaptureGuardError) || now() >= deadline) throw error;
|
|
16483
|
+
}
|
|
16484
|
+
}
|
|
16485
|
+
}
|
|
16486
|
+
|
|
16487
|
+
// src/runner/runner.ts
|
|
16471
16488
|
init_bridgeClient();
|
|
16472
16489
|
init_browser();
|
|
16473
16490
|
var REMOTE_BROWSER_SESSIONS = /* @__PURE__ */ new WeakMap();
|
|
@@ -16957,17 +16974,22 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
16957
16974
|
return { ...elementRegions === void 0 ? {} : { elementRegions }, image: png };
|
|
16958
16975
|
} catch (error) {
|
|
16959
16976
|
if (!(error instanceof CaptureGuardError)) throw error;
|
|
16960
|
-
await presentationGrace();
|
|
16961
|
-
if (captureElementBounds) elementRegions = await sampleVisualElementBounds(activePage, visualAssertions);
|
|
16962
16977
|
try {
|
|
16963
|
-
|
|
16964
|
-
|
|
16965
|
-
|
|
16966
|
-
|
|
16967
|
-
|
|
16968
|
-
|
|
16969
|
-
|
|
16970
|
-
|
|
16978
|
+
return await retakeWhileBlank(
|
|
16979
|
+
async () => {
|
|
16980
|
+
if (captureElementBounds) elementRegions = await sampleVisualElementBounds(activePage, visualAssertions);
|
|
16981
|
+
try {
|
|
16982
|
+
png = await activePage.screenshot(options2);
|
|
16983
|
+
} catch {
|
|
16984
|
+
}
|
|
16985
|
+
const stats = assertCaptureNotBlank(png, label);
|
|
16986
|
+
if (stats.tone !== void 0) tone.push({ code: "TN_TONE", label, ...atStep === void 0 ? {} : { atStep }, ...stats.tone });
|
|
16987
|
+
tone.push(...collectRegionalTone(png, scenario.assert?.tone ?? [], label, atStep));
|
|
16988
|
+
return { ...elementRegions === void 0 ? {} : { elementRegions }, image: png };
|
|
16989
|
+
},
|
|
16990
|
+
presentationGrace,
|
|
16991
|
+
PRESENTATION_BOUND_MS
|
|
16992
|
+
);
|
|
16971
16993
|
} catch (error2) {
|
|
16972
16994
|
if (!(error2 instanceof CaptureGuardError)) throw error2;
|
|
16973
16995
|
captureFailure ??= { code: error2.code, label: error2.label, reason: error2.reason };
|
|
@@ -17000,15 +17022,20 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
17000
17022
|
return { image: png };
|
|
17001
17023
|
} catch (error) {
|
|
17002
17024
|
if (!(error instanceof CaptureGuardError)) throw error;
|
|
17003
|
-
await presentationGrace();
|
|
17004
17025
|
try {
|
|
17005
|
-
const retry = await
|
|
17006
|
-
|
|
17007
|
-
|
|
17008
|
-
|
|
17009
|
-
|
|
17010
|
-
|
|
17011
|
-
|
|
17026
|
+
const retry = await retakeWhileBlank(
|
|
17027
|
+
async () => {
|
|
17028
|
+
const shot = await captureVisualSurface(activePage, artifactPath);
|
|
17029
|
+
if (shot === void 0) return void 0;
|
|
17030
|
+
const stats = assertCaptureNotBlank(shot, label);
|
|
17031
|
+
if (stats.tone !== void 0) tone.push({ code: "TN_TONE", label, ...atStep === void 0 ? {} : { atStep }, ...stats.tone });
|
|
17032
|
+
tone.push(...collectRegionalTone(shot, scenario.assert?.tone ?? [], label, atStep));
|
|
17033
|
+
return shot;
|
|
17034
|
+
},
|
|
17035
|
+
presentationGrace,
|
|
17036
|
+
PRESENTATION_BOUND_MS
|
|
17037
|
+
);
|
|
17038
|
+
if (retry !== void 0) return { image: retry };
|
|
17012
17039
|
} catch (error2) {
|
|
17013
17040
|
if (!(error2 instanceof CaptureGuardError)) throw error2;
|
|
17014
17041
|
captureFailure ??= { code: error2.code, label: error2.label, reason: error2.reason };
|
package/dist/runner/index.js
CHANGED
|
@@ -8897,6 +8897,7 @@ function setupApplication(requested, confirmation) {
|
|
|
8897
8897
|
// src/runner/shared.ts
|
|
8898
8898
|
var UNHANDLED_REJECTION_PREFIX = "__THREENATIVE_PLAYTEST_UNHANDLED_REJECTION__:";
|
|
8899
8899
|
var SCREENSHOT_TIMEOUT_MS = 12e4;
|
|
8900
|
+
var PRESENTATION_BOUND_MS = 1e4;
|
|
8900
8901
|
var MAX_FIXED_STEP_STARTUP_RETRIES = 120;
|
|
8901
8902
|
var STOPPED_LOOP_ERROR = "Cannot advance a stopped loop.";
|
|
8902
8903
|
var ManagedServerError = class extends Error {
|
|
@@ -14141,6 +14142,19 @@ function waitForProcessExit2(server, timeoutMs) {
|
|
|
14141
14142
|
server.once("exit", onExit);
|
|
14142
14143
|
});
|
|
14143
14144
|
}
|
|
14145
|
+
|
|
14146
|
+
// src/runner/capture-retry.ts
|
|
14147
|
+
async function retakeWhileBlank(retake, grace, boundMs, now = Date.now) {
|
|
14148
|
+
const deadline = now() + boundMs;
|
|
14149
|
+
for (; ; ) {
|
|
14150
|
+
await grace();
|
|
14151
|
+
try {
|
|
14152
|
+
return await retake();
|
|
14153
|
+
} catch (error) {
|
|
14154
|
+
if (!(error instanceof CaptureGuardError) || now() >= deadline) throw error;
|
|
14155
|
+
}
|
|
14156
|
+
}
|
|
14157
|
+
}
|
|
14144
14158
|
var REMOTE_BROWSER_SESSIONS = /* @__PURE__ */ new WeakMap();
|
|
14145
14159
|
function remoteBrowserFor(config) {
|
|
14146
14160
|
return REMOTE_BROWSER_SESSIONS.get(config);
|
|
@@ -14610,17 +14624,22 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14610
14624
|
return { ...elementRegions === void 0 ? {} : { elementRegions }, image: png };
|
|
14611
14625
|
} catch (error) {
|
|
14612
14626
|
if (!(error instanceof CaptureGuardError)) throw error;
|
|
14613
|
-
await presentationGrace();
|
|
14614
|
-
if (captureElementBounds) elementRegions = await sampleVisualElementBounds(activePage, visualAssertions);
|
|
14615
14627
|
try {
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14628
|
+
return await retakeWhileBlank(
|
|
14629
|
+
async () => {
|
|
14630
|
+
if (captureElementBounds) elementRegions = await sampleVisualElementBounds(activePage, visualAssertions);
|
|
14631
|
+
try {
|
|
14632
|
+
png = await activePage.screenshot(options2);
|
|
14633
|
+
} catch {
|
|
14634
|
+
}
|
|
14635
|
+
const stats = assertCaptureNotBlank(png, label);
|
|
14636
|
+
if (stats.tone !== void 0) tone.push({ code: "TN_TONE", label, ...atStep === void 0 ? {} : { atStep }, ...stats.tone });
|
|
14637
|
+
tone.push(...collectRegionalTone(png, scenario.assert?.tone ?? [], label, atStep));
|
|
14638
|
+
return { ...elementRegions === void 0 ? {} : { elementRegions }, image: png };
|
|
14639
|
+
},
|
|
14640
|
+
presentationGrace,
|
|
14641
|
+
PRESENTATION_BOUND_MS
|
|
14642
|
+
);
|
|
14624
14643
|
} catch (error2) {
|
|
14625
14644
|
if (!(error2 instanceof CaptureGuardError)) throw error2;
|
|
14626
14645
|
captureFailure ??= { code: error2.code, label: error2.label, reason: error2.reason };
|
|
@@ -14653,15 +14672,20 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14653
14672
|
return { image: png };
|
|
14654
14673
|
} catch (error) {
|
|
14655
14674
|
if (!(error instanceof CaptureGuardError)) throw error;
|
|
14656
|
-
await presentationGrace();
|
|
14657
14675
|
try {
|
|
14658
|
-
const retry = await
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14663
|
-
|
|
14664
|
-
|
|
14676
|
+
const retry = await retakeWhileBlank(
|
|
14677
|
+
async () => {
|
|
14678
|
+
const shot = await captureVisualSurface(activePage, artifactPath);
|
|
14679
|
+
if (shot === void 0) return void 0;
|
|
14680
|
+
const stats = assertCaptureNotBlank(shot, label);
|
|
14681
|
+
if (stats.tone !== void 0) tone.push({ code: "TN_TONE", label, ...atStep === void 0 ? {} : { atStep }, ...stats.tone });
|
|
14682
|
+
tone.push(...collectRegionalTone(shot, scenario.assert?.tone ?? [], label, atStep));
|
|
14683
|
+
return shot;
|
|
14684
|
+
},
|
|
14685
|
+
presentationGrace,
|
|
14686
|
+
PRESENTATION_BOUND_MS
|
|
14687
|
+
);
|
|
14688
|
+
if (retry !== void 0) return { image: retry };
|
|
14665
14689
|
} catch (error2) {
|
|
14666
14690
|
if (!(error2 instanceof CaptureGuardError)) throw error2;
|
|
14667
14691
|
captureFailure ??= { code: error2.code, label: error2.label, reason: error2.reason };
|
package/package.json
CHANGED