Increase default execution timeout from 5s to 10s
This commit is contained in:
@@ -1065,7 +1065,7 @@ export async function startPlayWriterCDPRelayServer({ port = 19988, host = '127.
|
||||
app.post('/cli/execute', async (c) => {
|
||||
try {
|
||||
const body = await c.req.json() as { sessionId: string; code: string; timeout?: number; cwd?: string }
|
||||
const { sessionId, code, timeout = 5000, cwd } = body
|
||||
const { sessionId, code, timeout = 10000, cwd } = body
|
||||
|
||||
if (!sessionId || !code) {
|
||||
return c.json({ error: 'sessionId and code are required' }, 400)
|
||||
|
||||
@@ -14,13 +14,13 @@ cli
|
||||
.option('--token <token>', 'Authentication token (or use PLAYWRITER_TOKEN env var)')
|
||||
.option('-s, --session <name>', 'Session ID (required for -e, get one with `playwriter session new`)')
|
||||
.option('-e, --eval <code>', 'Execute JavaScript code and exit, read https://playwriter.dev/SKILL.md for usage')
|
||||
.option('--timeout <ms>', 'Execution timeout in milliseconds', { default: 5000 })
|
||||
.option('--timeout <ms>', 'Execution timeout in milliseconds', { default: 10000 })
|
||||
.action(async (options: { host?: string; token?: string; eval?: string; timeout?: number; session?: string }) => {
|
||||
// If -e flag is provided, execute code via relay server
|
||||
if (options.eval) {
|
||||
await executeCode({
|
||||
code: options.eval,
|
||||
timeout: options.timeout || 5000,
|
||||
timeout: options.timeout || 10000,
|
||||
sessionId: options.session,
|
||||
host: options.host,
|
||||
token: options.token,
|
||||
|
||||
@@ -291,7 +291,7 @@ export class PlaywrightExecutor {
|
||||
return { browser, page }
|
||||
}
|
||||
|
||||
private async getCurrentPage(timeout = 5000): Promise<Page> {
|
||||
private async getCurrentPage(timeout = 10000): Promise<Page> {
|
||||
if (this.page && !this.page.isClosed()) {
|
||||
return this.page
|
||||
}
|
||||
@@ -365,7 +365,7 @@ export class PlaywrightExecutor {
|
||||
return { page, context }
|
||||
}
|
||||
|
||||
async execute(code: string, timeout = 5000): Promise<ExecuteResult> {
|
||||
async execute(code: string, timeout = 10000): Promise<ExecuteResult> {
|
||||
const consoleLogs: Array<{ method: string; args: any[] }> = []
|
||||
|
||||
const formatConsoleLogs = (logs: Array<{ method: string; args: any[] }>, prefix = 'Console output') => {
|
||||
|
||||
@@ -179,7 +179,7 @@ server.tool(
|
||||
.describe(
|
||||
'js playwright code, has {page, state, context} in scope. Should be one line, using ; to execute multiple statements. you MUST call execute multiple times instead of writing complex scripts in a single tool call.',
|
||||
),
|
||||
timeout: z.number().default(5000).describe('Timeout in milliseconds for code execution (default: 5000ms)'),
|
||||
timeout: z.number().default(10000).describe('Timeout in milliseconds for code execution (default: 10000ms)'),
|
||||
},
|
||||
async ({ code, timeout }) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user