Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(preview): bound automation waits and screenshot captures #4685

Mergedjuliusmarmingemerged 6 commits intomain fromrefs/pull/4685/headmerged by juliusmarminge View on GitHub

Showing 5 changed files with 143 additions and 2 deletions (loading 4).

x
0 of 5 viewed, 5 left
143 additions and 2 deletionsapps/desktop/src/preview/Manager.test.tsModified
View file
@@ -2060,10 +2060,30 @@
/\/browser-artifacts\/browser-screenshot-example-com-[^.]+\.png$/,
+ // Chromium reports UnknownVizError while a hidden guest warms its
+ // first compositor frame, so transient failures are retried.
+ capturePage.mockClear();
+ capturePage.mockRejectedValueOnce(new Error("UnknownVizError"));
+ capturePage.mockRejectedValueOnce(new Error("UnknownVizError"));
+ const retriedFiber = yield* Effect.exit(manager.captureScreenshot("tab_1")).pipe(
+ Effect.forkChild({ startImmediately: true }),
+ );
+ yield* TestClock.adjust(1_000);
+ const retriedExit = yield* Fiber.join(retriedFiber);
+ expect(Exit.isSuccess(retriedExit)).toBe(true);
+ expect(capturePage).toHaveBeenCalledTimes(3);
+​
+ // A persistent failure still surfaces once the retries are spent.
+ capturePage.mockClear();
const captureCause = new Error("capture failed");
- capturePage.mockRejectedValueOnce(captureCause);
- const exit = yield* Effect.exit(manager.captureScreenshot("tab_1"));
+ capturePage.mockRejectedValue(captureCause);
+ const failingFiber = yield* Effect.exit(manager.captureScreenshot("tab_1")).pipe(
+ Effect.forkChild({ startImmediately: true }),
+ );
+ yield* TestClock.adjust(1_000);
+ const exit = yield* Fiber.join(failingFiber);
expect(Exit.isFailure(exit)).toBe(true);
+ expect(capturePage).toHaveBeenCalledTimes(3);