pageText
Open url in a fresh headless Chrome and return the text of selector once until accepts it (or the last text
seen when timeoutMs runs out).
import { withPage } from "#codebase/tcmts/cli/test/browser"; export function pageText(url: string, selector: string, until: (text: string) => boolean, timeoutMs = 15000): Promise<string> { return withPage(url, (page) => page.waitFor<string>(`document.querySelector(${JSON.stringify(selector)})?.textContent ?? ""`, (t) => until(t ?? ""), timeoutMs).then((t) => t ?? "")); }