mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
instrument: some cleanup
This commit is contained in:
parent
aee2ca7b9a
commit
1590d8f538
@ -248,39 +248,6 @@ public class AsymmetricFileOperationTests {
|
|||||||
// make sure the encrypt is correctly set
|
// make sure the encrypt is correctly set
|
||||||
onView(withId(R.id.result_encryption_icon)).check(matches(withDisplayedChild(1)));
|
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())));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -143,39 +143,6 @@ public class AsymmetricTextOperationTests {
|
|||||||
// make sure the encrypt is correctly set
|
// make sure the encrypt is correctly set
|
||||||
onView(withId(R.id.result_encryption_icon)).check(matches(withDisplayedChild(1)));
|
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())));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
package org.sufficientlysecure.keychain.ui;
|
package org.sufficientlysecure.keychain.ui;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.support.test.espresso.matcher.ViewMatchers;
|
import android.support.test.espresso.matcher.ViewMatchers;
|
||||||
import android.support.test.rule.ActivityTestRule;
|
import android.support.test.rule.ActivityTestRule;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
@ -30,7 +29,6 @@ import org.junit.Rule;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.sufficientlysecure.keychain.R;
|
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.Espresso.onView;
|
||||||
import static android.support.test.espresso.action.ViewActions.click;
|
import static android.support.test.espresso.action.ViewActions.click;
|
||||||
@ -58,16 +56,10 @@ public class CreateKeyActivityTest {
|
|||||||
public static final String SAMPLE_PASSWORD = "sample_password";
|
public static final String SAMPLE_PASSWORD = "sample_password";
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public final ActivityTestRule<MainActivity> mActivity
|
public final ActivityTestRule<CreateKeyActivity> mActivity
|
||||||
= new ActivityTestRule<MainActivity>(MainActivity.class) {
|
= new ActivityTestRule<>(CreateKeyActivity.class);
|
||||||
@Override
|
|
||||||
protected Intent getActivityIntent() {
|
|
||||||
Intent intent = super.getActivityIntent();
|
|
||||||
intent.putExtra(MainActivity.EXTRA_SKIP_FIRST_TIME, true);
|
|
||||||
return intent;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testCreateMyKey() {
|
public void testCreateMyKey() {
|
||||||
|
|
||||||
mActivity.getActivity();
|
mActivity.getActivity();
|
||||||
|
@ -77,6 +77,7 @@ public class SymmetricTextOperationTests {
|
|||||||
protected Intent getActivityIntent() {
|
protected Intent getActivityIntent() {
|
||||||
Intent intent = super.getActivityIntent();
|
Intent intent = super.getActivityIntent();
|
||||||
intent.putExtra(MainActivity.EXTRA_SKIP_FIRST_TIME, true);
|
intent.putExtra(MainActivity.EXTRA_SKIP_FIRST_TIME, true);
|
||||||
|
intent.putExtra(MainActivity.EXTRA_INIT_FRAG, MainActivity.ID_ENCRYPT_DECRYPT);
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -89,8 +90,6 @@ public class SymmetricTextOperationTests {
|
|||||||
String text = randomString(10, 30);
|
String text = randomString(10, 30);
|
||||||
|
|
||||||
// navigate to encrypt/decrypt
|
// 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());
|
onView(withId(R.id.encrypt_text)).perform(click());
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -152,8 +151,6 @@ public class SymmetricTextOperationTests {
|
|||||||
String text = randomString(10, 30);
|
String text = randomString(10, 30);
|
||||||
|
|
||||||
// navigate to encrypt/decrypt
|
// 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());
|
onView(withId(R.id.encrypt_text)).perform(click());
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -170,17 +167,17 @@ public class SymmetricTextOperationTests {
|
|||||||
|
|
||||||
onView(withId(R.id.encrypt_share)).perform(click());
|
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")
|
|
||||||
))
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user