diff --git a/.travis.yml b/.travis.yml index 1659f016..7c136216 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,14 +15,13 @@ android: before_script: # Create and start emulator - cd Friendly-plans - - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a - - emulator -avd test -no-skin -no-audio -no-window & + - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a --skin WXGA800 + - emulator -avd test -no-audio -no-window & - android-wait-for-emulator - adb shell input keyevent 82 & script: ./gradlew test --info -# Turn off because it is not properly working, bug: #106 -# script: ./gradlew test connectedAndroidTest --info +script: ./gradlew test connectedAndroidTest --info --stacktrace before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock diff --git a/Friendly-plans/app/src/androidTest/java/pg/autyzm/friendly_plans/TaskCreateActivityTest.java b/Friendly-plans/app/src/androidTest/java/pg/autyzm/friendly_plans/TaskCreateActivityTest.java index 0c7bf55e..6f720a8f 100644 --- a/Friendly-plans/app/src/androidTest/java/pg/autyzm/friendly_plans/TaskCreateActivityTest.java +++ b/Friendly-plans/app/src/androidTest/java/pg/autyzm/friendly_plans/TaskCreateActivityTest.java @@ -12,6 +12,7 @@ import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; +import android.view.WindowManager; import database.repository.TaskTemplateRepository; import database.entities.TaskTemplate; @@ -44,6 +45,20 @@ public void setUp() { daoSessionResource.getSession(activityRule.getActivity().getApplicationContext())); } + @Before + public void unlockScreen() { + final TaskCreateActivity activity = activityRule.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); + } + @After public void tearDown() { if (idToDelete != null) {