parent
8277e4e102
commit
fc21d2038f
@ -0,0 +1,24 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import static android.support.test.espresso.Espresso.*;
|
||||
import static android.support.test.espresso.action.ViewActions.*;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.*;
|
||||
import static android.support.test.espresso.assertion.ViewAssertions.*;
|
||||
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
|
||||
@LargeTest
|
||||
public class RegistrationActivityTest extends RoutedInstrumentationTestCase {
|
||||
private final static String TAG = RegistrationActivityTest.class.getSimpleName();
|
||||
|
||||
public RegistrationActivityTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testRegistrationButtons() throws Exception {
|
||||
waitOn(RegistrationActivity.class);
|
||||
onView(withId(R.id.registerButton)).check(matches(isDisplayed()));
|
||||
onView(withId(R.id.skipButton)).check(matches(isDisplayed())).perform(click());
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Instrumentation.ActivityMonitor;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||
|
||||
public class RoutedInstrumentationTestCase extends ActivityInstrumentationTestCase2<RoutingActivity> {
|
||||
private static final String TAG = RoutedInstrumentationTestCase.class.getSimpleName();
|
||||
|
||||
public RoutedInstrumentationTestCase() {
|
||||
super(RoutingActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
System.setProperty("dexmaker.dexcache", getInstrumentation().getTargetContext().getCacheDir().getPath());
|
||||
super.setUp();
|
||||
clearSharedPrefs();
|
||||
getActivity();
|
||||
}
|
||||
|
||||
protected void clearSharedPrefs() {
|
||||
PreferenceManager.getDefaultSharedPreferences(getInstrumentation().getTargetContext())
|
||||
.edit().clear().commit();
|
||||
getInstrumentation().getTargetContext().getSharedPreferences(MasterSecretUtil.PREFERENCES_NAME, 0)
|
||||
.edit().clear().commit();
|
||||
}
|
||||
|
||||
protected static void waitOn(Class<? extends Activity> clazz) {
|
||||
Log.w(TAG, "waiting for " + clazz.getName());
|
||||
new ActivityMonitor(clazz.getName(), null, true).waitForActivityWithTimeout(10000);
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.test.AndroidTestCase;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
|
||||
public class UtilTest extends AndroidTestCase {
|
||||
|
||||
}
|
Loading…
Reference in New Issue