HEAD b459078b4be677f49a3e2c10d9091c48f5ed7e17
fbfd47439a72b525d16ec39e3394323486f896e6c2c099b2cd639e41cfaf750b apps/server/src/preview/ServerBrowserPage.test.ts
aee154734ee6088ed0332affd8fd06a9bb35aae47153d2043d85f2ae7fc3c0a8 apps/server/src/mcp/PreviewAutomationBroker.test.ts

Cause regression assertion (committed source):

  it("tells a click target that matches nothing from one that never becomes clickable", async () => {
    await page.setContent(`<button hidden>hidden</button>`);
    const failure = (selector: string) =>
      ServerBrowserPage.click(page, { selector, timeoutMs: 500 }).then(
        () => expect.unreachable(),
        ServerBrowserPage.toOperationError,
      );

    const absent = await failure(".definitely-no-such-t3-target");
    expect(absent.tag).toBe("PreviewAutomationTimeoutError");
    expect(absent.message).toBe(
      'No element matches ".definitely-no-such-t3-target" after the timeout. The click may have happened and removed its target or navigated; check the page before retrying, then take a fresh snapshot and use its locator.',
    );
    expect(absent.cause).toMatchObject({ name: "TimeoutError" });
    const hidden = await failure("button");
    expect(hidden.tag).toBe("PreviewAutomationTimeoutError");
    expect(hidden.message).toBe(
      '"button" still matches an element after the timeout. The click may have happened; check the page before retrying.',
    );
  });

