diff --git a/packages/playwright-core/src/cli/cli.ts b/packages/playwright-core/src/cli/cli.ts index f507c679f2..649dfb4dda 100755 --- a/packages/playwright-core/src/cli/cli.ts +++ b/packages/playwright-core/src/cli/cli.ts @@ -252,8 +252,9 @@ program .command('experimental-grid-agent', { hidden: true }) .requiredOption('--agent-id ', 'agent ID') .requiredOption('--grid-url ', 'grid URL') + .option('--run-id ', 'Workflow run_id') .action(function(options) { - launchGridAgent(options.agentId, options.gridUrl); + launchGridAgent(options.agentId, options.gridUrl, options.runId); }); program diff --git a/packages/playwright-core/src/grid/gridAgent.ts b/packages/playwright-core/src/grid/gridAgent.ts index 5fc830a16c..53c02b5144 100644 --- a/packages/playwright-core/src/grid/gridAgent.ts +++ b/packages/playwright-core/src/grid/gridAgent.ts @@ -19,12 +19,14 @@ import WebSocket from 'ws'; import { fork } from 'child_process'; import { getPlaywrightVersion } from '../common/userAgent'; -export function launchGridAgent(agentId: string, gridURL: string) { +export function launchGridAgent(agentId: string, gridURL: string, runId: string | undefined) { const log = debug(`pw:grid:agent:${agentId}`); log('created'); const params = new URLSearchParams(); params.set('pwVersion', getPlaywrightVersion(true /* majorMinorOnly */)); params.set('agentId', agentId); + if (runId) + params.set('runId', runId); const ws = new WebSocket(gridURL.replace('http://', 'ws://') + `/registerAgent?` + params.toString()); ws.on('message', (message: string) => { log('worker requested ' + message);