test(webmcp): Add test for WebMCP form missing tooldescription (#14921)

This commit is contained in:
François Beaufort
2026-04-28 11:41:17 +02:00
committed by GitHub
parent 58efb05e44
commit 7f14a6b96d
+19
View File
@@ -5,6 +5,7 @@
*/
import expect from 'expect';
import type {Issue} from 'puppeteer';
import type {
WebMCPTool,
WebMCPToolCall,
@@ -12,6 +13,7 @@ import type {
} from 'puppeteer-core/internal/cdp/WebMCP.js';
import {setupSeparateTestBrowserHooks} from '../mocha-utils.js';
import {html, waitEvent} from '../utils.js';
describe('Page.webmcp', function () {
const state = setupSeparateTestBrowserHooks({
@@ -556,4 +558,21 @@ describe('Page.webmcp', function () {
expect(response.errorText).toBeUndefined();
expect(response.exception).toBeUndefined();
});
it('should emit issue event from WebMCP form missing tooldescription', async () => {
const {page, httpsServer} = state;
await page.goto(httpsServer.EMPTY_PAGE);
const issuePromise = waitEvent<Issue>(page, 'issue');
await page.setContent(html`<form toolname="mytool"></form>`);
const issue = await issuePromise;
expect(issue).toBeTruthy();
expect(issue.code).toBe('GenericIssue');
expect(issue.details.genericIssueDetails).toBeTruthy();
expect(issue.details.genericIssueDetails!.errorType).toBe(
'FormModelContextMissingToolDescription',
);
});
});