diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 3c239d44b..7fae773f0 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -21,10 +21,14 @@ dependencies { testCompile 'org.robolectric:robolectric:3.0-rc3' // UI testing with Espresso - androidTestCompile 'com.android.support.test:runner:0.2' - androidTestCompile 'com.android.support.test:rules:0.2' - androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1' - androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.1' + androidTestCompile 'com.android.support.test:runner:0.3' + androidTestCompile 'com.android.support.test:rules:0.3' + androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2' + androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2') { + exclude group: 'com.android.support', module: 'appcompat' + exclude group: 'com.android.support', module: 'support-v4' + exclude module: 'recyclerview-v7' + } // Temporary workaround for bug: https://code.google.com/p/android-test-kit/issues/detail?id=136 // from https://github.com/googlesamples/android-testing/blob/master/build.gradle#L21 diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/CreateKeyActivityTest.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/CreateKeyActivityTest.java index c3741fdef..a20b61cf3 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/CreateKeyActivityTest.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/CreateKeyActivityTest.java @@ -17,14 +17,11 @@ package org.sufficientlysecure.keychain; -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; +import android.test.ActivityInstrumentationTestCase2; +import android.test.suitebuilder.annotation.LargeTest; import android.text.method.HideReturnsTransformationMethod; import android.text.method.PasswordTransformationMethod; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; import org.sufficientlysecure.keychain.ui.CreateKeyActivity; import static android.support.test.espresso.Espresso.onView; @@ -43,18 +40,24 @@ import static org.hamcrest.Matchers.allOf; import static org.sufficientlysecure.keychain.matcher.EditTextMatchers.withError; import static org.sufficientlysecure.keychain.matcher.EditTextMatchers.withTransformationMethod; -@RunWith(AndroidJUnit4.class) -public class CreateKeyActivityTest { +@LargeTest +public class CreateKeyActivityTest extends ActivityInstrumentationTestCase2 { public static final String SAMPLE_NAME = "Sample Name"; public static final String SAMPLE_EMAIL = "sample_email@gmail.com"; public static final String SAMPLE_ADDITIONAL_EMAIL = "sample_additional_email@gmail.com"; public static final String SAMPLE_PASSWORD = "sample_password"; - @Rule - public ActivityTestRule mActivityRule = new ActivityTestRule<>(CreateKeyActivity.class); + public CreateKeyActivityTest() { + super(CreateKeyActivity.class); + } + + @Override + public void setUp() throws Exception { + super.setUp(); + getActivity(); + } - @Test public void testCreateMyKey() { // Clicks create my key onView(withId(R.id.create_key_create_key_button))