chore: include "playwright" keyword, add examples (#196)

This commit is contained in:
Simon Knott
2025-04-16 17:18:40 +02:00
committed by GitHub
parent 5c2e11017d
commit e7c7709b33
5 changed files with 58 additions and 11 deletions

View File

@@ -24,7 +24,7 @@ test('browser_navigate', async ({ client }) => {
url: 'data:text/html,<html><title>Title</title><body>Hello, world!</body></html>',
},
})).toHaveTextContent(`
- Ran code:
- Ran Playwright code:
\`\`\`js
// Navigate to data:text/html,<html><title>Title</title><body>Hello, world!</body></html>
await page.goto('data:text/html,<html><title>Title</title><body>Hello, world!</body></html>');
@@ -55,7 +55,7 @@ test('browser_click', async ({ client }) => {
ref: 's1e3',
},
})).toHaveTextContent(`
- Ran code:
- Ran Playwright code:
\`\`\`js
// Click Submit button
await page.getByRole('button', { name: 'Submit' }).click();
@@ -87,7 +87,7 @@ test('browser_select_option', async ({ client }) => {
values: ['bar'],
},
})).toHaveTextContent(`
- Ran code:
- Ran Playwright code:
\`\`\`js
// Select options [bar] in Select
await page.getByRole('combobox').selectOption(['bar']);
@@ -120,7 +120,7 @@ test('browser_select_option (multiple)', async ({ client }) => {
values: ['bar', 'baz'],
},
})).toHaveTextContent(`
- Ran code:
- Ran Playwright code:
\`\`\`js
// Select options [bar, baz] in Select
await page.getByRole('listbox').selectOption(['bar', 'baz']);
@@ -260,7 +260,7 @@ test('browser_resize', async ({ client }) => {
height: 780,
},
});
expect(response).toContainTextContent(`- Ran code:
expect(response).toContainTextContent(`- Ran Playwright code:
\`\`\`js
// Resize browser window to 390x780
await page.setViewportSize({ width: 390, height: 780 });

View File

@@ -41,7 +41,7 @@ test('cdp server reuse tab', async ({ cdpEndpoint, startClient }) => {
name: 'browser_snapshot',
arguments: {},
})).toHaveTextContent(`
- Ran code:
- Ran Playwright code:
\`\`\`js
// <internal code to capture accessibility snapshot>
\`\`\`

View File

@@ -31,7 +31,7 @@ async function createTab(client: Client, title: string, body: string) {
test('create new tab', async ({ client }) => {
expect(await createTab(client, 'Tab one', 'Body one')).toHaveTextContent(`
- Ran code:
- Ran Playwright code:
\`\`\`js
// <internal code to open a new tab>
\`\`\`
@@ -49,7 +49,7 @@ test('create new tab', async ({ client }) => {
\`\`\``);
expect(await createTab(client, 'Tab two', 'Body two')).toHaveTextContent(`
- Ran code:
- Ran Playwright code:
\`\`\`js
// <internal code to open a new tab>
\`\`\`
@@ -77,7 +77,7 @@ test('select tab', async ({ client }) => {
index: 2,
},
})).toHaveTextContent(`
- Ran code:
- Ran Playwright code:
\`\`\`js
// <internal code to select tab 2>
\`\`\`
@@ -105,7 +105,7 @@ test('close tab', async ({ client }) => {
index: 3,
},
})).toHaveTextContent(`
- Ran code:
- Ran Playwright code:
\`\`\`js
// <internal code to close tab 3>
\`\`\`