From c437c2d0c906f1e9e549f5e74daaabc1a25b54a6 Mon Sep 17 00:00:00 2001 From: serso Date: Fri, 26 Feb 2016 14:59:06 +0100 Subject: [PATCH] FunctionParams test --- .../plot/PlotEditFunctionFragmentTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/src/androidTest/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragmentTest.java b/app/src/androidTest/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragmentTest.java index 235dcdde..c49ea058 100644 --- a/app/src/androidTest/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragmentTest.java +++ b/app/src/androidTest/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragmentTest.java @@ -5,9 +5,12 @@ import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.functions.CppFunction; 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.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withId; import static android.support.test.espresso.matcher.ViewMatchers.withText; +import static org.hamcrest.Matchers.not; public class PlotEditFunctionFragmentTest extends BasePlotTest { @@ -19,4 +22,17 @@ public class PlotEditFunctionFragmentTest extends BasePlotTest { openFunctionsList(); 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()))); + } } \ No newline at end of file