package com.checkpoint.andela.notekeeper.activities;

import android.content.Intent;
import android.support.test.espresso.intent.Intents;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import android.widget.ImageButton;

import com.checkpoint.andela.notekeeper.R;

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.typeText;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.Matchers.allOf;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class CreateNoteTest {

    @Rule
    public ActivityTestRule rule
            = new ActivityTestRule<>(CreateNote.class);

    @Test
    public void testCreateNote() throws Exception {
        Intents.init();
        String title = "Lorem Ipsum";
        String content = "Lorem ipsum dolor sit amet";
        onView(withId(R.id.note_title)).perform(typeText(title));
        onView(withId(R.id.note_content)).perform(typeText(content));
        onView(allOf(instanceOf(ImageButton.class), withParent(withId(R.id.create_note_toolbar)))).perform(click());
        intended(hasComponent(ListNotes.class.getCanonicalName()));
        Intents.release();
    }
}
@@ -74,24 +74,81 @@
 ent.Intent;%0A
+import android.support.test.espresso.action.ViewActions;%0A
 import andro
@@ -188,16 +188,16 @@
 ntents;%0A
-
 import a
@@ -565,16 +565,80 @@
 onView;%0A
+import static android.support.test.espresso.Espresso.pressBack;%0A
 import s
@@ -925,24 +925,102 @@
 sComponent;%0A
+import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;%0A
 import stati
@@ -1153,24 +1153,71 @@
 withParent;%0A
+import static java.util.regex.Pattern.matches;%0A
 import stati
@@ -1372,16 +1372,18 @@
 Test %7B%0A%0A
+%0A%0A
     @Rul
@@ -1902,24 +1902,24 @@
 m(click());%0A
-
         inte
@@ -1970,24 +1970,45 @@
 alName()));%0A
+        pressBack();%0A
         Inte

Create test case for Create Note Activity