|
@@ -21,14 +21,20 @@ package com.owncloud.android.authentication;
|
|
|
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
+import android.net.Uri;
|
|
|
import android.support.test.InstrumentationRegistry;
|
|
|
import android.support.test.rule.ActivityTestRule;
|
|
|
import android.support.test.runner.AndroidJUnit4;
|
|
|
import android.test.suitebuilder.annotation.LargeTest;
|
|
|
+<<<<<<< HEAD
|
|
|
|
|
|
import com.owncloud.android.BuildConfig;
|
|
|
+=======
|
|
|
+import static org.junit.Assert.assertTrue;
|
|
|
+import com.owncloud.android.ui.activity.FileActivity;
|
|
|
+>>>>>>> add asserts
|
|
|
import com.owncloud.android.R;
|
|
|
-
|
|
|
+//import android.support.v7.app.AppCompat
|
|
|
import org.junit.Rule;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
@@ -38,6 +44,9 @@ import java.lang.reflect.Field;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
|
|
+import java.lang.reflect.Field;
|
|
|
+
|
|
|
+import android.app.Activity;
|
|
|
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.closeSoftKeyboard;
|
|
@@ -49,7 +58,6 @@ import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
|
|
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
|
|
import static org.hamcrest.Matchers.not;
|
|
|
|
|
|
-
|
|
|
@RunWith(AndroidJUnit4.class)
|
|
|
@LargeTest
|
|
|
public class AuthenticatorActivityTest {
|
|
@@ -58,6 +66,7 @@ public class AuthenticatorActivityTest {
|
|
|
public static final String EXTRA_ACCOUNT = "ACCOUNT";
|
|
|
|
|
|
|
|
|
+
|
|
|
private int mResultCode = -2;
|
|
|
private int WAIT_LOGIN = 5000;
|
|
|
|
|
@@ -69,7 +78,8 @@ public class AuthenticatorActivityTest {
|
|
|
AuthenticatorActivity.class){
|
|
|
@Override
|
|
|
protected Intent getActivityIntent() {
|
|
|
- Context targetContext = InstrumentationRegistry.getInstrumentation()
|
|
|
+
|
|
|
+ targetContext = InstrumentationRegistry.getInstrumentation()
|
|
|
.getTargetContext();
|
|
|
Intent result = new Intent(targetContext, AuthenticatorActivity.class);
|
|
|
result.putExtra(EXTRA_ACTION, "");
|
|
@@ -99,14 +109,11 @@ public class AuthenticatorActivityTest {
|
|
|
.perform(typeText(BuildConfig.TEST_PASSWORD), closeSoftKeyboard());
|
|
|
onView(withId(R.id.buttonOK)).perform(click());
|
|
|
|
|
|
- // Check that login button is now enabled
|
|
|
- onView(withId(R.id.buttonOK)).check(matches(isEnabled()));
|
|
|
-
|
|
|
// Check that the Activity ends after clicking
|
|
|
try {
|
|
|
|
|
|
Thread.sleep(WAIT_LOGIN);
|
|
|
- Field f = Activity.class.getDeclaredField("mResultCode"); //NoSuchFieldException
|
|
|
+ Field f = Activity.class.getDeclaredField("mResultCode");
|
|
|
f.setAccessible(true);
|
|
|
mResultCode = f.getInt(mActivityRule.getActivity());
|
|
|
|