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

106 activity test with clicking are not working on travis #112

Merged
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down