Skip to content

Commit e20e73b

Browse files
committed
more updates
1 parent 696d0a2 commit e20e73b

File tree

10 files changed

+191
-181
lines changed

10 files changed

+191
-181
lines changed

src/content/changelog/browser-rendering/2025-04-04-playwright-beta.mdx

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,40 @@ We're excited to share that you can now use Playwright's browser automation [cap
1313
Below is an example of how to use Playwright with Browser Rendering to test a TODO application using assertions:
1414

1515
```ts title="Assertion example"
16-
import { launch, type BrowserWorker } from '@cloudflare/playwright';
17-
import { expect } from '@cloudflare/playwright/test';
16+
import { launch, type BrowserWorker } from "@cloudflare/playwright";
17+
import { expect } from "@cloudflare/playwright/test";
1818

1919
interface Env {
20-
MYBROWSER: BrowserWorker;
20+
MYBROWSER: BrowserWorker;
2121
}
2222

2323
export default {
24-
async fetch(request: Request, env: Env) {
25-
26-
const browser = await launch(env.MYBROWSER);
27-
const page = await browser.newPage();
28-
29-
await page.goto('https://demo.playwright.dev/todomvc');
30-
31-
const TODO_ITEMS = [
32-
'buy some cheese',
33-
'feed the cat',
34-
'book a doctors appointment'
35-
];
36-
37-
const newTodo = page.getByPlaceholder('What needs to be done?');
38-
for (const item of TODO_ITEMS) {
39-
await newTodo.fill(item);
40-
await newTodo.press('Enter');
41-
}
42-
43-
await expect(page.getByTestId('todo-title')).toHaveCount(TODO_ITEMS.length);
44-
45-
await Promise.all(TODO_ITEMS.map(
46-
(value, index) => expect(page.getByTestId('todo-title').nth(index)).toHaveText(value)
47-
));
48-
},
24+
async fetch(request: Request, env: Env) {
25+
const browser = await launch(env.MYBROWSER);
26+
const page = await browser.newPage();
27+
28+
await page.goto("https://demo.playwright.dev/todomvc");
29+
30+
const TODO_ITEMS = [
31+
"buy some cheese",
32+
"feed the cat",
33+
"book a doctors appointment",
34+
];
35+
36+
const newTodo = page.getByPlaceholder("What needs to be done?");
37+
for (const item of TODO_ITEMS) {
38+
await newTodo.fill(item);
39+
await newTodo.press("Enter");
40+
}
41+
42+
await expect(page.getByTestId("todo-title")).toHaveCount(TODO_ITEMS.length);
43+
44+
await Promise.all(
45+
TODO_ITEMS.map((value, index) =>
46+
expect(page.getByTestId("todo-title").nth(index)).toHaveText(value),
47+
),
48+
);
49+
},
4950
};
5051
```
5152

src/content/docs/ai-gateway/integrations/worker-binding-methods.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ binding = "AI"
2525

2626
This configuration sets up the AI binding accessible in your Worker code as `env.AI`.
2727

28+
<Render file="wrangler-typegen" />
29+
2830
## 2. Basic Usage with Workers AI + Gateway
2931

3032
To perform an inference task using Workers AI and an AI Gateway, you can use the following code:
@@ -78,7 +80,7 @@ gateway.patchLog("my-log-id", {
7880

7981
### 3.2. `getLog`: Read Log Details
8082

81-
The `getLog` method retrieves details of a specific log ID. It returns an object of type `Promise<AiGatewayLog>`. If this type is missing, ensure you have run [`wrangler types`](/workers/languages/typescript/#generate-types)
83+
The `getLog` method retrieves details of a specific log ID. It returns an object of type `Promise<AiGatewayLog>`. If this type is missing, ensure you have run [`wrangler types`](/workers/languages/typescript/#generate-types).
8284

8385
```typescript
8486
const log = await gateway.getLog("my-log-id");

0 commit comments

Comments
 (0)