package fr.miage.paris10.projetm1.helpu;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withText;

import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.widget.Toast;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static android.support.test.espresso.matcher.RootMatchers.withDecorView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.RootMatchers.withDecorView;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;

/**
 * Created by dameimou on 07/03/2017.
 */

@RunWith(AndroidJUnit4.class)
public class LoginActivityTest {
    @Rule
    public ActivityTestRule<LoginActivity> loginActivityRule  = new ActivityTestRule<>(LoginActivity.class);


    @Test
    public void testGoodLogIn()  throws InterruptedException {
        onView(withId(R.id.input_email))
                .perform(typeText("33012900@u-paris10.fr"), closeSoftKeyboard());
        Thread.sleep(1000);
        onView(withId(R.id.input_password)).perform(typeText("azerty"), closeSoftKeyboard());
        Thread.sleep(500);
        onView(withId(R.id.btn_login)).perform(click());
    }
   @Test
    public void testFalseLogIn() throws InterruptedException {
       LoginActivity activity = loginActivityRule.getActivity();
        onView(withId(R.id.input_email))
                .perform(typeText("a@u-paris10.fr"), closeSoftKeyboard());
        Thread.sleep(1000);
        onView(withId(R.id.input_password)).perform(typeText("azerty"), closeSoftKeyboard());
        Thread.sleep(500);
        onView(withId(R.id.btn_login)).perform(click());
               onView(withText("Login failed")).
                       inRoot(withDecorView(not(is(activity.getWindow().getDecorView())))).
                       check(matches(isDisplayed()));
    }
}

@@ -2527,32 +2527,34 @@
 yboard());%0A     
+//
    Thread.sleep(
@@ -2555,32 +2555,34 @@
 sleep(500);%0A    
+//
     onView(withI
@@ -2620,24 +2620,26 @@
 k());%0A      
+//
          onV
@@ -2668,32 +2668,34 @@
 iled%22)).%0A       
+//
                 
@@ -2762,32 +2762,34 @@
 w())))).%0A       
+//
                 

Update LoginActivityTest.java