( container: HTMLElement, script: string )
| 18 | import { mockScrollMetrics as mockScrollportMetrics } from "../scrollMetrics"; |
| 19 | |
| 20 | async 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 | |
| 37 | function getMessageWindow(container: HTMLElement): HTMLDivElement { |
| 38 | const element = container.querySelector('[data-testid="message-window"]'); |
no test coverage detected