MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / waitForMessage

Function waitForMessage

tests/LogpointManager.test.ts:262–277  ·  view source on GitHub ↗
(
  messages: string[],
  expected: string | RegExp,
)

Source from the content-addressed store, hash-verified

260}
261
262async function waitForMessage(
263 messages: string[],
264 expected: string | RegExp,
265): Promise<void> {
266 const matches = (message: string) =>
267 typeof expected === 'string'
268 ? message === expected
269 : expected.test(message);
270 await waitExecutionFor(async () => {
271 if (!messages.some(matches)) {
272 throw new Error(
273 `Console messages do not include ${expected} yet: ${JSON.stringify(messages)}`,
274 );
275 }
276 }, 5000);
277}
278
279function evaluateWithTimeout(
280 page: McpPage,

Callers 1

Calls 1

waitExecutionForFunction · 0.85

Tested by

no test coverage detected