test(studio): the backup connection tests find the passphrase field by the change action it now names, and the Markdown poll test waits out the 220ms tab-entry timer before it takes its baseline

This commit is contained in:
yhh committed 2026-11-07 01:32:38 -08:00
1 parent 87d20e14b3
commit 98c340be47
2 files changed
+6 -3

No files matched your search

@@ -47,7 +47,9 @@ function makePort(...ids: string[]) {
}
function control<T extends HTMLElement = HTMLButtonElement>(action: string, target?: string) {
return document.querySelector<T>(`[data-action="backup.${action}"]${target ? `[data-target="${target}"]` : ""}`)!;
const at = target ? `[data-target="${target}"]` : "";
// A field that also reacts to a key names each event, so its action sits on the change attribute.
return document.querySelector<T>(`[data-action="backup.${action}"]${at}, [data-action-change="backup.${action}"]${at}`)!;
}
function change(action: string, value: string, target?: string) {
@@ -98,8 +98,9 @@ it("leaves the rendered Workbench untouched when Markdown polls are unchanged",
await user.click(await screen.findByRole("button", { name: "notes.md" }));
await screen.findByRole("heading", { name: "Saved" });
await act(async () => {});
// Whatever the open itself left pending lands before the baseline, not in it.
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 0)); });
// A tab that has just opened clears its entering state on a real 220ms timer
// (the fake clock covers intervals only), so the baseline waits it out.
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 300)); });
commits.mockClear();
await tick();
await tick();