Skip to content

Commit

Permalink
Changed AVD target emulator for Circle CI
Browse files Browse the repository at this point in the history
  • Loading branch information
cortinico committed Jun 1, 2017
1 parent a5c06c5 commit 5d200c5
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 5 deletions.
8 changes: 3 additions & 5 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 5d200c5

Please sign in to comment.