diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-15 17:54:53 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-17 18:53:00 +0200 |
commit | 2d03965777e99782a0ee7a33e6b90805c79bb07e (patch) | |
tree | edac9c050ea26f7c0b35da3eb199a2a8d466cc88 /OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptDecryptSymmetricTests.java | |
parent | 312cb3884826c7b9eee19d83a5581f96a10a7a00 (diff) | |
download | open-keychain-2d03965777e99782a0ee7a33e6b90805c79bb07e.tar.gz open-keychain-2d03965777e99782a0ee7a33e6b90805c79bb07e.tar.bz2 open-keychain-2d03965777e99782a0ee7a33e6b90805c79bb07e.zip |
instrument: finish symmetric text encryption test
Diffstat (limited to 'OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptDecryptSymmetricTests.java')
-rw-r--r-- | OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptDecryptSymmetricTests.java | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptDecryptSymmetricTests.java b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptDecryptSymmetricTests.java index f668472b2..5141a1635 100644 --- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptDecryptSymmetricTests.java +++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/EncryptDecryptSymmetricTests.java @@ -39,10 +39,14 @@ import static android.support.test.espresso.Espresso.pressBack; import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.action.ViewActions.typeText; import static android.support.test.espresso.assertion.ViewAssertions.matches; +import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withId; import static android.support.test.espresso.matcher.ViewMatchers.withText; +import static org.hamcrest.CoreMatchers.not; import static org.sufficientlysecure.keychain.TestHelpers.checkSnackbar; +import static org.sufficientlysecure.keychain.TestHelpers.randomString; import static org.sufficientlysecure.keychain.actions.CustomActions.actionOpenDrawer; +import static org.sufficientlysecure.keychain.matcher.DrawableMatcher.withDrawable; @FixMethodOrder(MethodSorters.NAME_ASCENDING) @@ -50,7 +54,7 @@ import static org.sufficientlysecure.keychain.actions.CustomActions.actionOpenDr @LargeTest public class EncryptDecryptSymmetricTests { - public static final String PASSPHRASE = "fn9nf8wnaf"; + public static final String PASSPHRASE = randomString(5, 20); @Rule public final ActivityTestRule<MainActivity> mActivity @@ -68,13 +72,14 @@ public class EncryptDecryptSymmetricTests { MainActivity activity = mActivity.getActivity(); + String text = randomString(10, 40); + // navigate to encrypt/decrypt onView(withId(R.id.drawer_layout)).perform(actionOpenDrawer()); onView(ViewMatchers.withText(R.string.nav_encrypt_decrypt)).perform(click()); onView(withId(R.id.encrypt_text)).perform(click()); { - String text = "how much wood"; onView(withId(R.id.encrypt_text_text)).perform(typeText(text)); openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext()); @@ -99,7 +104,28 @@ public class EncryptDecryptSymmetricTests { pressBack(); onView(withId(R.id.decrypt_from_clipboard)).perform(click()); - // TODO fix thing, finish test + { + onView(withId(R.id.passphrase_passphrase)).perform(typeText(PASSPHRASE)); + onView(withText(R.string.btn_unlock)).perform(click()); + + onView(withId(R.id.decrypt_text_plaintext)).check(matches( + withText(text))); + + // TODO write generic status verifier + + onView(withId(R.id.result_encryption_text)).check(matches( + withText(R.string.decrypt_result_encrypted))); + onView(withId(R.id.result_signature_text)).check(matches( + withText(R.string.decrypt_result_no_signature))); + onView(withId(R.id.result_signature_layout)).check(matches( + not(isDisplayed()))); + + onView(withId(R.id.result_encryption_icon)).check(matches( + withDrawable(R.drawable.status_lock_closed_24dp))); + onView(withId(R.id.result_signature_icon)).check(matches( + withDrawable(R.drawable.status_signature_unknown_cutout_24dp))); + + } } |