Update listTabsMarkdown to use 0-based indexing consistently

Co-authored-by: dgozman <9881434+dgozman@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-06-20 11:55:50 +00:00
parent f4bc6447eb
commit 2a233080f7
2 changed files with 14 additions and 14 deletions

View File

@ -121,7 +121,7 @@ export class Context {
const title = await tab.title(); const title = await tab.title();
const url = tab.page.url(); const url = tab.page.url();
const current = tab === this._currentTab ? ' (current)' : ''; const current = tab === this._currentTab ? ' (current)' : '';
lines.push(`- ${i + 1}:${current} [${title}] (${url})`); lines.push(`- ${i}:${current} [${title}] (${url})`);
} }
return lines.join('\n'); return lines.join('\n');
} }

View File

@ -33,7 +33,7 @@ test('list initial tabs', async ({ client }) => {
expect(await client.callTool({ expect(await client.callTool({
name: 'browser_tab_list', name: 'browser_tab_list',
})).toHaveTextContent(`### Open tabs })).toHaveTextContent(`### Open tabs
- 1: (current) [] (about:blank)`); - 0: (current) [] (about:blank)`);
}); });
test('list first tab', async ({ client }) => { test('list first tab', async ({ client }) => {
@ -41,8 +41,8 @@ test('list first tab', async ({ client }) => {
expect(await client.callTool({ expect(await client.callTool({
name: 'browser_tab_list', name: 'browser_tab_list',
})).toHaveTextContent(`### Open tabs })).toHaveTextContent(`### Open tabs
- 1: [] (about:blank) - 0: [] (about:blank)
- 2: (current) [Tab one] (data:text/html,<title>Tab one</title><body>Body one</body>)`); - 1: (current) [Tab one] (data:text/html,<title>Tab one</title><body>Body one</body>)`);
}); });
test('create new tab', async ({ client }) => { test('create new tab', async ({ client }) => {
@ -53,8 +53,8 @@ test('create new tab', async ({ client }) => {
\`\`\` \`\`\`
### Open tabs ### Open tabs
- 1: [] (about:blank) - 0: [] (about:blank)
- 2: (current) [Tab one] (data:text/html,<title>Tab one</title><body>Body one</body>) - 1: (current) [Tab one] (data:text/html,<title>Tab one</title><body>Body one</body>)
### Current tab ### Current tab
- Page URL: data:text/html,<title>Tab one</title><body>Body one</body> - Page URL: data:text/html,<title>Tab one</title><body>Body one</body>
@ -71,9 +71,9 @@ test('create new tab', async ({ client }) => {
\`\`\` \`\`\`
### Open tabs ### Open tabs
- 1: [] (about:blank) - 0: [] (about:blank)
- 2: [Tab one] (data:text/html,<title>Tab one</title><body>Body one</body>) - 1: [Tab one] (data:text/html,<title>Tab one</title><body>Body one</body>)
- 3: (current) [Tab two] (data:text/html,<title>Tab two</title><body>Body two</body>) - 2: (current) [Tab two] (data:text/html,<title>Tab two</title><body>Body two</body>)
### Current tab ### Current tab
- Page URL: data:text/html,<title>Tab two</title><body>Body two</body> - Page URL: data:text/html,<title>Tab two</title><body>Body two</body>
@ -99,9 +99,9 @@ test('select tab', async ({ client }) => {
\`\`\` \`\`\`
### Open tabs ### Open tabs
- 1: [] (about:blank) - 0: [] (about:blank)
- 2: (current) [Tab one] (data:text/html,<title>Tab one</title><body>Body one</body>) - 1: (current) [Tab one] (data:text/html,<title>Tab one</title><body>Body one</body>)
- 3: [Tab two] (data:text/html,<title>Tab two</title><body>Body two</body>) - 2: [Tab two] (data:text/html,<title>Tab two</title><body>Body two</body>)
### Current tab ### Current tab
- Page URL: data:text/html,<title>Tab one</title><body>Body one</body> - Page URL: data:text/html,<title>Tab one</title><body>Body one</body>
@ -127,8 +127,8 @@ test('close tab', async ({ client }) => {
\`\`\` \`\`\`
### Open tabs ### Open tabs
- 1: [] (about:blank) - 0: [] (about:blank)
- 2: (current) [Tab one] (data:text/html,<title>Tab one</title><body>Body one</body>) - 1: (current) [Tab one] (data:text/html,<title>Tab one</title><body>Body one</body>)
### Current tab ### Current tab
- Page URL: data:text/html,<title>Tab one</title><body>Body one</body> - Page URL: data:text/html,<title>Tab one</title><body>Body one</body>