FunctionParams test

This commit is contained in:
serso 2016-02-26 14:59:06 +01:00
parent ea4d107b12
commit c437c2d0c9

View File

@ -5,9 +5,12 @@ import org.solovyev.android.calculator.R;
import org.solovyev.android.calculator.functions.CppFunction; import org.solovyev.android.calculator.functions.CppFunction;
import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches; 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 android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText; import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.not;
public class PlotEditFunctionFragmentTest extends BasePlotTest { public class PlotEditFunctionFragmentTest extends BasePlotTest {
@ -19,4 +22,17 @@ public class PlotEditFunctionFragmentTest extends BasePlotTest {
openFunctionsList(); openFunctionsList();
onView(withId(R.id.function_name)).check(matches(withText("x+y"))); onView(withId(R.id.function_name)).check(matches(withText("x+y")));
} }
@Test
public void testShouldHaveOnlyTwoParameters() throws Exception {
openFunctionEditor();
onView(withId(R.id.function_params_add)).check(matches(isDisplayed()));
onView(withId(R.id.function_params_add)).perform(click());
onView(withId(R.id.function_params_add)).check(matches(isDisplayed()));
onView(withId(R.id.function_params_add)).perform(click());
onView(withId(R.id.function_params_add)).check(matches(not(isDisplayed())));
}
} }