package com.socialteinc.socialate;


import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.test.InstrumentationRegistry;
import android.support.test.espresso.ViewInteraction;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import com.google.firebase.auth.FirebaseAuth;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

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;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static com.google.firebase.database.DatabaseReference.goOffline;
import static junit.framework.Assert.assertEquals;

@RunWith(AndroidJUnit4.class)
public class ViewEditProfileActivityTest {
    @Rule
    public ActivityTestRule<ViewEditProfileActivity> rule = new ActivityTestRule<ViewEditProfileActivity>(ViewEditProfileActivity.class){


     //   FirebaseAuth mmm;

    //@Before


        @Override
        protected Intent getActivityIntent() {
            goOffline();
            Context targetContext = InstrumentationRegistry.getInstrumentation()
                    .getTargetContext();
            Intent result = new Intent(targetContext, ViewEditProfileActivity.class);
            String userKey = "B7TbLOcLXggRL1TyQxrgrGlwMiO2";
            String userName = "Joe Manga";
            result.putExtra("userName", userName);
            result.putExtra("userKey", userKey);
            return result;
        }
    };

    @Test
    public void onCreateTest() throws InterruptedException {
        Thread.sleep(5000);
    }

    /*@Test
    public void testViewProfile() {
        ViewEditProfileActivity instance = new ViewEditProfileActivity();
        //instance.
        Assert.assertEquals(true, matches(isDisplayed()));


        /*onView(withId(R.id.action_view_edit_profile)).perform(click());

        onView(withId(R.id.FullNameTextView)).check(matches(isDisplayed()));
        onView(withId(R.id.DisplayNameTextView)).check(matches(isDisplayed()));
        onView(withId(R.id.emailTextView)).check(matches(isDisplayed()));
        onView(withId(R.id.ProfileImageView)).check(matches(isDisplayed()));
        */
       /* ViewInteraction val = onView(withId(R.id.DisplayNameTextView)).check(matches(isDisplayed()));
        ViewInteraction val2 = onView(withId(R.id.FullNameTextView)).check(matches(isDisplayed()));
        ViewInteraction val3 = onView(withId(R.id.emailTextView)).check(matches(isDisplayed()));
        ViewInteraction val4 = onView(withId(R.id.ProfileImageView)).check(matches(isDisplayed()));

        assertEquals(true,val);
        assertEquals(true,val2);
        assertEquals(true,val3);
        assertEquals(true,val4);*/



}

@@ -1365,55 +1365,8 @@
 s)%7B%0A
-%0A%0A     //   FirebaseAuth mmm;%0A%0A    //@Before%0A%0A%0A
     
@@ -1438,16 +1438,18 @@
         
+//
 goOfflin
@@ -1449,24 +1449,47 @@
 oOffline();%0A
+            getMock();%0A
             
@@ -1933,16 +1933,219 @@
     %7D;%0A%0A
+    FirebaseAuth mAuth;%0A%0A    public FirebaseAuth getMock() %7B%0A        mAuth = FirebaseAuth.getInstance();%0A        mAuth.signInWithEmailAndPassword(%22joe@gmail.com%22,%22sandile%22);%0A        return mAuth;%0A    %7D%0A%0A
     @Tes
@@ -2246,18 +2246,16 @@
  %7D%0A%0A    
-/*
 @Test%0A  
@@ -2300,165 +2300,31 @@
     
-ViewEditProfileActivity instance = new ViewEditProfileActivity();%0A        //instance.%0A        Assert.assertEquals(true, matches(isDisplayed()));%0A%0A%0A        /*
+goOffline();%0A        //
 onVi
@@ -2379,25 +2379,24 @@
 m(click());%0A
-%0A
         onVi
@@ -2699,40 +2699,94 @@
     
+%7D%0A%0A
     
-*
 /
+*
 %0A    
-   /* ViewInteraction
+@Test%0A    public void testViewLogic()%7B%0A        getMock();%0A        String
  val
@@ -2862,33 +2862,35 @@
 ()))
-;%0A        ViewInteraction
+.toString();%0A        String
  val
@@ -2964,33 +2964,35 @@
 ()))
-;%0A        ViewInteraction
+.toString();%0A        String
  val
@@ -3063,33 +3063,37 @@
 ()))
-;%0A        ViewInteraction
+.toString();%0A        //String
  val
@@ -3163,16 +3163,27 @@
 ayed()))
+.toString()
 ;%0A%0A     
@@ -3275,32 +3275,34 @@
 ,val3);%0A        
+//
 assertEquals(tru
@@ -3313,12 +3313,17 @@
 l4);
+%0A    %7D
 */%0A%0A%0A
-%0A
 %7D%0A

Update tests