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

Android support. Phase I. #148

Merged
merged 2 commits into from
Jun 12, 2017
Merged

Android support. Phase I. #148

merged 2 commits into from
Jun 12, 2017

Conversation

simonracz
Copy link
Contributor

@simonracz simonracz commented Jun 2, 2017

Android support Phase I. (#96)

I tried to limit the scope to make a small PR. I failed in that. :)

Goals/achievements of this PR:

  • Hook into React Native and monitor the internals.
    -- JS timers
    -- JS bridge
    -- UI thread
    -- UI BG thread
    -- Native Modules thread
    -- JS thread
  • Set up Espresso IdlingResources for them.
  • Implement React Native fast reloading.
  • To NOT include RN as a dependency. Everything is implemented with reflection.
  • Come up with how to integrate detox by the end user. Easy, one-liner solution.
  • Async test runner. (Based on Rotem's idea)
  • Keep the architecture similar to detox iOS.

Non-goals of the PR:

  • JS -> Java invocation
  • Mapping the JS test API -> Espresso API
  • Wrapping up ADB
  • Integrating Android into detox configuration, detox build, detox test
  • Fully automated tests

I tested it manually in the following sample project detox-android-tester. I set up a websocket server and called hard-wired commands through it to the test runner.

I suggest to start at Detox.Java when checking this PR.

@rotemmiz
Copy link
Member

This is an amazing step towards an Android version!
Following my correspondence with @simonracz , we're waiting for him to merge detox-android-tester with detox/test app.

@simonracz
Copy link
Contributor Author

Hey Rotem,

The new commit contains the following:

  • I've extended the detox/scripts/build.sh to build the detox aar files. (this must be triggered manually like this : ./scripts/build.sh noframework android)
  • I've updated the detox/test/android project, it uses the built aar.
  • I've added a helper script for the manual test. Please check out it's comments. detox/test/scripts/test_android.sh

Copy link
Member

@rotemmiz rotemmiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few notes here for future use

compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules

testCompile 'junit:junit:4.12'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to androidTestCompile espresso here? I think we should just androidTestCompile detox instead, and remove line 129.

import com.wix.detox.espresso.ReactBridgeIdlingResource;
import com.wix.detox.espresso.ReactNativeTimersIdlingResource;

import org.joor.Reflect;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may be able to use the same reflection library as we use for our internal reflection mechanism (a small wrapper on top of Apache ReflectionUtils)

@rotemmiz rotemmiz merged commit 520d6a3 into wix:master Jun 12, 2017
@simonracz simonracz deleted the android_pr branch June 19, 2017 09:19
@wix wix locked and limited conversation to collaborators Jul 23, 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

Successfully merging this pull request may close these issues.

None yet

3 participants