diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java index 5bb11e4bf..ad9d52ef9 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java @@ -248,39 +248,6 @@ public class AsymmetricFileOperationTests { // make sure the encrypt is correctly set onView(withId(R.id.result_encryption_icon)).check(matches(withDisplayedChild(1))); - onView(withId(R.id.encrypt_text_text)).perform(typeText(cleartext)); - - onView(withId(R.id.encrypt_copy)).perform(click()); - } - - // go to decrypt from clipboard view - pressBack(); - pressBack(); - - openDrawer(R.id.drawer_layout); - onView(withText(R.string.nav_encrypt_decrypt)).perform(click()); - onView(withId(R.id.decrypt_from_clipboard)).perform(click()); - - { // decrypt - - onView(withId(R.id.passphrase_passphrase)).perform(typeText("x")); - onView(withText(R.string.btn_unlock)).perform(click()); - - onView(isRecyclerItemView(R.id.decrypted_files_list, - hasDescendant(withText(R.string.filename_unknown_text)))) - .check(matches(allOf(withEncryptionStatus(true), withSignatureNone()))); - - } - - pressBack(); - onView(withId(R.id.decrypt_from_clipboard)).perform(click()); - - { // decrypt again, passphrase should be cached - - onView(isRecyclerItemView(R.id.decrypted_files_list, - hasDescendant(withText(R.string.filename_unknown_text)))) - .check(matches(allOf(withEncryptionStatus(true), withSignatureNone()))); - } } diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java index 103ab7cd3..e53df4f8d 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricTextOperationTests.java @@ -143,39 +143,6 @@ public class AsymmetricTextOperationTests { // make sure the encrypt is correctly set onView(withId(R.id.result_encryption_icon)).check(matches(withDisplayedChild(1))); - onView(withId(R.id.encrypt_text_text)).perform(typeText(cleartext)); - - onView(withId(R.id.encrypt_copy)).perform(click()); - } - - // go to decrypt from clipboard view - pressBack(); - pressBack(); - - openDrawer(R.id.drawer_layout); - onView(withText(R.string.nav_encrypt_decrypt)).perform(click()); - onView(withId(R.id.decrypt_from_clipboard)).perform(click()); - - { // decrypt - - onView(withId(R.id.passphrase_passphrase)).perform(typeText("x")); - onView(withText(R.string.btn_unlock)).perform(click()); - - onView(isRecyclerItemView(R.id.decrypted_files_list, - hasDescendant(withText(R.string.filename_unknown_text)))) - .check(matches(allOf(withEncryptionStatus(true), withSignatureNone()))); - - } - - pressBack(); - onView(withId(R.id.decrypt_from_clipboard)).perform(click()); - - { // decrypt again, passphrase should be cached - - onView(isRecyclerItemView(R.id.decrypted_files_list, - hasDescendant(withText(R.string.filename_unknown_text)))) - .check(matches(allOf(withEncryptionStatus(true), withSignatureNone()))); - } } diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/CreateKeyActivityTest.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/CreateKeyActivityTest.java index ade99efec..cf8e7ae12 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/CreateKeyActivityTest.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/CreateKeyActivityTest.java @@ -18,7 +18,6 @@ package org.sufficientlysecure.keychain.ui; -import android.content.Intent; import android.support.test.espresso.matcher.ViewMatchers; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; @@ -30,7 +29,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.ui.MainActivity; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.action.ViewActions.click; @@ -58,16 +56,10 @@ public class CreateKeyActivityTest { public static final String SAMPLE_PASSWORD = "sample_password"; @Rule - public final ActivityTestRule mActivity - = new ActivityTestRule(MainActivity.class) { - @Override - protected Intent getActivityIntent() { - Intent intent = super.getActivityIntent(); - intent.putExtra(MainActivity.EXTRA_SKIP_FIRST_TIME, true); - return intent; - } - }; + public final ActivityTestRule mActivity + = new ActivityTestRule<>(CreateKeyActivity.class); + @Test public void testCreateMyKey() { mActivity.getActivity(); diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/SymmetricTextOperationTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/SymmetricTextOperationTests.java index 8e539d1e0..26c9693bf 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/SymmetricTextOperationTests.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/SymmetricTextOperationTests.java @@ -77,6 +77,7 @@ public class SymmetricTextOperationTests { protected Intent getActivityIntent() { Intent intent = super.getActivityIntent(); intent.putExtra(MainActivity.EXTRA_SKIP_FIRST_TIME, true); + intent.putExtra(MainActivity.EXTRA_INIT_FRAG, MainActivity.ID_ENCRYPT_DECRYPT); return intent; } }; @@ -89,8 +90,6 @@ public class SymmetricTextOperationTests { String text = randomString(10, 30); // navigate to encrypt/decrypt - openDrawer(R.id.drawer_layout); - onView(ViewMatchers.withText(R.string.nav_encrypt_decrypt)).perform(click()); onView(withId(R.id.encrypt_text)).perform(click()); { @@ -152,8 +151,6 @@ public class SymmetricTextOperationTests { String text = randomString(10, 30); // navigate to encrypt/decrypt - openDrawer(R.id.drawer_layout); - onView(ViewMatchers.withText(R.string.nav_encrypt_decrypt)).perform(click()); onView(withId(R.id.encrypt_text)).perform(click()); { @@ -170,17 +167,17 @@ public class SymmetricTextOperationTests { onView(withId(R.id.encrypt_share)).perform(click()); - } + intended(allOf( + hasAction("android.intent.action.CHOOSER"), + hasExtra(equalTo(Intent.EXTRA_INTENT), allOf( + hasAction(Intent.ACTION_SEND), + hasFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION), + hasExtraWithKey(Intent.EXTRA_TEXT), + hasType("text/plain") + )) + )); - intended(allOf( - hasAction("android.intent.action.CHOOSER"), - hasExtra(equalTo(Intent.EXTRA_INTENT), allOf( - hasAction(Intent.ACTION_SEND), - hasFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION), - hasExtraWithKey(Intent.EXTRA_TEXT), - hasType("text/plain") - )) - )); + } }