diff --git a/extension-new/COMPARISON.md b/extension-new/COMPARISON.md index e832db3..ab88566 100644 --- a/extension-new/COMPARISON.md +++ b/extension-new/COMPARISON.md @@ -44,7 +44,7 @@ class ExtensionConnection { ### New (Functional):** ```typescript -export async function startRelayServer({ port = 9988 }) { +export async function startRelayServer({ port = 19988 }) { const targetsRegistry = createTargetsRegistry() let playwrightWs: WSContext | null = null let extensionWs: WSContext | null = null @@ -230,13 +230,13 @@ The new implementation is a drop-in replacement: **Old:** ```typescript -const httpServer = await startHttpServer({ port: 9988 }) +const httpServer = await startHttpServer({ port: 19988 }) const cdpRelayServer = new CDPRelayServer(httpServer) cdpRelayServer.stop() ``` **New:** ```typescript -const server = await startRelayServer({ port: 9988 }) +const server = await startRelayServer({ port: 19988 }) server.close() ``` diff --git a/extension-new/MIGRATION.md b/extension-new/MIGRATION.md index 2136cb3..f5986c4 100644 --- a/extension-new/MIGRATION.md +++ b/extension-new/MIGRATION.md @@ -28,7 +28,7 @@ cdpRelayServer.stop() **After:** ```typescript -const server = await startRelayServer({ port: 9988 }) +const server = await startRelayServer({ port: 19988 }) // Simple object API server.close() ``` diff --git a/extension-new/README.md b/extension-new/README.md index 654aeb3..e159c43 100644 --- a/extension-new/README.md +++ b/extension-new/README.md @@ -49,12 +49,12 @@ Tab → chrome.debugger → Extension → /extension → /cdp → Playwright **Clean API:** ```typescript -const server = await startRelayServer({ port: 9988 }) +const server = await startRelayServer({ port: 19988 }) // Returns: // { -// cdpEndpoint: 'ws://localhost:9988/cdp', -// extensionEndpoint: 'ws://localhost:9988/extension', +// cdpEndpoint: 'ws://localhost:19988/cdp', +// extensionEndpoint: 'ws://localhost:19988/extension', // close: () => void // } @@ -67,7 +67,7 @@ server.close() ```typescript import { startRelayServer } from './relay-server.js' -const server = await startRelayServer({ port: 9988 }) +const server = await startRelayServer({ port: 19988 }) console.log('Extension endpoint:', server.extensionEndpoint) console.log('CDP endpoint:', server.cdpEndpoint) diff --git a/extension-playwright/icons/SolarCursorSquareBold.png b/extension-playwright/icons/SolarCursorSquareBold.png new file mode 100644 index 0000000..4d89fcc Binary files /dev/null and b/extension-playwright/icons/SolarCursorSquareBold.png differ diff --git a/extension-playwright/icons/icon-128.png b/extension-playwright/icons/icon-128.png index c4bc8b0..441d12d 100644 Binary files a/extension-playwright/icons/icon-128.png and b/extension-playwright/icons/icon-128.png differ diff --git a/extension-playwright/icons/icon-16.png b/extension-playwright/icons/icon-16.png index 0bab712..96ddb33 100644 Binary files a/extension-playwright/icons/icon-16.png and b/extension-playwright/icons/icon-16.png differ diff --git a/extension-playwright/icons/icon-32.png b/extension-playwright/icons/icon-32.png index 1f9a8cc..bccb4ef 100644 Binary files a/extension-playwright/icons/icon-32.png and b/extension-playwright/icons/icon-32.png differ diff --git a/extension-playwright/icons/icon-48.png b/extension-playwright/icons/icon-48.png index ac23ef0..ed3089a 100644 Binary files a/extension-playwright/icons/icon-48.png and b/extension-playwright/icons/icon-48.png differ diff --git a/extension-playwright/icons/icon-gray-128.png b/extension-playwright/icons/icon-gray-128.png index b891811..daeea86 100644 Binary files a/extension-playwright/icons/icon-gray-128.png and b/extension-playwright/icons/icon-gray-128.png differ diff --git a/extension-playwright/icons/icon-gray-16.png b/extension-playwright/icons/icon-gray-16.png index 817a832..b4d6f39 100644 Binary files a/extension-playwright/icons/icon-gray-16.png and b/extension-playwright/icons/icon-gray-16.png differ diff --git a/extension-playwright/icons/icon-gray-32.png b/extension-playwright/icons/icon-gray-32.png index 4c63372..14989ff 100644 Binary files a/extension-playwright/icons/icon-gray-32.png and b/extension-playwright/icons/icon-gray-32.png differ diff --git a/extension-playwright/icons/icon-gray-48.png b/extension-playwright/icons/icon-gray-48.png index 6720fe5..ebb0639 100644 Binary files a/extension-playwright/icons/icon-gray-48.png and b/extension-playwright/icons/icon-gray-48.png differ diff --git a/extension-playwright/icons/icon-green-128.png b/extension-playwright/icons/icon-green-128.png deleted file mode 100644 index f877d08..0000000 Binary files a/extension-playwright/icons/icon-green-128.png and /dev/null differ diff --git a/extension-playwright/icons/icon-green-16.png b/extension-playwright/icons/icon-green-16.png deleted file mode 100644 index 9d412f5..0000000 Binary files a/extension-playwright/icons/icon-green-16.png and /dev/null differ diff --git a/extension-playwright/icons/icon-green-32.png b/extension-playwright/icons/icon-green-32.png deleted file mode 100644 index ec35b3e..0000000 Binary files a/extension-playwright/icons/icon-green-32.png and /dev/null differ diff --git a/extension-playwright/icons/icon-green-48.png b/extension-playwright/icons/icon-green-48.png deleted file mode 100644 index eef19db..0000000 Binary files a/extension-playwright/icons/icon-green-48.png and /dev/null differ diff --git a/extension-playwright/src/background.ts b/extension-playwright/src/background.ts index 7ba5d31..df0802e 100644 --- a/extension-playwright/src/background.ts +++ b/extension-playwright/src/background.ts @@ -2,7 +2,7 @@ import { RelayConnection, debugLog } from './relayConnection' import { create } from 'zustand' // Relay URL - fixed port for MCP bridge -const RELAY_URL = 'ws://localhost:9988/extension' +const RELAY_URL = 'ws://localhost:19988/extension' type ConnectionState = 'disconnected' | 'reconnecting' | 'connected' | 'error' @@ -42,10 +42,10 @@ chrome.runtime.onInstalled.addListener((details) => { const icons = { connected: { path: { - '16': '/icons/icon-green-16.png', - '32': '/icons/icon-green-32.png', - '48': '/icons/icon-green-48.png', - '128': '/icons/icon-green-128.png', + '16': '/icons/icon-16.png', + '32': '/icons/icon-32.png', + '48': '/icons/icon-48.png', + '128': '/icons/icon-128.png', }, title: 'Connected - Click to disconnect', badgeText: '', @@ -122,12 +122,12 @@ async function ensureConnection(): Promise { } debugLog('No existing connection, creating new relay connection') - debugLog('Waiting for server at http://localhost:9988...') + debugLog('Waiting for server at http://localhost:19988...') useExtensionStore.setState({ connectionState: 'reconnecting' }) while (true) { try { - await fetch('http://localhost:9988', { method: 'HEAD' }) + await fetch('http://localhost:19988', { method: 'HEAD' }) debugLog('Server is available') break } catch (error: any) { diff --git a/multiple-playwrights.md b/multiple-playwrights.md index f4d3680..7ede2e6 100644 --- a/multiple-playwrights.md +++ b/multiple-playwrights.md @@ -23,9 +23,9 @@ The relay server acts as a bridge between: Each Playwright client must connect with a unique identifier in the connection path: ``` -ws://localhost:9988/cdp/client-123 -ws://localhost:9988/cdp/automation-bot-1 -ws://localhost:9988/cdp/test-runner-42 +ws://localhost:19988/cdp/client-123 +ws://localhost:19988/cdp/automation-bot-1 +ws://localhost:19988/cdp/test-runner-42 ``` If no client ID is provided in the path, the connection is rejected. This ensures every client can be uniquely identified and tracked. @@ -110,4 +110,4 @@ Multiple developers can connect their own Playwright instances to debug differen - Each tab can only be controlled by one client at a time - Session ownership is "sticky" - once claimed, it remains until client disconnect -- No built-in session sharing or handoff mechanism (by design, for safety) \ No newline at end of file +- No built-in session sharing or handoff mechanism (by design, for safety) diff --git a/playwriter/scripts/extension-connect.ts b/playwriter/scripts/extension-connect.ts index 79cd967..b787a3c 100644 --- a/playwriter/scripts/extension-connect.ts +++ b/playwriter/scripts/extension-connect.ts @@ -1,7 +1,7 @@ import playwright from 'playwright-core' async function main() { - const cdpEndpoint = `ws://localhost:9988/cdp/${Date.now()}` + const cdpEndpoint = `ws://localhost:19988/cdp/${Date.now()}` const browser = await playwright.chromium.connectOverCDP(cdpEndpoint, { }) diff --git a/playwriter/scripts/extension-new-page.ts b/playwriter/scripts/extension-new-page.ts index ccdc568..61e8ba9 100644 --- a/playwriter/scripts/extension-new-page.ts +++ b/playwriter/scripts/extension-new-page.ts @@ -1,7 +1,7 @@ import playwright from 'playwright-core' async function main() { - const cdpEndpoint = `ws://localhost:9988/cdp/${Date.now()}` + const cdpEndpoint = `ws://localhost:19988/cdp/${Date.now()}` const browser = await playwright.chromium.connectOverCDP(cdpEndpoint) const contexts = browser.contexts() diff --git a/playwriter/scripts/extension-server.ts b/playwriter/scripts/extension-server.ts index a18756f..72f5cd7 100644 --- a/playwriter/scripts/extension-server.ts +++ b/playwriter/scripts/extension-server.ts @@ -1,7 +1,7 @@ import { startRelayServer } from '../src/extension/cdp-relay.js' async function main() { - const server = await startRelayServer({ port: 9988 }) + const server = await startRelayServer({ port: 19988 }) console.log('Server running. Press Ctrl+C to stop.') diff --git a/playwriter/src/extension/cdp-relay.ts b/playwriter/src/extension/cdp-relay.ts index a9f322e..82db041 100644 --- a/playwriter/src/extension/cdp-relay.ts +++ b/playwriter/src/extension/cdp-relay.ts @@ -20,7 +20,7 @@ type PlaywrightClient = { ws: WSContext } -export async function startRelayServer({ port = 9988, logger = console }: { port?: number; logger?: { log(...args: any[]): void; error(...args: any[]): void } } = {}) { +export async function startRelayServer({ port = 19988, logger = console }: { port?: number; logger?: { log(...args: any[]): void; error(...args: any[]): void } } = {}) { const connectedTargets = new Map() const playwrightClients = new Map() diff --git a/playwriter/src/mcp.test.ts b/playwriter/src/mcp.test.ts index d6c1a5c..ce6b73c 100644 --- a/playwriter/src/mcp.test.ts +++ b/playwriter/src/mcp.test.ts @@ -31,7 +31,7 @@ describe('MCP Server Tests', () => { let cleanup: (() => Promise) | null = null beforeAll(async () => { - await killProcessOnPort(9988) + await killProcessOnPort(19988) const result = await createMCPClient() client = result.client cleanup = result.cleanup diff --git a/playwriter/src/mcp.ts b/playwriter/src/mcp.ts index 99b0b6f..9b3f84c 100644 --- a/playwriter/src/mcp.ts +++ b/playwriter/src/mcp.ts @@ -22,7 +22,7 @@ const state: ToolState = { browser: null, } -const RELAY_PORT = 9988 +const RELAY_PORT = 19988 async function isPortTaken(port: number): Promise { try { diff --git a/playwriter/src/start-relay-server.ts b/playwriter/src/start-relay-server.ts index 927bb71..a77f420 100644 --- a/playwriter/src/start-relay-server.ts +++ b/playwriter/src/start-relay-server.ts @@ -9,7 +9,7 @@ const logFilePath = path.join(__dirname, '..', 'relay-server.log') fs.writeFileSync(logFilePath, '') const log = (...args: any[]) => { - const message = args.map(arg => + const message = args.map(arg => typeof arg === 'string' ? arg : JSON.stringify(arg) ).join(' ') fs.appendFileSync(logFilePath, message + '\n') @@ -20,7 +20,7 @@ const logger = { error: log } -export async function startServer({ port = 9988 }: { port?: number } = {}) { +export async function startServer({ port = 19988 }: { port?: number } = {}) { const server = await startRelayServer({ port, logger }) console.log('CDP Relay Server running. Press Ctrl+C to stop.')