chore: generalize status & action as code (#188)
This commit is contained in:
parent
4a19e18999
commit
795a9d578a
12 changed files with 187 additions and 88 deletions
|
|
@ -78,13 +78,16 @@ const resize: ToolFactory = captureSnapshot => ({
|
|||
const validatedParams = resizeSchema.parse(params);
|
||||
|
||||
const tab = context.currentTab();
|
||||
return await tab.run(
|
||||
tab => tab.page.setViewportSize({ width: validatedParams.width, height: validatedParams.height }),
|
||||
{
|
||||
status: `Resized browser window`,
|
||||
captureSnapshot,
|
||||
}
|
||||
);
|
||||
return await tab.run(async tab => {
|
||||
await tab.page.setViewportSize({ width: validatedParams.width, height: validatedParams.height });
|
||||
const code = [
|
||||
`// Resize browser window to ${validatedParams.width}x${validatedParams.height}`,
|
||||
`await page.setViewportSize({ width: ${validatedParams.width}, height: ${validatedParams.height} });`
|
||||
];
|
||||
return { code };
|
||||
}, {
|
||||
captureSnapshot,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue