
package fr.neamar.kiss.androidTest;

import fr.neamar.kiss.R;
import fr.neamar.kiss.MainActivity;

import android.support.test.rule.ActivityTestRule;
import android.support.test.InstrumentationRegistry;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;

import org.junit.Before;
import org.junit.Test;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static android.support.test.espresso.action.ViewActions.typeText;

@LargeTest
public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {

    private MainActivity mActivity;

    public MainActivityTest() {
        super(MainActivity.class);
    }
    @Before
    public void setUp() throws Exception {
        super.setUp();
        injectInstrumentation(InstrumentationRegistry.getInstrumentation());
        mActivity = getActivity();
    }

    @Test
    public void testCanTypeTextIntoSearchBox() {
        onView(withId(R.id.searchEditText)).perform(typeText("Test"));
        onView(withId(R.id.searchEditText)).check(matches(withText("Test")));
    }
}

@@ -35,121 +35,8 @@
 t;%0A%0A
-import fr.neamar.kiss.R;%0Aimport fr.neamar.kiss.MainActivity;%0A%0Aimport android.support.test.rule.ActivityTestRule;%0A
 impo
@@ -223,29 +223,68 @@
 re;%0A
+%0A
 import 
-org.junit.Test
+fr.neamar.kiss.MainActivity;%0Aimport fr.neamar.kiss.R
 ;%0A%0Ai
@@ -343,16 +343,89 @@
 onView;%0A
+import static android.support.test.espresso.action.ViewActions.typeText;%0A
 import s
@@ -494,16 +494,94 @@
 atches;%0A
+import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;%0A
 import s
@@ -723,81 +723,8 @@
 ext;
-%0Aimport static android.support.test.espresso.action.ViewActions.typeText;
 %0A%0A@L
@@ -824,45 +824,8 @@
  %7B%0A%0A
-    private MainActivity mActivity;%0A%0A
     
@@ -1059,20 +1059,8 @@
     
- mActivity =
  get
@@ -1082,18 +1082,8 @@
  %7D%0A%0A
-    @Test%0A
     
@@ -1281,11 +1281,896 @@
 );%0A    %7D
+%0A%0A    public void testSearchResultAppears() %7B%0A        onView(withId(R.id.searchEditText)).perform(typeText(%22blahblah%22));%0A        onView(withId(R.id.item_search_icon)).check(matches(isDisplayed()));%0A        onView(withId(R.id.item_search_text)).check(matches(withText(%22Search for %E2%80%9Cblahblah%E2%80%9D%22)));%0A    %7D%0A%0A    public void testTorchToggleAppears() %7B%0A        onView(withId(R.id.searchEditText)).perform(typeText(%22torch%22));%0A        onView(withId(R.id.item_toggle_icon)).check(matches(isDisplayed()));%0A        onView(withId(R.id.item_toggle_name)).check(matches(withText(%22Toggle: Torch%22)));%0A    %7D%0A%0A    public void testBatterySettingAppears() %7B%0A        onView(withId(R.id.searchEditText)).perform(typeText(%22batter%22));%0A        onView(withId(R.id.item_setting_icon)).check(matches(isDisplayed()));%0A        onView(withId(R.id.item_setting_name)).check(matches(withText(%22Setting: Battery%22)));%0A    %7D
 %0A%7D%0A

Add tests for some items appearing when searching