| @ -1,96 +0,0 @@ | |||||
| version: 2 | |||||
| jobs: | |||||
| node: | |||||
| working_directory: ~/rn-dp | |||||
| docker: | |||||
| - image: circleci/node:8 | |||||
| steps: | |||||
| - checkout | |||||
| - restore_cache: | |||||
| key: yarn-v1-{{ checksum "example/yarn.lock" }}-{{ arch }} | |||||
| - restore_cache: | |||||
| key: node-v1-{{ checksum "example/package.json" }}-{{ arch }} | |||||
| - run: cd example && yarn install | |||||
| - save_cache: | |||||
| key: yarn-v1-{{ checksum "example/yarn.lock" }}-{{ arch }} | |||||
| paths: | |||||
| - ~/.cache/yarn | |||||
| - save_cache: | |||||
| key: node-v1-{{ checksum "example/package.json" }}-{{ arch }} | |||||
| paths: | |||||
| - example/node_modules | |||||
| - persist_to_workspace: | |||||
| root: ~/rn-dp | |||||
| paths: | |||||
| - example/node_modules | |||||
| android: | |||||
| working_directory: ~/rn-dp/example/android | |||||
| docker: | |||||
| - image: circleci/android:api-27-node8-alpha | |||||
| environment: | |||||
| JVM_OPTS: -Xmx3200m | |||||
| steps: | |||||
| - checkout: | |||||
| path: ~/rn-dp | |||||
| - attach_workspace: | |||||
| at: ~/rn-dp | |||||
| - restore_cache: | |||||
| key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | |||||
| - run: | |||||
| name: Cd | |||||
| command: cd .. && ls -la | |||||
| - run: | |||||
| name: Download Dependencies | |||||
| command: ./gradlew androidDependencies | |||||
| - save_cache: | |||||
| paths: | |||||
| - ~/.gradle | |||||
| key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | |||||
| - run: | |||||
| name: Setup emulator | |||||
| command: sdkmanager "system-images;android-16;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-16;default;armeabi-v7a" | |||||
| - run: | |||||
| name: Launch emulator | |||||
| command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel auto -verbose | |||||
| background: true | |||||
| - run: | |||||
| name: Wait emulator | |||||
| command: | | |||||
| # start the emulator | |||||
| - emulator -avd circleci-android22 -no-audio -no-window: | |||||
| background: true | |||||
| parallel: true | |||||
| # wait for it to have booted | |||||
| circle-android wait-for-boot | |||||
| # unlock the emulator screen | |||||
| sleep 30 | |||||
| adb shell input keyevent 82 | |||||
| ./gradlew connectedAndroidTest -PdisablePreDex | |||||
| - store_artifacts: | |||||
| path: app/build/reports | |||||
| destination: reports | |||||
| - store_test_results: | |||||
| path: app/build/test-results | |||||
| workflows: | |||||
| version: 2 | |||||
| node-android: | |||||
| jobs: | |||||
| - node | |||||
| - android: | |||||
| requires: | |||||
| - node | |||||
| @ -0,0 +1,56 @@ | |||||
| package com.datepickerexample; | |||||
| import android.support.test.espresso.ViewInteraction; | |||||
| import android.support.test.rule.ActivityTestRule; | |||||
| import android.support.test.runner.AndroidJUnit4; | |||||
| import android.test.suitebuilder.annotation.LargeTest; | |||||
| import android.view.KeyEvent; | |||||
| import org.junit.Rule; | |||||
| import org.junit.Test; | |||||
| import org.junit.runner.RunWith; | |||||
| import static android.support.test.espresso.Espresso.onView; | |||||
| import static android.support.test.espresso.action.ViewActions.click; | |||||
| import static android.support.test.espresso.action.ViewActions.pressKey; | |||||
| import static android.support.test.espresso.action.ViewActions.replaceText; | |||||
| import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; | |||||
| import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription; | |||||
| import static android.support.test.espresso.matcher.ViewMatchers.withText; | |||||
| import static org.hamcrest.Matchers.allOf; | |||||
| @LargeTest | |||||
| @RunWith(AndroidJUnit4.class) | |||||
| public class HelloWorldEspressoTest { | |||||
| @Rule | |||||
| public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class); | |||||
| @Test | |||||
| public void mainActivityTest() { | |||||
| try { | |||||
| Thread.sleep(15000); | |||||
| } catch (InterruptedException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| ViewInteraction minimal = onView(allOf(withText("Minimal"), isDisplayed())); | |||||
| minimal.perform(click()); | |||||
| onView(allOf(withText("Today"), isDisplayed())); | |||||
| onView(allOf(withText("Back"), isDisplayed())).perform(click()); | |||||
| minimal = onView(allOf(withText("Minimal"), isDisplayed())); | |||||
| minimal.perform(click()); | |||||
| try { | |||||
| Thread.sleep(30000); | |||||
| } catch (InterruptedException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| } | |||||