instrument: adapt to new decrypt file dialog, and some minor fixes
This commit is contained in:
@@ -52,7 +52,6 @@ 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.doesNotExist;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static android.support.test.espresso.contrib.DrawerActions.openDrawer;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasCategories;
|
||||
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasExtra;
|
||||
@@ -140,8 +139,6 @@ public class AsymmetricFileOperationTests {
|
||||
handleOpenFileIntentKitKat(outputFile);
|
||||
onView(withId(R.id.decrypt_files)).perform(click());
|
||||
|
||||
onView(withId(R.id.decrypt_files_action_decrypt)).perform(click());
|
||||
|
||||
{ // decrypt
|
||||
onView(withId(R.id.passphrase_passphrase)).perform(typeText("x"));
|
||||
onView(withText(R.string.btn_unlock)).perform(click());
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.TestHelpers;
|
||||
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
|
||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
@@ -51,6 +52,7 @@ import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.hamcrest.CoreMatchers.hasItem;
|
||||
import static org.sufficientlysecure.keychain.TestHelpers.checkSnackbar;
|
||||
import static org.sufficientlysecure.keychain.TestHelpers.getImageNames;
|
||||
import static org.sufficientlysecure.keychain.TestHelpers.importKeysFromResource;
|
||||
import static org.sufficientlysecure.keychain.TestHelpers.pickRandom;
|
||||
@@ -97,8 +99,6 @@ public class MiscFileOperationTests {
|
||||
handleOpenFileIntentKitKat(file);
|
||||
onView(withId(R.id.decrypt_files)).perform(click());
|
||||
|
||||
onView(withId(R.id.decrypt_files_action_decrypt)).perform(click());
|
||||
|
||||
{ // decrypt
|
||||
|
||||
// open context menu
|
||||
@@ -112,6 +112,17 @@ public class MiscFileOperationTests {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecryptEmptySelection() throws Exception {
|
||||
|
||||
// decrypt any non-pgp file
|
||||
handleOpenFileEmptyKitKat();
|
||||
onView(withId(R.id.decrypt_files)).perform(click());
|
||||
|
||||
checkSnackbar(Style.ERROR, R.string.no_file_selected);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecryptNonPgpClipboard() throws Exception {
|
||||
|
||||
@@ -134,6 +145,21 @@ public class MiscFileOperationTests {
|
||||
}
|
||||
|
||||
|
||||
@TargetApi(VERSION_CODES.KITKAT)
|
||||
private void handleOpenFileEmptyKitKat() {
|
||||
Intent data = new Intent();
|
||||
data.setData(null);
|
||||
|
||||
Intents.intending(allOf(
|
||||
hasAction(Intent.ACTION_OPEN_DOCUMENT),
|
||||
hasType("*/*"),
|
||||
hasCategories(hasItem(Intent.CATEGORY_OPENABLE))
|
||||
// hasExtraWithKey(Intent.EXTRA_ALLOW_MULTIPLE)
|
||||
)).respondWith(
|
||||
new ActivityResult(Activity.RESULT_OK, data)
|
||||
);
|
||||
}
|
||||
|
||||
@TargetApi(VERSION_CODES.KITKAT)
|
||||
private void handleOpenFileIntentKitKat(File file) {
|
||||
Intent data = new Intent();
|
||||
|
||||
Reference in New Issue
Block a user