/* * Catroid: An on-device visual programming system for Android devices * Copyright (C) 2010-2016 The Catrobat Team * (<http://developer.catrobat.org/credits>) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * An additional term exception under section 7 of the GNU Affero * General Public License, version 3, is available at * http://developer.catrobat.org/license_additional_term * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.catrobat.catroid.uiespresso.formulaeditor; import android.support.test.runner.AndroidJUnit4; import org.catrobat.catroid.R; import org.catrobat.catroid.ui.ScriptActivity; import org.catrobat.catroid.uiespresso.util.BaseActivityInstrumentationRule; import org.catrobat.catroid.uiespresso.util.UiTestUtils; import org.catrobat.catroid.uiespresso.util.actions.CustomActions; import org.junit.After; 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.action.ViewActions.click; import static android.support.test.espresso.matcher.ViewMatchers.withId; @RunWith(AndroidJUnit4.class) public class FormulaEditorTest { @Rule public BaseActivityInstrumentationRule<ScriptActivity> baseActivityTestRule = new BaseActivityInstrumentationRule<>(ScriptActivity.class, true, false); @Before public void setUp() throws Exception { UiTestUtils.createProject("formulaEditorInputTest"); baseActivityTestRule.launchActivity(null); } @Test public void numericValuesTest() { onView(withId(R.id.brick_set_variable_edit_text)).perform(click()); //typeText not working for formula editor, so use CustomActions.typeInValue onView(withId(R.id.formula_editor_edit_field)).perform(CustomActions.typeInValue("12345,678")); onView(withId(R.id.formula_editor_keyboard_ok)).perform(click()); } @After public void tearDown() throws Exception { } }