豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 98cc530

Browse files
committed
test: add coverage for list_pages after selected page is closed
Adds a test that verifies list_pages works correctly when the currently selected page has been closed externally. This exercises the definePageTool → defineTool change that removes the page-scoped requirement from list_pages. Ref #1138
1 parent 71da398 commit 98cc530

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/tools/pages.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,24 @@ describe('pages', () => {
5353
assert.ok(response.includePages);
5454
});
5555
});
56+
it('list pages after selected page is closed', async () => {
57+
await withMcpContext(async (response, context) => {
58+
// Create a second page and select it.
59+
const page2 = await context.newPage();
60+
assert.strictEqual(context.getSelectedMcpPage(), page2);
61+
62+
// Close the selected page via puppeteer (simulating external close).
63+
await page2.pptrPage.close();
64+
65+
// list_pages should still work even though the selected page is gone.
66+
await listPages().handler(
67+
{params: {}},
68+
response,
69+
context,
70+
);
71+
assert.ok(response.includePages);
72+
});
73+
});
5674
it(`list pages for extension pages with --category-extensions`, async t => {
5775
await withMcpContext(
5876
async (response, context) => {

0 commit comments

Comments
 (0)