fix Runtime.enable race condition with event-based synchronization

Replace arbitrary sleep(200ms) with proper wait for Runtime.executionContextCreated
event in the relay server. This ensures pages are fully ready before Runtime.enable
returns to Playwright, fixing intermittent 'page not found' errors.
This commit is contained in:
Tommy D. Rossi
2025-12-28 15:16:17 +01:00
parent cb2c14b874
commit 63856afb0b
4 changed files with 171 additions and 16 deletions
+4 -4
View File
@@ -1586,13 +1586,13 @@ describe('MCP Server Tests', () => {
expect(normalized).toMatchInlineSnapshot(`
{
"cssLayoutViewport": {
"clientHeight": 528,
"clientHeight": 720,
"clientWidth": 1280,
"pageX": 0,
"pageY": 0,
},
"cssVisualViewport": {
"clientHeight": 528,
"clientHeight": 720,
"clientWidth": 1280,
"offsetX": 0,
"offsetY": 0,
@@ -1603,13 +1603,13 @@ describe('MCP Server Tests', () => {
},
"devicePixelRatio": 1,
"layoutViewport": {
"clientHeight": 528,
"clientHeight": 720,
"clientWidth": 1280,
"pageX": 0,
"pageY": 0,
},
"visualViewport": {
"clientHeight": 528,
"clientHeight": 720,
"clientWidth": 1280,
"offsetX": 0,
"offsetY": 0,