MCPcopy
hub / github.com/coder/mux / waitForBashScriptSpan

Function waitForBashScriptSpan

tests/ui/chat/bottomLayoutShift.test.ts:20–35  ·  view source on GitHub ↗
(
  container: HTMLElement,
  script: string
)

Source from the content-addressed store, hash-verified

18import { mockScrollMetrics as mockScrollportMetrics } from "../scrollMetrics";
19
20async function waitForBashScriptSpan(
21 container: HTMLElement,
22 script: string
23): Promise<HTMLSpanElement> {
24 return waitFor(
25 () => {
26 const matches = Array.from(container.querySelectorAll("span")).filter(
27 (span) => span.textContent?.trim() === script
28 );
29 const span = matches[matches.length - 1];
30 if (!span) throw new Error(`Bash script span "${script}" not found yet`);
31 return span as HTMLSpanElement;
32 },
33 { timeout: 10_000 }
34 );
35}
36
37function getMessageWindow(container: HTMLElement): HTMLDivElement {
38 const element = container.querySelector('[data-testid="message-window"]');

Callers 1

Calls 1

waitForFunction · 0.50

Tested by

no test coverage detected