aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-06-22 15:45:08 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-06-22 15:45:08 +0200
commit8307a5bffc0a6b7b9b603da25efca01080254551 (patch)
tree9d60e327cc73cd53be5932945331ef1e7bdcf8d5 /OpenKeychain/src
parent5f91c57b4aec211d0cc0b6e0261191a8cde762e3 (diff)
downloadopen-keychain-8307a5bffc0a6b7b9b603da25efca01080254551.tar.gz
open-keychain-8307a5bffc0a6b7b9b603da25efca01080254551.tar.bz2
open-keychain-8307a5bffc0a6b7b9b603da25efca01080254551.zip
instrument: test error handling in asymmetric operations
Diffstat (limited to 'OpenKeychain/src')
-rw-r--r--OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java45
1 files changed, 45 insertions, 0 deletions
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 e0c44be9a..5bb11e4bf 100644
--- a/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java
+++ b/OpenKeychain/src/androidTest/java/org/sufficientlysecure/keychain/ui/AsymmetricFileOperationTests.java
@@ -46,6 +46,7 @@ import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import static android.support.test.InstrumentationRegistry.getInstrumentation;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
+import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
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;
@@ -343,4 +344,48 @@ public class AsymmetricFileOperationTests {
}
+ @Test
+ public void testGeneralErrorHandling() throws Exception {
+
+ // navigate to encrypt files fragment
+ onView(withId(R.id.encrypt_files)).perform(click());
+
+ File[] files = getImageNames();
+
+ { // encrypt screen
+
+ onView(withId(R.id.encrypt_share)).perform(click());
+ checkSnackbar(Style.ERROR, R.string.error_no_file_selected);
+
+ handleAddFileIntent(files[0]);
+ onView(withId(R.id.file_list_entry_add)).perform(click());
+
+ handleAddFileIntent(files[1]);
+ onView(withId(R.id.file_list_entry_add)).perform(click());
+
+ onView(withId(R.id.encrypt_share)).perform(click());
+ checkSnackbar(Style.ERROR, R.string.select_encryption_key);
+
+ onView(withId(R.id.sign)).perform(click());
+ onData(withKeyItemId(0x9D604D2F310716A3L))
+ .inAdapterView(isAssignableFrom(AdapterView.class))
+ .perform(click());
+
+ onView(withId(R.id.encrypt_share)).perform(click());
+ checkSnackbar(Style.ERROR, R.string.error_detached_signature);
+
+ // the EncryptKeyCompletionView is tested individually
+ onView(withId(R.id.recipient_list)).perform(tokenEncryptViewAddToken(0x9D604D2F310716A3L));
+
+ onView(withId(R.id.encrypt_save)).perform(click());
+ checkSnackbar(Style.ERROR, R.string.error_multi_files);
+
+ openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
+ onView(withText(R.string.btn_copy_encrypted_signed)).perform(click());
+ checkSnackbar(Style.ERROR, R.string.error_multi_clipboard);
+
+ }
+
+ }
+
}