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

Function waitForMessage

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 1

waitExecutionForFunction · 0.85

Tested by

no test coverage detected