instrument: some cleanup

This commit is contained in:
Vincent Breitmoser 2015-06-22 23:07:38 +02:00
parent aee2ca7b9a
commit 1590d8f538
4 changed files with 14 additions and 91 deletions

View File

@ -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())));
}
}

View File

@ -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())));
}
}

View File

@ -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<MainActivity> mActivity
= new ActivityTestRule<MainActivity>(MainActivity.class) {
@Override
protected Intent getActivityIntent() {
Intent intent = super.getActivityIntent();
intent.putExtra(MainActivity.EXTRA_SKIP_FIRST_TIME, true);
return intent;
}
};
public final ActivityTestRule<CreateKeyActivity> mActivity
= new ActivityTestRule<>(CreateKeyActivity.class);
@Test
public void testCreateMyKey() {
mActivity.getActivity();

View File

@ -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")
))
));
}
}