instrument: fix accidentally broken test

This commit is contained in:
Vincent Breitmoser 2015-06-17 23:11:11 +02:00
parent f5aa36ef9f
commit 297f53e171

View File

@ -17,17 +17,18 @@
package org.sufficientlysecure.keychain;
import android.support.test.InstrumentationRegistry;
import android.content.Intent;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.sufficientlysecure.keychain.ui.CreateKeyActivity;
import org.sufficientlysecure.keychain.ui.MainActivity;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
@ -47,26 +48,29 @@ import static org.sufficientlysecure.keychain.matcher.EditTextMatchers.withTrans
@RunWith(AndroidJUnit4.class)
@LargeTest
public class CreateKeyActivityTest extends ActivityInstrumentationTestCase2<CreateKeyActivity> {
public class CreateKeyActivityTest {
public static final String SAMPLE_NAME = "Sample Name";
public static final String SAMPLE_EMAIL = "sample_email@gmail.com";
public static final String SAMPLE_ADDITIONAL_EMAIL = "sample_additional_email@gmail.com";
public static final String SAMPLE_PASSWORD = "sample_password";
public CreateKeyActivityTest() {
super(CreateKeyActivity.class);
}
@Before
public void setUp() throws Exception {
super.setUp();
injectInstrumentation(InstrumentationRegistry.getInstrumentation());
getActivity();
}
@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;
}
};
@Test
public void testCreateMyKey() {
mActivity.getActivity();
// Clicks create my key
onView(withId(R.id.create_key_create_key_button))
.perform(click());