chore: test list tabs (#208)

This commit is contained in:
Pavel Feldman
2025-04-17 00:58:02 -07:00
committed by GitHub
parent 7e4a964b0a
commit 4b261286bf
14 changed files with 66 additions and 58 deletions

View File

@@ -96,8 +96,8 @@ await page.getByRole('combobox').selectOption(['bar']);
- Page Snapshot
\`\`\`yaml
- combobox [ref=s2e3]:
- option "Foo" [ref=s2e4]
- option "Bar" [selected] [ref=s2e5]
- option "Foo" [ref=s2e4]
- option "Bar" [selected] [ref=s2e5]
\`\`\`
`);
});
@@ -129,9 +129,9 @@ await page.getByRole('listbox').selectOption(['bar', 'baz']);
- Page Snapshot
\`\`\`yaml
- listbox [ref=s2e3]:
- option "Foo" [ref=s2e4]
- option "Bar" [selected] [ref=s2e5]
- option "Baz" [selected] [ref=s2e6]
- option "Foo" [ref=s2e4]
- option "Bar" [selected] [ref=s2e5]
- option "Baz" [selected] [ref=s2e6]
\`\`\`
`);
});

View File

@@ -26,12 +26,11 @@ test('stitched aria frames', async ({ client }) => {
\`\`\`yaml
- heading "Hello" [level=1] [ref=s1e3]
- iframe [ref=s1e4]:
- button "World" [ref=f1s1e3]
- main [ref=f1s1e4]:
- iframe [ref=f1s1e5]:
- paragraph [ref=f2s1e3]: Nested
\`\`\`
`);
- button "World" [ref=f1s1e3]
- main [ref=f1s1e4]:
- iframe [ref=f1s1e5]:
- paragraph [ref=f2s1e3]: Nested
\`\`\``);
expect(await client.callTool({
name: 'browser_click',

View File

@@ -29,6 +29,22 @@ async function createTab(client: Client, title: string, body: string) {
});
}
test('list initial tabs', async ({ client }) => {
expect(await client.callTool({
name: 'browser_tab_list',
})).toHaveTextContent(`### Open tabs
- 1: (current) [] (about:blank)`);
});
test('list first tab', async ({ client }) => {
await createTab(client, 'Tab one', 'Body one');
expect(await client.callTool({
name: 'browser_tab_list',
})).toHaveTextContent(`### Open tabs
- 1: [] (about:blank)
- 2: (current) [Tab one] (data:text/html,<title>Tab one</title><body>Body one</body>)`);
});
test('create new tab', async ({ client }) => {
expect(await createTab(client, 'Tab one', 'Body one')).toHaveTextContent(`
- Ran Playwright code: