Removing changes associated to KeyListFragment, they will get their own PR.
This commit is contained in:
@@ -27,13 +27,10 @@ import android.view.View;
|
||||
import android.widget.ViewAnimator;
|
||||
|
||||
import com.nispok.snackbar.Snackbar;
|
||||
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.KeyAdapter.KeyItem;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.KeySectionedListAdapter;
|
||||
import org.sufficientlysecure.keychain.ui.widget.EncryptKeyCompletionView;
|
||||
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
|
||||
@@ -89,21 +86,6 @@ public abstract class CustomMatchers {
|
||||
};
|
||||
}
|
||||
|
||||
public static Matcher<RecyclerView.ViewHolder> withKeyHolderId(final long keyId) {
|
||||
return new BoundedMatcher<RecyclerView.ViewHolder, KeySectionedListAdapter.KeyItemViewHolder>
|
||||
(KeySectionedListAdapter.KeyItemViewHolder.class) {
|
||||
@Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("with ViewHolder id: " + keyId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean matchesSafely(KeySectionedListAdapter.KeyItemViewHolder item) {
|
||||
return item.getItemId() == keyId;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Matcher<View> withKeyToken(@ColorRes final long keyId) {
|
||||
return new BoundedMatcher<View, EncryptKeyCompletionView>(EncryptKeyCompletionView.class) {
|
||||
public void describeTo(Description description) {
|
||||
|
||||
@@ -20,28 +20,20 @@ package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.support.test.espresso.ViewAction;
|
||||
import android.support.test.espresso.action.ViewActions;
|
||||
import android.support.test.espresso.contrib.RecyclerViewActions;
|
||||
import android.support.test.espresso.matcher.ViewMatchers;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Rule;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.matcher.CustomMatchers;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||
|
||||
import static android.support.test.espresso.Espresso.onData;
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnHolderItem;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
@@ -49,7 +41,6 @@ import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.sufficientlysecure.keychain.TestHelpers.checkSnackbar;
|
||||
import static org.sufficientlysecure.keychain.TestHelpers.importKeysFromResource;
|
||||
import static org.sufficientlysecure.keychain.matcher.CustomMatchers.withKeyHolderId;
|
||||
import static org.sufficientlysecure.keychain.matcher.CustomMatchers.withKeyItemId;
|
||||
|
||||
//TODO This test is disabled because it needs to be fixed to work with updated code
|
||||
@@ -79,12 +70,10 @@ public class EditKeyTest {
|
||||
importKeysFromResource(activity, "x.sec.asc");
|
||||
|
||||
// navigate to edit key dialog
|
||||
onView(allOf(
|
||||
isAssignableFrom(RecyclerView.class),
|
||||
withId(android.R.id.list)))
|
||||
.perform(actionOnHolderItem(
|
||||
withKeyHolderId(0x9D604D2F310716A3L), click()));
|
||||
|
||||
onData(withKeyItemId(0x9D604D2F310716A3L))
|
||||
.inAdapterView(allOf(isAssignableFrom(AdapterView.class),
|
||||
isDescendantOfA(ViewMatchers.withId(R.id.key_list_list))))
|
||||
.perform(click());
|
||||
onView(withId(R.id.view_key_card_user_ids_edit)).perform(click());
|
||||
|
||||
// no-op should yield snackbar
|
||||
|
||||
@@ -27,10 +27,8 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.support.test.espresso.contrib.RecyclerViewActions;
|
||||
import android.support.test.espresso.intent.Intents;
|
||||
import android.support.test.espresso.intent.rule.IntentsTestRule;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -38,7 +36,6 @@ import org.junit.Rule;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.TestHelpers;
|
||||
import org.sufficientlysecure.keychain.matcher.CustomMatchers;
|
||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
@@ -52,7 +49,6 @@ import static android.support.test.espresso.Espresso.openActionBarOverflowOrOpti
|
||||
import static android.support.test.espresso.Espresso.pressBack;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
||||
import static android.support.test.espresso.contrib.RecyclerViewActions.actionOnHolderItem;
|
||||
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.hasType;
|
||||
@@ -75,7 +71,6 @@ import static org.sufficientlysecure.keychain.TestHelpers.pickRandom;
|
||||
import static org.sufficientlysecure.keychain.TestHelpers.randomString;
|
||||
import static org.sufficientlysecure.keychain.matcher.CustomMatchers.isRecyclerItemView;
|
||||
import static org.sufficientlysecure.keychain.matcher.CustomMatchers.withDisplayedChild;
|
||||
import static org.sufficientlysecure.keychain.matcher.CustomMatchers.withKeyHolderId;
|
||||
import static org.sufficientlysecure.keychain.matcher.CustomMatchers.withKeyItemId;
|
||||
import static org.sufficientlysecure.keychain.matcher.DrawableMatcher.withDrawable;
|
||||
|
||||
@@ -211,12 +206,12 @@ public class MiscCryptOperationTests {
|
||||
|
||||
//@Test
|
||||
public void testEncryptTokenFromKeyView() throws Exception {
|
||||
onView(allOf(
|
||||
isAssignableFrom(RecyclerView.class),
|
||||
withId(android.R.id.list)))
|
||||
.perform(actionOnHolderItem(
|
||||
withKeyHolderId(0x9D604D2F310716A3L), click()));
|
||||
|
||||
// navigate to edit key dialog
|
||||
onData(withKeyItemId(0x9D604D2F310716A3L))
|
||||
.inAdapterView(allOf(isAssignableFrom(AdapterView.class),
|
||||
isDescendantOfA(withId(R.id.key_list_list))))
|
||||
.perform(click());
|
||||
onView(withId(R.id.view_key_action_encrypt_text)).perform(click());
|
||||
|
||||
// make sure the encrypt is correctly set
|
||||
|
||||
Reference in New Issue
Block a user