diff --git a/circle.yml b/circle.yml index 816cf4dd..4391fbd7 100644 --- a/circle.yml +++ b/circle.yml @@ -16,9 +16,7 @@ dependencies: test: pre: - - echo no | android create avd --force -n test -t android-24 --abi default/armeabi-v7a --skin 480x800: - parallel: true - - emulator -avd test -no-audio -no-window: + - emulator -avd circleci-android22 -no-audio -no-window: background: true override: @@ -29,7 +27,7 @@ test: background: true - adb shell settings put global animator_duration_scale 0: background: true + - sleep 30 - adb shell input keyevent 82: - background: true - - (./gradlew clean build lint test connectedCheck): + - ./gradlew clean build lint test connectedCheck -PdisablePreDex: timeout: 32000 \ No newline at end of file diff --git a/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderEventCallBacksTest.java b/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderEventCallBacksTest.java index 5f6f2102..d3282eac 100644 --- a/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderEventCallBacksTest.java +++ b/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderEventCallBacksTest.java @@ -5,10 +5,12 @@ import android.support.test.InstrumentationRegistry; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; +import android.view.WindowManager; import com.ncorti.slidetoact.SlideToActView; import org.jetbrains.annotations.NotNull; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -35,6 +37,20 @@ protected Intent getActivityIntent() { } }; + @Before + public void setUp() { + // Force wake up of device for Circle CI test execution. + final SampleActivity activity = mActivityRule.getActivity(); + Runnable wakeUpDevice = new Runnable() { + public void run() { + activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | + WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | + WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + }; + activity.runOnUiThread(wakeUpDevice); + } + @Test public void testOnSlideCompleteListener() throws InterruptedException { final boolean[] flag = {false}; diff --git a/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderLockedTest.java b/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderLockedTest.java index 76caa486..b1189518 100644 --- a/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderLockedTest.java +++ b/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderLockedTest.java @@ -5,9 +5,11 @@ import android.support.test.InstrumentationRegistry; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; +import android.view.WindowManager; import com.ncorti.slidetoact.SlideToActView; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,6 +36,20 @@ protected Intent getActivityIntent() { } }; + @Before + public void setUp() { + // Force wake up of device for Circle CI test execution. + final SampleActivity activity = mActivityRule.getActivity(); + Runnable wakeUpDevice = new Runnable() { + public void run() { + activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | + WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | + WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + }; + activity.runOnUiThread(wakeUpDevice); + } + @Test public void testLockedSlideToActView_withSwipeRight_staysLocked() throws InterruptedException { onView(withId(R.id.slide_locked)).perform(swipeRight()); diff --git a/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderResetTest.java b/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderResetTest.java index 9bab1d4d..8c68bb9e 100644 --- a/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderResetTest.java +++ b/example/src/androidTest/java/com/ncorti/slidetoact/example/SliderResetTest.java @@ -5,9 +5,11 @@ import android.support.test.InstrumentationRegistry; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; +import android.view.WindowManager; import com.ncorti.slidetoact.SlideToActView; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -35,6 +37,20 @@ protected Intent getActivityIntent() { } }; + @Before + public void setUp() { + // Force wake up of device for Circle CI test execution. + final SampleActivity activity = mActivityRule.getActivity(); + Runnable wakeUpDevice = new Runnable() { + public void run() { + activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | + WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | + WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + }; + activity.runOnUiThread(wakeUpDevice); + } + @Test public void testSlideToActView_withSwipeRight_isCompleted() throws InterruptedException { onView(withId(R.id.slide_1)).perform(swipeRight());