Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detox <-> React Native bridge #943

Closed
Tommos0 opened this issue Sep 23, 2018 · 1 comment
Closed

Detox <-> React Native bridge #943

Tommos0 opened this issue Sep 23, 2018 · 1 comment

Comments

@Tommos0
Copy link

Tommos0 commented Sep 23, 2018

Current Detox matchers/testers are all based on the native component tree. However it would be nice if also things from the React-Native JS side could be tested. This would allow one to get e.g. AsyncStorage, Redux state, element props etc., and run tests against them.

I am currently running my own implementation through a second websocket channel for this purpose. E.g.

  • Setup websocket server when starting detox tests
  • React Native connects back to this websocket server
  • Now I can from my tests send JS command to RN (which simply evals what is sent, wraps it in try/catch, waits if result is a promise, and sends the results back as a JSON (or return an error if it cannot be JSONified)). To be able to do this, important objects should be available in the eval scope, such as AsyncStorage, redux state, component refs etc.

I found this setup to be quite powerful for testing, however it adds some complexity because there is a second websocket channel etc. Is it somehow possible to re-use Detox's websocket, or even add this functionality to Detox itself?

@LeoNatan
Copy link
Contributor

This is out of scope for Detox. Detox' main purpose is to test the end result of your app, be it native or RN, and the end result for mobile apps is native UI. What you are describing sounds more fit for unit testing and/or some kind of a higher level component test for RN, which are out of scope.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants