@ricsam/isolate-playwright 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
4
  "sourcesContent": [
5
- "import ivm from \"isolated-vm\";\nimport type { Page, Locator as PlaywrightLocator } from \"playwright\";\n\n// ============================================================================\n// Types and Interfaces (Pattern 2, 3)\n// ============================================================================\n\nexport interface NetworkRequestInfo {\n url: string;\n method: string;\n headers: Record<string, string>;\n postData?: string;\n resourceType: string;\n timestamp: number;\n}\n\nexport interface NetworkResponseInfo {\n url: string;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n timestamp: number;\n}\n\nexport interface ConsoleLogEntry {\n level: string;\n args: string[];\n timestamp: number;\n}\n\nexport interface PlaywrightOptions {\n page: Page;\n timeout?: number;\n baseUrl?: string;\n onConsoleLog?: (level: string, ...args: unknown[]) => void;\n onNetworkRequest?: (info: NetworkRequestInfo) => void;\n onNetworkResponse?: (info: NetworkResponseInfo) => void;\n}\n\nexport interface PlaywrightHandle {\n dispose(): void;\n getConsoleLogs(): ConsoleLogEntry[];\n getNetworkRequests(): NetworkRequestInfo[];\n getNetworkResponses(): NetworkResponseInfo[];\n clearCollected(): void;\n}\n\nexport interface TestResult {\n name: string;\n passed: boolean;\n error?: string;\n duration: number;\n}\n\nexport interface PlaywrightExecutionResult {\n passed: number;\n failed: number;\n total: number;\n results: TestResult[];\n}\n\n// ============================================================================\n// Error Encoding Helpers (Pattern 8)\n// ============================================================================\n\nconst KNOWN_ERROR_TYPES = [\n \"TypeError\",\n \"RangeError\",\n \"SyntaxError\",\n \"ReferenceError\",\n \"URIError\",\n \"EvalError\",\n \"TimeoutError\",\n] as const;\n\nfunction getErrorConstructorName(errorType: string): string {\n return (KNOWN_ERROR_TYPES as readonly string[]).includes(errorType)\n ? errorType\n : \"Error\";\n}\n\nfunction encodeErrorForTransfer(err: Error): Error {\n const errorType = getErrorConstructorName(err.name);\n return new Error(`[${errorType}]${err.message}`);\n}\n\nconst DECODE_ERROR_JS = `\nfunction __decodeError(err) {\n if (!(err instanceof Error)) return err;\n const match = err.message.match(/^\\\\[(TypeError|RangeError|SyntaxError|ReferenceError|URIError|EvalError|TimeoutError|Error)\\\\](.*)$/);\n if (match) {\n const ErrorType = globalThis[match[1]] || Error;\n return new ErrorType(match[2]);\n }\n return err;\n}\n`.trim();\n\n// ============================================================================\n// Helper: Get locator from selector info\n// ============================================================================\n\nfunction getLocator(\n page: Page,\n selectorType: string,\n selectorValue: string,\n roleOptionsJson: string | null\n): PlaywrightLocator {\n switch (selectorType) {\n case \"css\":\n return page.locator(selectorValue);\n case \"role\": {\n const roleOptions = roleOptionsJson ? JSON.parse(roleOptionsJson) : undefined;\n return page.getByRole(selectorValue as Parameters<Page[\"getByRole\"]>[0], roleOptions);\n }\n case \"text\":\n return page.getByText(selectorValue);\n case \"label\":\n return page.getByLabel(selectorValue);\n case \"placeholder\":\n return page.getByPlaceholder(selectorValue);\n case \"testId\":\n return page.getByTestId(selectorValue);\n default:\n return page.locator(selectorValue);\n }\n}\n\n// ============================================================================\n// Setup Playwright (Pattern 2)\n// ============================================================================\n\nexport async function setupPlaywright(\n context: ivm.Context,\n options: PlaywrightOptions\n): Promise<PlaywrightHandle> {\n const { page, timeout = 30000, baseUrl } = options;\n\n // State for collected data\n const consoleLogs: ConsoleLogEntry[] = [];\n const networkRequests: NetworkRequestInfo[] = [];\n const networkResponses: NetworkResponseInfo[] = [];\n\n const global = context.global;\n\n // ========================================================================\n // Event Capture\n // ========================================================================\n\n const requestHandler = (request: import(\"playwright\").Request) => {\n const info: NetworkRequestInfo = {\n url: request.url(),\n method: request.method(),\n headers: request.headers(),\n postData: request.postData() ?? undefined,\n resourceType: request.resourceType(),\n timestamp: Date.now(),\n };\n networkRequests.push(info);\n options.onNetworkRequest?.(info);\n };\n\n const responseHandler = (response: import(\"playwright\").Response) => {\n const info: NetworkResponseInfo = {\n url: response.url(),\n status: response.status(),\n statusText: response.statusText(),\n headers: response.headers(),\n timestamp: Date.now(),\n };\n networkResponses.push(info);\n options.onNetworkResponse?.(info);\n };\n\n const consoleHandler = (msg: import(\"playwright\").ConsoleMessage) => {\n const entry: ConsoleLogEntry = {\n level: msg.type(),\n args: msg.args().map((arg) => String(arg)),\n timestamp: Date.now(),\n };\n consoleLogs.push(entry);\n options.onConsoleLog?.(entry.level, ...entry.args);\n };\n\n page.on(\"request\", requestHandler);\n page.on(\"response\", responseHandler);\n page.on(\"console\", consoleHandler);\n\n // ========================================================================\n // Page Operations - Async References (Pattern 6, 10)\n // ========================================================================\n\n // goto\n global.setSync(\n \"__Playwright_goto_ref\",\n new ivm.Reference(async (url: string, waitUntil?: string) => {\n try {\n const targetUrl = baseUrl && !url.startsWith(\"http\") ? `${baseUrl}${url}` : url;\n await page.goto(targetUrl, {\n timeout,\n waitUntil: (waitUntil as \"load\" | \"domcontentloaded\" | \"networkidle\") ?? \"load\",\n });\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n })\n );\n\n // reload\n global.setSync(\n \"__Playwright_reload_ref\",\n new ivm.Reference(async () => {\n try {\n await page.reload({ timeout });\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n })\n );\n\n // url (sync callback)\n global.setSync(\n \"__Playwright_url\",\n new ivm.Callback(() => {\n return page.url();\n })\n );\n\n // title\n global.setSync(\n \"__Playwright_title_ref\",\n new ivm.Reference(async () => {\n try {\n return await page.title();\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n })\n );\n\n // content\n global.setSync(\n \"__Playwright_content_ref\",\n new ivm.Reference(async () => {\n try {\n return await page.content();\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n })\n );\n\n // waitForSelector\n global.setSync(\n \"__Playwright_waitForSelector_ref\",\n new ivm.Reference(async (selector: string, optionsJson?: string) => {\n try {\n const opts = optionsJson ? JSON.parse(optionsJson) : {};\n await page.waitForSelector(selector, { timeout, ...opts });\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n })\n );\n\n // waitForTimeout\n global.setSync(\n \"__Playwright_waitForTimeout_ref\",\n new ivm.Reference(async (ms: number) => {\n try {\n await page.waitForTimeout(ms);\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n })\n );\n\n // waitForLoadState\n global.setSync(\n \"__Playwright_waitForLoadState_ref\",\n new ivm.Reference(async (state?: string) => {\n try {\n await page.waitForLoadState(\n (state as \"load\" | \"domcontentloaded\" | \"networkidle\") ?? \"load\",\n { timeout }\n );\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n })\n );\n\n // evaluate\n global.setSync(\n \"__Playwright_evaluate_ref\",\n new ivm.Reference(async (script: string) => {\n try {\n const result = await page.evaluate(script);\n // Only return serializable values\n return JSON.stringify(result);\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n })\n );\n\n // ========================================================================\n // Locator Operations (Pattern 14 - JSON serialization)\n // ========================================================================\n\n global.setSync(\n \"__Playwright_locatorAction_ref\",\n new ivm.Reference(\n async (\n selectorType: string,\n selectorValue: string,\n roleOptionsJson: string | null,\n action: string,\n actionArg: string | null\n ) => {\n try {\n const locator = getLocator(page, selectorType, selectorValue, roleOptionsJson);\n\n switch (action) {\n case \"click\":\n await locator.click({ timeout });\n return null;\n case \"dblclick\":\n await locator.dblclick({ timeout });\n return null;\n case \"fill\":\n await locator.fill(actionArg ?? \"\", { timeout });\n return null;\n case \"type\":\n await locator.pressSequentially(actionArg ?? \"\", { timeout });\n return null;\n case \"check\":\n await locator.check({ timeout });\n return null;\n case \"uncheck\":\n await locator.uncheck({ timeout });\n return null;\n case \"selectOption\":\n await locator.selectOption(actionArg ?? \"\", { timeout });\n return null;\n case \"clear\":\n await locator.clear({ timeout });\n return null;\n case \"press\":\n await locator.press(actionArg ?? \"\", { timeout });\n return null;\n case \"hover\":\n await locator.hover({ timeout });\n return null;\n case \"focus\":\n await locator.focus({ timeout });\n return null;\n case \"getText\":\n return await locator.textContent({ timeout });\n case \"getValue\":\n return await locator.inputValue({ timeout });\n case \"isVisible\":\n return await locator.isVisible();\n case \"isEnabled\":\n return await locator.isEnabled();\n case \"isChecked\":\n return await locator.isChecked();\n case \"count\":\n return await locator.count();\n default:\n throw new Error(`Unknown action: ${action}`);\n }\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n }\n )\n );\n\n // ========================================================================\n // Expect Operations\n // ========================================================================\n\n global.setSync(\n \"__Playwright_expectVisible_ref\",\n new ivm.Reference(\n async (\n selectorType: string,\n selectorValue: string,\n roleOptionsJson: string | null,\n not: boolean\n ) => {\n try {\n const locator = getLocator(page, selectorType, selectorValue, roleOptionsJson);\n const isVisible = await locator.isVisible();\n if (not) {\n if (isVisible) {\n throw new Error(`Expected element to not be visible, but it was visible`);\n }\n } else {\n if (!isVisible) {\n throw new Error(`Expected element to be visible, but it was not`);\n }\n }\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n }\n )\n );\n\n global.setSync(\n \"__Playwright_expectText_ref\",\n new ivm.Reference(\n async (\n selectorType: string,\n selectorValue: string,\n roleOptionsJson: string | null,\n expected: string,\n not: boolean\n ) => {\n try {\n const locator = getLocator(page, selectorType, selectorValue, roleOptionsJson);\n const text = await locator.textContent({ timeout });\n const matches = text?.includes(expected) ?? false;\n if (not) {\n if (matches) {\n throw new Error(`Expected text to not contain \"${expected}\", but got \"${text}\"`);\n }\n } else {\n if (!matches) {\n throw new Error(`Expected text to contain \"${expected}\", but got \"${text}\"`);\n }\n }\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n }\n )\n );\n\n global.setSync(\n \"__Playwright_expectValue_ref\",\n new ivm.Reference(\n async (\n selectorType: string,\n selectorValue: string,\n roleOptionsJson: string | null,\n expected: string,\n not: boolean\n ) => {\n try {\n const locator = getLocator(page, selectorType, selectorValue, roleOptionsJson);\n const value = await locator.inputValue({ timeout });\n const matches = value === expected;\n if (not) {\n if (matches) {\n throw new Error(`Expected value to not be \"${expected}\", but it was`);\n }\n } else {\n if (!matches) {\n throw new Error(`Expected value to be \"${expected}\", but got \"${value}\"`);\n }\n }\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n }\n )\n );\n\n global.setSync(\n \"__Playwright_expectEnabled_ref\",\n new ivm.Reference(\n async (\n selectorType: string,\n selectorValue: string,\n roleOptionsJson: string | null,\n not: boolean\n ) => {\n try {\n const locator = getLocator(page, selectorType, selectorValue, roleOptionsJson);\n const isEnabled = await locator.isEnabled();\n if (not) {\n if (isEnabled) {\n throw new Error(`Expected element to be disabled, but it was enabled`);\n }\n } else {\n if (!isEnabled) {\n throw new Error(`Expected element to be enabled, but it was disabled`);\n }\n }\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n }\n )\n );\n\n global.setSync(\n \"__Playwright_expectChecked_ref\",\n new ivm.Reference(\n async (\n selectorType: string,\n selectorValue: string,\n roleOptionsJson: string | null,\n not: boolean\n ) => {\n try {\n const locator = getLocator(page, selectorType, selectorValue, roleOptionsJson);\n const isChecked = await locator.isChecked();\n if (not) {\n if (isChecked) {\n throw new Error(`Expected element to not be checked, but it was checked`);\n }\n } else {\n if (!isChecked) {\n throw new Error(`Expected element to be checked, but it was not`);\n }\n }\n } catch (err) {\n if (err instanceof Error) {\n throw encodeErrorForTransfer(err);\n }\n throw err;\n }\n }\n )\n );\n\n // ========================================================================\n // Injected JavaScript (Pattern 7, 21)\n // ========================================================================\n\n // Error decoder helper\n context.evalSync(DECODE_ERROR_JS);\n\n // Test framework (Pattern 21)\n context.evalSync(`\n(function() {\n const tests = [];\n globalThis.test = (name, fn) => tests.push({ name, fn });\n\n globalThis.__runPlaywrightTests = async () => {\n const results = [];\n for (const t of tests) {\n const start = Date.now();\n try {\n await t.fn();\n results.push({ name: t.name, passed: true, duration: Date.now() - start });\n } catch (err) {\n results.push({ name: t.name, passed: false, error: err.message, duration: Date.now() - start });\n }\n }\n const passed = results.filter(r => r.passed).length;\n const failed = results.filter(r => !r.passed).length;\n return JSON.stringify({ passed, failed, total: results.length, results });\n };\n\n globalThis.__resetPlaywrightTests = () => { tests.length = 0; };\n})();\n`);\n\n // Page object\n context.evalSync(`\n(function() {\n globalThis.page = {\n async goto(url, options) {\n try {\n return __Playwright_goto_ref.applySyncPromise(undefined, [url, options?.waitUntil || null]);\n } catch (err) { throw __decodeError(err); }\n },\n async reload() {\n try {\n return __Playwright_reload_ref.applySyncPromise(undefined, []);\n } catch (err) { throw __decodeError(err); }\n },\n url() { return __Playwright_url(); },\n async title() {\n try {\n return __Playwright_title_ref.applySyncPromise(undefined, []);\n } catch (err) { throw __decodeError(err); }\n },\n async content() {\n try {\n return __Playwright_content_ref.applySyncPromise(undefined, []);\n } catch (err) { throw __decodeError(err); }\n },\n async waitForSelector(selector, options) {\n try {\n return __Playwright_waitForSelector_ref.applySyncPromise(undefined, [selector, options ? JSON.stringify(options) : null]);\n } catch (err) { throw __decodeError(err); }\n },\n async waitForTimeout(ms) {\n try {\n return __Playwright_waitForTimeout_ref.applySyncPromise(undefined, [ms]);\n } catch (err) { throw __decodeError(err); }\n },\n async waitForLoadState(state) {\n try {\n return __Playwright_waitForLoadState_ref.applySyncPromise(undefined, [state]);\n } catch (err) { throw __decodeError(err); }\n },\n async evaluate(script) {\n try {\n const resultJson = __Playwright_evaluate_ref.applySyncPromise(undefined, [script]);\n return resultJson ? JSON.parse(resultJson) : undefined;\n } catch (err) { throw __decodeError(err); }\n },\n locator(selector) { return new Locator(\"css\", selector, null); },\n getByRole(role, options) { return new Locator(\"role\", role, options ? JSON.stringify(options) : null); },\n getByText(text) { return new Locator(\"text\", text, null); },\n getByLabel(label) { return new Locator(\"label\", label, null); },\n getByPlaceholder(p) { return new Locator(\"placeholder\", p, null); },\n getByTestId(id) { return new Locator(\"testId\", id, null); },\n };\n})();\n`);\n\n // Locator class (Pure JS with private fields - stays in isolate)\n context.evalSync(`\n(function() {\n class Locator {\n #type; #value; #options;\n constructor(type, value, options) {\n this.#type = type;\n this.#value = value;\n this.#options = options;\n }\n\n _getInfo() { return [this.#type, this.#value, this.#options]; }\n\n async click() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"click\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async dblclick() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"dblclick\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async fill(text) {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"fill\", text]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async type(text) {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"type\", text]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async check() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"check\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async uncheck() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"uncheck\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async selectOption(value) {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"selectOption\", value]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async clear() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"clear\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async press(key) {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"press\", key]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async hover() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"hover\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async focus() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"focus\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async textContent() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"getText\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async inputValue() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"getValue\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async isVisible() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"isVisible\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async isEnabled() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"isEnabled\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async isChecked() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"isChecked\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n\n async count() {\n try {\n return __Playwright_locatorAction_ref.applySyncPromise(undefined, [...this._getInfo(), \"count\", null]);\n } catch (err) { throw __decodeError(err); }\n }\n }\n globalThis.Locator = Locator;\n})();\n`);\n\n // Expect for locators\n context.evalSync(`\n(function() {\n globalThis.expect = (actual) => {\n if (actual instanceof Locator) {\n const info = actual._getInfo();\n return {\n async toBeVisible() {\n try {\n await __Playwright_expectVisible_ref.applySyncPromise(undefined, [...info, false]);\n } catch (err) { throw __decodeError(err); }\n },\n async toContainText(expected) {\n try {\n await __Playwright_expectText_ref.applySyncPromise(undefined, [...info, expected, false]);\n } catch (err) { throw __decodeError(err); }\n },\n async toHaveValue(expected) {\n try {\n await __Playwright_expectValue_ref.applySyncPromise(undefined, [...info, expected, false]);\n } catch (err) { throw __decodeError(err); }\n },\n async toBeEnabled() {\n try {\n await __Playwright_expectEnabled_ref.applySyncPromise(undefined, [...info, false]);\n } catch (err) { throw __decodeError(err); }\n },\n async toBeChecked() {\n try {\n await __Playwright_expectChecked_ref.applySyncPromise(undefined, [...info, false]);\n } catch (err) { throw __decodeError(err); }\n },\n not: {\n async toBeVisible() {\n try {\n await __Playwright_expectVisible_ref.applySyncPromise(undefined, [...info, true]);\n } catch (err) { throw __decodeError(err); }\n },\n async toContainText(expected) {\n try {\n await __Playwright_expectText_ref.applySyncPromise(undefined, [...info, expected, true]);\n } catch (err) { throw __decodeError(err); }\n },\n async toHaveValue(expected) {\n try {\n await __Playwright_expectValue_ref.applySyncPromise(undefined, [...info, expected, true]);\n } catch (err) { throw __decodeError(err); }\n },\n async toBeEnabled() {\n try {\n await __Playwright_expectEnabled_ref.applySyncPromise(undefined, [...info, true]);\n } catch (err) { throw __decodeError(err); }\n },\n async toBeChecked() {\n try {\n await __Playwright_expectChecked_ref.applySyncPromise(undefined, [...info, true]);\n } catch (err) { throw __decodeError(err); }\n },\n },\n };\n }\n // Fallback: basic matchers for primitives\n return {\n toBe(expected) {\n if (actual !== expected) throw new Error(\\`Expected \\${JSON.stringify(actual)} to be \\${JSON.stringify(expected)}\\`);\n },\n toEqual(expected) {\n if (JSON.stringify(actual) !== JSON.stringify(expected)) {\n throw new Error(\\`Expected \\${JSON.stringify(actual)} to equal \\${JSON.stringify(expected)}\\`);\n }\n },\n toBeTruthy() {\n if (!actual) throw new Error(\\`Expected \\${JSON.stringify(actual)} to be truthy\\`);\n },\n toBeFalsy() {\n if (actual) throw new Error(\\`Expected \\${JSON.stringify(actual)} to be falsy\\`);\n },\n toContain(expected) {\n if (typeof actual === 'string' && !actual.includes(expected)) {\n throw new Error(\\`Expected \"\\${actual}\" to contain \"\\${expected}\"\\`);\n }\n if (Array.isArray(actual) && !actual.includes(expected)) {\n throw new Error(\\`Expected array to contain \\${JSON.stringify(expected)}\\`);\n }\n },\n not: {\n toBe(expected) {\n if (actual === expected) throw new Error(\\`Expected \\${JSON.stringify(actual)} to not be \\${JSON.stringify(expected)}\\`);\n },\n toEqual(expected) {\n if (JSON.stringify(actual) === JSON.stringify(expected)) {\n throw new Error(\\`Expected \\${JSON.stringify(actual)} to not equal \\${JSON.stringify(expected)}\\`);\n }\n },\n toBeTruthy() {\n if (actual) throw new Error(\\`Expected \\${JSON.stringify(actual)} to not be truthy\\`);\n },\n toBeFalsy() {\n if (!actual) throw new Error(\\`Expected \\${JSON.stringify(actual)} to not be falsy\\`);\n },\n toContain(expected) {\n if (typeof actual === 'string' && actual.includes(expected)) {\n throw new Error(\\`Expected \"\\${actual}\" to not contain \"\\${expected}\"\\`);\n }\n if (Array.isArray(actual) && actual.includes(expected)) {\n throw new Error(\\`Expected array to not contain \\${JSON.stringify(expected)}\\`);\n }\n },\n },\n };\n };\n})();\n`);\n\n // ========================================================================\n // Return Handle (Pattern 3)\n // ========================================================================\n\n return {\n dispose() {\n page.off(\"request\", requestHandler);\n page.off(\"response\", responseHandler);\n page.off(\"console\", consoleHandler);\n consoleLogs.length = 0;\n networkRequests.length = 0;\n networkResponses.length = 0;\n },\n getConsoleLogs() {\n return [...consoleLogs];\n },\n getNetworkRequests() {\n return [...networkRequests];\n },\n getNetworkResponses() {\n return [...networkResponses];\n },\n clearCollected() {\n consoleLogs.length = 0;\n networkRequests.length = 0;\n networkResponses.length = 0;\n },\n };\n}\n\n// ============================================================================\n// Run Playwright Tests\n// ============================================================================\n\nexport async function runPlaywrightTests(\n context: ivm.Context\n): Promise<PlaywrightExecutionResult> {\n const runTestsRef = context.global.getSync(\"__runPlaywrightTests\", {\n reference: true,\n }) as ivm.Reference<() => Promise<string>>;\n\n const resultJson = await runTestsRef.apply(undefined, [], {\n result: { promise: true },\n });\n\n return JSON.parse(resultJson as string) as PlaywrightExecutionResult;\n}\n\nexport async function resetPlaywrightTests(context: ivm.Context): Promise<void> {\n context.evalSync(\"__resetPlaywrightTests()\");\n}\n"
5
+ "import ivm from \"isolated-vm\";\nimport type { Page, Locator as PlaywrightLocator } from \"playwright\";\nimport type {\n PlaywrightOperation,\n PlaywrightResult,\n PlaywrightEvent,\n} from \"@ricsam/isolate-protocol\";\n\n// Re-export protocol types\nexport type { PlaywrightOperation, PlaywrightResult, PlaywrightEvent } from \"@ricsam/isolate-protocol\";\n\n// ============================================================================\n// Types and Interfaces\n// ============================================================================\n\nexport interface NetworkRequestInfo {\n url: string;\n method: string;\n headers: Record<string, string>;\n postData?: string;\n resourceType: string;\n timestamp: number;\n}\n\nexport interface NetworkResponseInfo {\n url: string;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n timestamp: number;\n}\n\n/**\n * Browser console log entry - logs from the page context (not sandbox).\n */\nexport interface BrowserConsoleLogEntry {\n level: string;\n args: string[];\n timestamp: number;\n}\n\n/**\n * Callback type for handling playwright operations.\n * Used for remote execution where the page lives on the client.\n */\nexport type PlaywrightCallback = (\n op: PlaywrightOperation\n) => Promise<PlaywrightResult>;\n\n/**\n * Options for setting up playwright in an isolate.\n */\nexport interface PlaywrightSetupOptions {\n /** Direct page object (for local use) */\n page?: Page;\n /** Handler callback (for remote use - daemon invokes this) */\n handler?: PlaywrightCallback;\n /** Default timeout for operations */\n timeout?: number;\n /** Base URL for relative navigation */\n baseUrl?: string;\n /** If true, browser console logs are printed to stdout */\n console?: boolean;\n /** Unified event callback for all playwright events */\n onEvent?: (event: PlaywrightEvent) => void;\n}\n\n/**\n * @deprecated Use PlaywrightSetupOptions instead\n */\nexport interface PlaywrightOptions {\n page: Page;\n timeout?: number;\n baseUrl?: string;\n onNetworkRequest?: (info: NetworkRequestInfo) => void;\n onNetworkResponse?: (info: NetworkResponseInfo) => void;\n}\n\nexport interface PlaywrightHandle {\n dispose(): void;\n /** Get browser console logs (from the page, not sandbox) */\n getBrowserConsoleLogs(): BrowserConsoleLogEntry[];\n getNetworkRequests(): NetworkRequestInfo[];\n getNetworkResponses(): NetworkResponseInfo[];\n clearCollected(): void;\n}\n\n// ============================================================================\n// Helper: Get locator from selector info\n// ============================================================================\n\nfunction getLocator(\n page: Page,\n selectorType: string,\n selectorValue: string,\n optionsJson: string | null\n): PlaywrightLocator {\n // Parse options and extract nth if present\n const options = optionsJson ? JSON.parse(optionsJson) : undefined;\n const nthIndex = options?.nth;\n\n // For role selectors, pass options (excluding nth) to getByRole\n const roleOptions = options ? { ...options } : undefined;\n if (roleOptions) {\n delete roleOptions.nth;\n }\n\n let locator: PlaywrightLocator;\n switch (selectorType) {\n case \"css\":\n locator = page.locator(selectorValue);\n break;\n case \"role\":\n locator = page.getByRole(\n selectorValue as Parameters<Page[\"getByRole\"]>[0],\n roleOptions && Object.keys(roleOptions).length > 0 ? roleOptions : undefined\n );\n break;\n case \"text\":\n locator = page.getByText(selectorValue);\n break;\n case \"label\":\n locator = page.getByLabel(selectorValue);\n break;\n case \"placeholder\":\n locator = page.getByPlaceholder(selectorValue);\n break;\n case \"testId\":\n locator = page.getByTestId(selectorValue);\n break;\n default:\n locator = page.locator(selectorValue);\n }\n\n // Apply nth if specified\n if (nthIndex !== undefined) {\n locator = locator.nth(nthIndex);\n }\n\n return locator;\n}\n\n// ============================================================================\n// Helper: Execute locator action\n// ============================================================================\n\nasync function executeLocatorAction(\n locator: PlaywrightLocator,\n action: string,\n actionArg: unknown,\n timeout: number\n): Promise<unknown> {\n switch (action) {\n case \"click\":\n await locator.click({ timeout });\n return null;\n case \"dblclick\":\n await locator.dblclick({ timeout });\n return null;\n case \"fill\":\n await locator.fill(String(actionArg ?? \"\"), { timeout });\n return null;\n case \"type\":\n await locator.pressSequentially(String(actionArg ?? \"\"), { timeout });\n return null;\n case \"check\":\n await locator.check({ timeout });\n return null;\n case \"uncheck\":\n await locator.uncheck({ timeout });\n return null;\n case \"selectOption\":\n await locator.selectOption(String(actionArg ?? \"\"), { timeout });\n return null;\n case \"clear\":\n await locator.clear({ timeout });\n return null;\n case \"press\":\n await locator.press(String(actionArg ?? \"\"), { timeout });\n return null;\n case \"hover\":\n await locator.hover({ timeout });\n return null;\n case \"focus\":\n await locator.focus({ timeout });\n return null;\n case \"getText\":\n return await locator.textContent({ timeout });\n case \"getValue\":\n return await locator.inputValue({ timeout });\n case \"isVisible\":\n return await locator.isVisible();\n case \"isEnabled\":\n return await locator.isEnabled();\n case \"isChecked\":\n return await locator.isChecked();\n case \"count\":\n return await locator.count();\n default:\n throw new Error(`Unknown action: ${action}`);\n }\n}\n\n// ============================================================================\n// Helper: Execute expect assertion\n// ============================================================================\n\nasync function executeExpectAssertion(\n locator: PlaywrightLocator,\n matcher: string,\n expected: unknown,\n negated: boolean,\n timeout: number\n): Promise<void> {\n switch (matcher) {\n case \"toBeVisible\": {\n const isVisible = await locator.isVisible();\n if (negated) {\n if (isVisible) throw new Error(\"Expected element to not be visible, but it was visible\");\n } else {\n if (!isVisible) throw new Error(\"Expected element to be visible, but it was not\");\n }\n break;\n }\n case \"toContainText\": {\n const text = await locator.textContent({ timeout });\n const matches = text?.includes(String(expected)) ?? false;\n if (negated) {\n if (matches) throw new Error(`Expected text to not contain \"${expected}\", but got \"${text}\"`);\n } else {\n if (!matches) throw new Error(`Expected text to contain \"${expected}\", but got \"${text}\"`);\n }\n break;\n }\n case \"toHaveValue\": {\n const value = await locator.inputValue({ timeout });\n const matches = value === String(expected);\n if (negated) {\n if (matches) throw new Error(`Expected value to not be \"${expected}\", but it was`);\n } else {\n if (!matches) throw new Error(`Expected value to be \"${expected}\", but got \"${value}\"`);\n }\n break;\n }\n case \"toBeEnabled\": {\n const isEnabled = await locator.isEnabled();\n if (negated) {\n if (isEnabled) throw new Error(\"Expected element to be disabled, but it was enabled\");\n } else {\n if (!isEnabled) throw new Error(\"Expected element to be enabled, but it was disabled\");\n }\n break;\n }\n case \"toBeChecked\": {\n const isChecked = await locator.isChecked();\n if (negated) {\n if (isChecked) throw new Error(\"Expected element to not be checked, but it was checked\");\n } else {\n if (!isChecked) throw new Error(\"Expected element to be checked, but it was not\");\n }\n break;\n }\n default:\n throw new Error(`Unknown matcher: ${matcher}`);\n }\n}\n\n// ============================================================================\n// Create Playwright Handler (for remote use)\n// ============================================================================\n\n/**\n * Create a playwright handler from a Page object.\n * This handler is called by the daemon (via callback) when sandbox needs page operations.\n * Used for remote runtime where the browser runs on the client.\n */\nexport function createPlaywrightHandler(\n page: Page,\n options?: { timeout?: number; baseUrl?: string }\n): PlaywrightCallback {\n const timeout = options?.timeout ?? 30000;\n const baseUrl = options?.baseUrl;\n\n return async (op: PlaywrightOperation): Promise<PlaywrightResult> => {\n try {\n switch (op.type) {\n case \"goto\": {\n const [url, waitUntil] = op.args as [string, string?];\n const targetUrl = baseUrl && !url.startsWith(\"http\") ? `${baseUrl}${url}` : url;\n await page.goto(targetUrl, {\n timeout,\n waitUntil: (waitUntil as \"load\" | \"domcontentloaded\" | \"networkidle\") ?? \"load\",\n });\n return { ok: true };\n }\n case \"reload\":\n await page.reload({ timeout });\n return { ok: true };\n case \"url\":\n return { ok: true, value: page.url() };\n case \"title\":\n return { ok: true, value: await page.title() };\n case \"content\":\n return { ok: true, value: await page.content() };\n case \"waitForSelector\": {\n const [selector, optionsJson] = op.args as [string, string?];\n const opts = optionsJson ? JSON.parse(optionsJson) : {};\n await page.waitForSelector(selector, { timeout, ...opts });\n return { ok: true };\n }\n case \"waitForTimeout\": {\n const [ms] = op.args as [number];\n await page.waitForTimeout(ms);\n return { ok: true };\n }\n case \"waitForLoadState\": {\n const [state] = op.args as [string?];\n await page.waitForLoadState(\n (state as \"load\" | \"domcontentloaded\" | \"networkidle\") ?? \"load\",\n { timeout }\n );\n return { ok: true };\n }\n case \"evaluate\": {\n const [script] = op.args as [string];\n const result = await page.evaluate(script);\n return { ok: true, value: result };\n }\n case \"locatorAction\": {\n const [selectorType, selectorValue, roleOptions, action, actionArg] = op.args as [\n string,\n string,\n string | null,\n string,\n unknown\n ];\n const locator = getLocator(page, selectorType, selectorValue, roleOptions);\n const result = await executeLocatorAction(locator, action, actionArg, timeout);\n return { ok: true, value: result };\n }\n case \"expectLocator\": {\n const [selectorType, selectorValue, roleOptions, matcher, expected, negated, customTimeout] = op.args as [\n string,\n string,\n string | null,\n string,\n unknown,\n boolean,\n number?\n ];\n const locator = getLocator(page, selectorType, selectorValue, roleOptions);\n const effectiveTimeout = customTimeout ?? timeout;\n await executeExpectAssertion(locator, matcher, expected, negated ?? false, effectiveTimeout);\n return { ok: true };\n }\n case \"request\": {\n const [url, method, data, headers] = op.args as [\n string,\n string,\n unknown,\n Record<string, string>?\n ];\n const targetUrl = baseUrl && !url.startsWith(\"http\") ? `${baseUrl}${url}` : url;\n const requestOptions: {\n method?: string;\n data?: unknown;\n headers?: Record<string, string>;\n timeout?: number;\n } = {\n timeout,\n };\n if (headers) {\n requestOptions.headers = headers;\n }\n if (data !== undefined && data !== null) {\n requestOptions.data = data;\n }\n\n const response = await page.request.fetch(targetUrl, {\n method: method as \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\" | \"HEAD\" | \"OPTIONS\",\n ...requestOptions,\n });\n\n // Get response data - try to parse as JSON, fall back to text\n const text = await response.text();\n let json: unknown = null;\n try {\n json = JSON.parse(text);\n } catch {\n // Not valid JSON, that's ok\n }\n\n return {\n ok: true,\n value: {\n status: response.status(),\n ok: response.ok(),\n headers: response.headers(),\n text,\n json,\n body: null, // ArrayBuffer not easily serializable, use text/json instead\n },\n };\n }\n default:\n return { ok: false, error: { name: \"Error\", message: `Unknown operation: ${(op as PlaywrightOperation).type}` } };\n }\n } catch (err) {\n const error = err as Error;\n return { ok: false, error: { name: error.name, message: error.message } };\n }\n };\n}\n\n// ============================================================================\n// Setup Playwright\n// ============================================================================\n\n/**\n * Set up playwright in an isolate context.\n *\n * For local use: provide `page` option (direct page access)\n * For remote use: provide `handler` option (callback pattern)\n */\nexport async function setupPlaywright(\n context: ivm.Context,\n options: PlaywrightSetupOptions | PlaywrightOptions\n): Promise<PlaywrightHandle> {\n const timeout = options.timeout ?? 30000;\n const baseUrl = options.baseUrl;\n\n // Determine if we have a page or handler\n const page = \"page\" in options ? options.page : undefined;\n const handler = \"handler\" in options ? options.handler : undefined;\n\n // Create handler from page if needed\n const effectiveHandler = handler ?? (page ? createPlaywrightHandler(page, { timeout, baseUrl }) : undefined);\n\n if (!effectiveHandler) {\n throw new Error(\"Either page or handler must be provided to setupPlaywright\");\n }\n\n // State for collected data (only used when page is provided directly)\n const browserConsoleLogs: BrowserConsoleLogEntry[] = [];\n const networkRequests: NetworkRequestInfo[] = [];\n const networkResponses: NetworkResponseInfo[] = [];\n\n const global = context.global;\n\n // ========================================================================\n // Event Capture (only when page is provided directly)\n // ========================================================================\n\n let requestHandler: ((request: import(\"playwright\").Request) => void) | undefined;\n let responseHandler: ((response: import(\"playwright\").Response) => void) | undefined;\n let consoleHandler: ((msg: import(\"playwright\").ConsoleMessage) => void) | undefined;\n\n if (page) {\n // Get onEvent callback if provided\n const onEvent = \"onEvent\" in options ? options.onEvent : undefined;\n\n requestHandler = (request: import(\"playwright\").Request) => {\n const info: NetworkRequestInfo = {\n url: request.url(),\n method: request.method(),\n headers: request.headers(),\n postData: request.postData() ?? undefined,\n resourceType: request.resourceType(),\n timestamp: Date.now(),\n };\n networkRequests.push(info);\n\n if (onEvent) {\n onEvent({\n type: \"networkRequest\",\n url: info.url,\n method: info.method,\n headers: info.headers,\n postData: info.postData,\n resourceType: info.resourceType,\n timestamp: info.timestamp,\n });\n }\n };\n\n responseHandler = (response: import(\"playwright\").Response) => {\n const info: NetworkResponseInfo = {\n url: response.url(),\n status: response.status(),\n statusText: response.statusText(),\n headers: response.headers(),\n timestamp: Date.now(),\n };\n networkResponses.push(info);\n\n if (onEvent) {\n onEvent({\n type: \"networkResponse\",\n url: info.url,\n status: info.status,\n statusText: info.statusText,\n headers: info.headers,\n timestamp: info.timestamp,\n });\n }\n };\n\n consoleHandler = (msg: import(\"playwright\").ConsoleMessage) => {\n const entry: BrowserConsoleLogEntry = {\n level: msg.type(),\n args: msg.args().map((arg) => String(arg)),\n timestamp: Date.now(),\n };\n browserConsoleLogs.push(entry);\n\n if (onEvent) {\n onEvent({\n type: \"browserConsoleLog\",\n level: entry.level,\n args: entry.args,\n timestamp: entry.timestamp,\n });\n }\n\n // Print to stdout if console option is true\n if (\"console\" in options && options.console) {\n const prefix = `[browser:${entry.level}]`;\n console.log(prefix, ...entry.args);\n }\n };\n\n page.on(\"request\", requestHandler);\n page.on(\"response\", responseHandler);\n page.on(\"console\", consoleHandler);\n }\n\n // ========================================================================\n // Unified Handler Reference\n // ========================================================================\n\n // Single handler reference that receives operation objects\n global.setSync(\n \"__Playwright_handler_ref\",\n new ivm.Reference(async (opJson: string): Promise<string> => {\n const op = JSON.parse(opJson) as PlaywrightOperation;\n const result = await effectiveHandler(op);\n return JSON.stringify(result);\n })\n );\n\n // ========================================================================\n // Injected JavaScript\n // ========================================================================\n\n // Helper function to invoke handler and handle errors\n context.evalSync(`\n(function() {\n globalThis.__pw_invoke = async function(type, args) {\n const op = JSON.stringify({ type, args });\n const resultJson = __Playwright_handler_ref.applySyncPromise(undefined, [op]);\n const result = JSON.parse(resultJson);\n if (result.ok) {\n return result.value;\n } else {\n const error = new Error(result.error.message);\n error.name = result.error.name;\n throw error;\n }\n };\n})();\n`);\n\n // Page object\n context.evalSync(`\n(function() {\n globalThis.page = {\n async goto(url, options) {\n return __pw_invoke(\"goto\", [url, options?.waitUntil || null]);\n },\n async reload() {\n return __pw_invoke(\"reload\", []);\n },\n async url() {\n return __pw_invoke(\"url\", []);\n },\n async title() {\n return __pw_invoke(\"title\", []);\n },\n async content() {\n return __pw_invoke(\"content\", []);\n },\n async waitForSelector(selector, options) {\n return __pw_invoke(\"waitForSelector\", [selector, options ? JSON.stringify(options) : null]);\n },\n async waitForTimeout(ms) {\n return __pw_invoke(\"waitForTimeout\", [ms]);\n },\n async waitForLoadState(state) {\n return __pw_invoke(\"waitForLoadState\", [state || null]);\n },\n async evaluate(script) {\n return __pw_invoke(\"evaluate\", [script]);\n },\n locator(selector) { return new Locator(\"css\", selector, null); },\n getByRole(role, options) { return new Locator(\"role\", role, options ? JSON.stringify(options) : null); },\n getByText(text) { return new Locator(\"text\", text, null); },\n getByLabel(label) { return new Locator(\"label\", label, null); },\n getByPlaceholder(p) { return new Locator(\"placeholder\", p, null); },\n getByTestId(id) { return new Locator(\"testId\", id, null); },\n async click(selector) { return this.locator(selector).click(); },\n async fill(selector, value) { return this.locator(selector).fill(value); },\n request: {\n async fetch(url, options) {\n const result = await __pw_invoke(\"request\", [url, options?.method || \"GET\", options?.data, options?.headers]);\n return {\n status: () => result.status,\n ok: () => result.ok,\n headers: () => result.headers,\n json: async () => result.json,\n text: async () => result.text,\n body: async () => result.body,\n };\n },\n async get(url, options) {\n return this.fetch(url, { ...options, method: \"GET\" });\n },\n async post(url, options) {\n return this.fetch(url, { ...options, method: \"POST\" });\n },\n async put(url, options) {\n return this.fetch(url, { ...options, method: \"PUT\" });\n },\n async delete(url, options) {\n return this.fetch(url, { ...options, method: \"DELETE\" });\n },\n },\n };\n})();\n`);\n\n // Locator class\n context.evalSync(`\n(function() {\n class Locator {\n #type; #value; #options;\n constructor(type, value, options) {\n this.#type = type;\n this.#value = value;\n this.#options = options;\n }\n\n _getInfo() { return [this.#type, this.#value, this.#options]; }\n\n async click() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"click\", null]);\n }\n async dblclick() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"dblclick\", null]);\n }\n async fill(text) {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"fill\", text]);\n }\n async type(text) {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"type\", text]);\n }\n async check() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"check\", null]);\n }\n async uncheck() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"uncheck\", null]);\n }\n async selectOption(value) {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"selectOption\", value]);\n }\n async clear() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"clear\", null]);\n }\n async press(key) {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"press\", key]);\n }\n async hover() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"hover\", null]);\n }\n async focus() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"focus\", null]);\n }\n async textContent() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"getText\", null]);\n }\n async inputValue() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"getValue\", null]);\n }\n async isVisible() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"isVisible\", null]);\n }\n async isEnabled() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"isEnabled\", null]);\n }\n async isChecked() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"isChecked\", null]);\n }\n async count() {\n return __pw_invoke(\"locatorAction\", [...this._getInfo(), \"count\", null]);\n }\n nth(index) {\n const existingOpts = this.#options ? JSON.parse(this.#options) : {};\n return new Locator(this.#type, this.#value, JSON.stringify({ ...existingOpts, nth: index }));\n }\n }\n globalThis.Locator = Locator;\n})();\n`);\n\n // Extend expect with locator matchers (only if test-environment already defined expect)\n context.evalSync(`\n(function() {\n // Helper to create locator matchers\n function createLocatorMatchers(locator, baseMatchers) {\n const info = locator._getInfo();\n\n const locatorMatchers = {\n async toBeVisible(options) {\n return __pw_invoke(\"expectLocator\", [...info, \"toBeVisible\", null, false, options?.timeout]);\n },\n async toContainText(expected, options) {\n return __pw_invoke(\"expectLocator\", [...info, \"toContainText\", expected, false, options?.timeout]);\n },\n async toHaveValue(expected, options) {\n return __pw_invoke(\"expectLocator\", [...info, \"toHaveValue\", expected, false, options?.timeout]);\n },\n async toBeEnabled(options) {\n return __pw_invoke(\"expectLocator\", [...info, \"toBeEnabled\", null, false, options?.timeout]);\n },\n async toBeChecked(options) {\n return __pw_invoke(\"expectLocator\", [...info, \"toBeChecked\", null, false, options?.timeout]);\n },\n not: {\n async toBeVisible(options) {\n return __pw_invoke(\"expectLocator\", [...info, \"toBeVisible\", null, true, options?.timeout]);\n },\n async toContainText(expected, options) {\n return __pw_invoke(\"expectLocator\", [...info, \"toContainText\", expected, true, options?.timeout]);\n },\n async toHaveValue(expected, options) {\n return __pw_invoke(\"expectLocator\", [...info, \"toHaveValue\", expected, true, options?.timeout]);\n },\n async toBeEnabled(options) {\n return __pw_invoke(\"expectLocator\", [...info, \"toBeEnabled\", null, true, options?.timeout]);\n },\n async toBeChecked(options) {\n return __pw_invoke(\"expectLocator\", [...info, \"toBeChecked\", null, true, options?.timeout]);\n },\n }\n };\n\n // Merge locator matchers with base matchers from test-environment\n if (baseMatchers) {\n return {\n ...baseMatchers,\n ...locatorMatchers,\n not: { ...baseMatchers.not, ...locatorMatchers.not }\n };\n }\n return locatorMatchers;\n }\n\n // Only extend expect if test-environment already defined it\n if (typeof globalThis.expect === 'function') {\n const originalExpect = globalThis.expect;\n globalThis.expect = function(actual) {\n const baseMatchers = originalExpect(actual);\n // If actual is a Locator, add locator-specific matchers\n if (actual && actual.constructor && actual.constructor.name === 'Locator') {\n return createLocatorMatchers(actual, baseMatchers);\n }\n return baseMatchers;\n };\n }\n // If test-environment not loaded, expect remains undefined\n})();\n`);\n\n // ========================================================================\n // Return Handle\n // ========================================================================\n\n return {\n dispose() {\n // Only remove listeners if page was provided directly\n if (page && requestHandler && responseHandler && consoleHandler) {\n page.off(\"request\", requestHandler);\n page.off(\"response\", responseHandler);\n page.off(\"console\", consoleHandler);\n }\n browserConsoleLogs.length = 0;\n networkRequests.length = 0;\n networkResponses.length = 0;\n },\n getBrowserConsoleLogs() {\n return [...browserConsoleLogs];\n },\n getNetworkRequests() {\n return [...networkRequests];\n },\n getNetworkResponses() {\n return [...networkResponses];\n },\n clearCollected() {\n browserConsoleLogs.length = 0;\n networkRequests.length = 0;\n networkResponses.length = 0;\n },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AA;AAAA,IAE7B,cAAc,GAAG;AAAA,MACf,mBAAmB,SAAS;AAAA,MAC5B,gBAAgB,SAAS;AAAA,MACzB,iBAAiB,SAAS;AAAA;AAAA,EAE9B;AAAA;",
8
+ "debugId": "2B6B9A3D4E225DD464756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/isolate-playwright",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module"
5
5
  }
@@ -1,5 +1,7 @@
1
1
  import ivm from "isolated-vm";
2
2
  import type { Page } from "playwright";
3
+ import type { PlaywrightOperation, PlaywrightResult, PlaywrightEvent } from "@ricsam/isolate-protocol";
4
+ export type { PlaywrightOperation, PlaywrightResult, PlaywrightEvent } from "@ricsam/isolate-protocol";
3
5
  export interface NetworkRequestInfo {
4
6
  url: string;
5
7
  method: string;
@@ -15,38 +17,67 @@ export interface NetworkResponseInfo {
15
17
  headers: Record<string, string>;
16
18
  timestamp: number;
17
19
  }
18
- export interface ConsoleLogEntry {
20
+ /**
21
+ * Browser console log entry - logs from the page context (not sandbox).
22
+ */
23
+ export interface BrowserConsoleLogEntry {
19
24
  level: string;
20
25
  args: string[];
21
26
  timestamp: number;
22
27
  }
28
+ /**
29
+ * Callback type for handling playwright operations.
30
+ * Used for remote execution where the page lives on the client.
31
+ */
32
+ export type PlaywrightCallback = (op: PlaywrightOperation) => Promise<PlaywrightResult>;
33
+ /**
34
+ * Options for setting up playwright in an isolate.
35
+ */
36
+ export interface PlaywrightSetupOptions {
37
+ /** Direct page object (for local use) */
38
+ page?: Page;
39
+ /** Handler callback (for remote use - daemon invokes this) */
40
+ handler?: PlaywrightCallback;
41
+ /** Default timeout for operations */
42
+ timeout?: number;
43
+ /** Base URL for relative navigation */
44
+ baseUrl?: string;
45
+ /** If true, browser console logs are printed to stdout */
46
+ console?: boolean;
47
+ /** Unified event callback for all playwright events */
48
+ onEvent?: (event: PlaywrightEvent) => void;
49
+ }
50
+ /**
51
+ * @deprecated Use PlaywrightSetupOptions instead
52
+ */
23
53
  export interface PlaywrightOptions {
24
54
  page: Page;
25
55
  timeout?: number;
26
56
  baseUrl?: string;
27
- onConsoleLog?: (level: string, ...args: unknown[]) => void;
28
57
  onNetworkRequest?: (info: NetworkRequestInfo) => void;
29
58
  onNetworkResponse?: (info: NetworkResponseInfo) => void;
30
59
  }
31
60
  export interface PlaywrightHandle {
32
61
  dispose(): void;
33
- getConsoleLogs(): ConsoleLogEntry[];
62
+ /** Get browser console logs (from the page, not sandbox) */
63
+ getBrowserConsoleLogs(): BrowserConsoleLogEntry[];
34
64
  getNetworkRequests(): NetworkRequestInfo[];
35
65
  getNetworkResponses(): NetworkResponseInfo[];
36
66
  clearCollected(): void;
37
67
  }
38
- export interface TestResult {
39
- name: string;
40
- passed: boolean;
41
- error?: string;
42
- duration: number;
43
- }
44
- export interface PlaywrightExecutionResult {
45
- passed: number;
46
- failed: number;
47
- total: number;
48
- results: TestResult[];
49
- }
50
- export declare function setupPlaywright(context: ivm.Context, options: PlaywrightOptions): Promise<PlaywrightHandle>;
51
- export declare function runPlaywrightTests(context: ivm.Context): Promise<PlaywrightExecutionResult>;
52
- export declare function resetPlaywrightTests(context: ivm.Context): Promise<void>;
68
+ /**
69
+ * Create a playwright handler from a Page object.
70
+ * This handler is called by the daemon (via callback) when sandbox needs page operations.
71
+ * Used for remote runtime where the browser runs on the client.
72
+ */
73
+ export declare function createPlaywrightHandler(page: Page, options?: {
74
+ timeout?: number;
75
+ baseUrl?: string;
76
+ }): PlaywrightCallback;
77
+ /**
78
+ * Set up playwright in an isolate context.
79
+ *
80
+ * For local use: provide `page` option (direct page access)
81
+ * For remote use: provide `handler` option (callback pattern)
82
+ */
83
+ export declare function setupPlaywright(context: ivm.Context, options: PlaywrightSetupOptions | PlaywrightOptions): Promise<PlaywrightHandle>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/isolate-playwright",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "main": "./dist/cjs/index.cjs",
5
5
  "types": "./dist/types/index.d.ts",
6
6
  "exports": {
@@ -16,6 +16,7 @@
16
16
  "typecheck": "tsc --noEmit"
17
17
  },
18
18
  "dependencies": {
19
+ "@ricsam/isolate-protocol": "*",
19
20
  "isolated-vm": "^6"
20
21
  },
21
22
  "peerDependencies": {