-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Did you test using the latest Detox?
- I have tested this issue on the latest Detox release and it still reproduces.
Did your test fail and you're not sure why?
- I have read the troubleshooting guide and it didn't help me.
What happened?
When running E2E tests that interact with WebView elements and then trigger native modals/drawers to open, Detox throws an unexpected WebSocket error that crashes the test.
What was the expected behaviour?
Expected Behavior
Detox should gracefully handle invokeResult messages that arrive after the test context has switched from WebView to native layer
Actual Behavior
The test crashes with a DetoxRuntimeError because the WebSocket message handler doesn't expect invokeResult messages when there's no corresponding inflight promise.
Help us reproduce this issue!
- Execute a WebView action (e.g., scroll, waitfor) that triggers asynchronous operations
- The action causes a native modal/drawer to open over the WebView
- WebView operations complete and send invokeResult messages back through WebSocket
- Detox has already switched context to native layer
- WebSocket handler rejects the invokeResult message as unexpected
- This might be difficult to reproduce, as there might be some specific async process happening in my web app
In what environment did this happen?
Detox version: 20.41.2
Platform: iOS
React Native version: 0.77.3
Has Fabric (React Native's new rendering system) enabled: yes
Node version: 22.13.1
Device model: Any Iphone
iOS version: 26.0
macOS version:
Xcode version: 26.1
Test-runner (select one): jest
Detox logs
Detox logs
Unexpected error on an attempt to handle the response received over the web socket.
Unexpected message received over the web socket: invokeResult
The payload was:
{"messageId":9,"type":"invokeResult","params":{}}
Device logs
Device logs
paste your device.log here!
More data, please!
No response