Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): preview_wait_for stops at its timeout when the page stops answering #32846

MergedEntrpi(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/32846/headmerged by maria-rcks View on GitHub

Showing 2 changed files with 41 additions and 10 deletions.

x
0 of 2 viewed, 2 left
20 additions and 0 deletionsapps/server/src/preview/ServerBrowserPage.test.tsModified
View file
@@ -521,6 +521,26 @@
});
});
​
+describe("server browser wait", () => {
+ it("ends at its timeout when a check never answers", async () => {
+ // As on a desktop tab whose Playwright utility world never answers.
+ const page = {
+ locator: () => ({ count: () => new Promise<number>(() => {}) }),
+ } as unknown as Page;
+ vi.useFakeTimers();
+ try {
+ let failure: unknown;
+ void ServerBrowserPage.waitFor(page, { selector: "button", timeoutMs: 300 }).catch(
+ (error: unknown) => (failure = error),
+ );
+ await vi.advanceTimersByTimeAsync(300);
+ expect(failure).toMatchObject({ tag: "PreviewAutomationTimeoutError" });
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+});
+​
describe("server browser net errors", () => {
it.each([
["net::ERR_CONNECTION_REFUSED", "ERR_CONNECTION_REFUSED", -102],
21 additions and 10 deletionsapps/server/src/preview/ServerBrowserPage.tsModified
View file