package com.nextzy.mrsmile.mvp_example.calculator;

import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;

import com.nextzy.mrsmile.mvp_example.R;

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.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;

/**
 * Created by nextzy on 8/6/2016 AD.
 */
@RunWith(AndroidJUnit4.class)
@LargeTest
public class CalculatorActivityTest {

    @Rule
    public ActivityTestRule<CalculatorActivity> activityTestRule = new ActivityTestRule<>(CalculatorActivity.class);

    @Before
    public void setUp() {

    }

    @Test
    public void isVisibleButtonZero() {
        onView(withId(R.id.btn_zero)).check(matches(isDisplayed()));
    }

    @Test
    public void isVisibleButtonOne() {
        onView(withId(R.id.btn_one)).check(matches(isDisplayed()));
    }

    @Test
    public void isVisibleButtonTwo() {
        onView(withId(R.id.btn_two)).check(matches(isDisplayed()));
    }

    @Test
    public void isVisibleButtonThere() {
        onView(withId(R.id.btn_there)).check(matches(isDisplayed()));
    }

    @Test
    public void isVisibleButtonFour() {
        onView(withId(R.id.btn_four)).check(matches(isDisplayed()));
    }

    @Test
    public void isVisibleButtonFive() {
        onView(withId(R.id.btn_five)).check(matches(isDisplayed()));
    }

    @Test
    public void isVisibleButtonSix() {
        onView(withId(R.id.btn_six)).check(matches(isDisplayed()));
    }

    @Test
    public void isVisibleButtonSeven() {
        onView(withId(R.id.btn_seven)).check(matches(isDisplayed()));
    }

    @Test
    public void isVisibleButtonEight() {
        onView(withId(R.id.btn_eight)).check(matches(isDisplayed()));
    }

    @Test
    public void isVisibleButtonNine() {
        onView(withId(R.id.btn_nine)).check(matches(isDisplayed()));
    }

    @Test
    public void isVisibleButtonClear() {
        onView(withId(R.id.btn_clear)).check(matches(isDisplayed()));
    }

    @Test
    public void isVisibleButtonDot() {
        onView(withId(R.id.btn_dot)).check(matches(isDisplayed()));
    }

}
@@ -638,16 +638,91 @@
 .withId;
+%0Aimport static android.support.test.espresso.matcher.ViewMatchers.withText;
 %0A%0A/**%0A *
@@ -1125,32 +1125,101 @@
 sDisplayed()));%0A
+        onView(withId(R.id.btn_zero)).check(matches(withText(%220%22)));%0A
     %7D%0A%0A    @Test
@@ -1318,32 +1318,100 @@
 sDisplayed()));%0A
+        onView(withId(R.id.btn_one)).check(matches(withText(%221%22)));%0A
     %7D%0A%0A    @Test
@@ -1510,32 +1510,100 @@
 sDisplayed()));%0A
+        onView(withId(R.id.btn_two)).check(matches(withText(%222%22)));%0A
     %7D%0A%0A    @Test
@@ -1706,32 +1706,102 @@
 sDisplayed()));%0A
+        onView(withId(R.id.btn_there)).check(matches(withText(%223%22)));%0A
     %7D%0A%0A    @Test
@@ -1902,32 +1902,101 @@
 sDisplayed()));%0A
+        onView(withId(R.id.btn_four)).check(matches(withText(%224%22)));%0A
     %7D%0A%0A    @Test
@@ -2097,32 +2097,101 @@
 sDisplayed()));%0A
+        onView(withId(R.id.btn_five)).check(matches(withText(%225%22)));%0A
     %7D%0A%0A    @Test
@@ -2290,32 +2290,100 @@
 sDisplayed()));%0A
+        onView(withId(R.id.btn_six)).check(matches(withText(%226%22)));%0A
     %7D%0A%0A    @Test
@@ -2486,32 +2486,102 @@
 sDisplayed()));%0A
+        onView(withId(R.id.btn_seven)).check(matches(withText(%227%22)));%0A
     %7D%0A%0A    @Test
@@ -2684,32 +2684,102 @@
 sDisplayed()));%0A
+        onView(withId(R.id.btn_eight)).check(matches(withText(%228%22)));%0A
     %7D%0A%0A    @Test
@@ -2880,32 +2880,101 @@
 sDisplayed()));%0A
+        onView(withId(R.id.btn_nine)).check(matches(withText(%229%22)));%0A
     %7D%0A%0A    @Test
@@ -3081,24 +3081,94 @@
 played()));%0A
+        onView(withId(R.id.btn_clear)).check(matches(withText(%22c%22)));%0A
     %7D%0A%0A    @
@@ -3283,12 +3283,282 @@
 ));%0A    
+    onView(withId(R.id.btn_dot)).check(matches(withText(%22.%22)));%0A    %7D%0A%0A    @Test%0A    public void isVisibleTextDisplay() %7B%0A        onView(withId(R.id.tv_display)).check(matches(isDisplayed()));%0A        onView(withId(R.id.tv_display)).check(matches(withText(%220.00%22)));%0A    
 %7D
-%0A
 %0A%7D

add onView chekWithText